PROJECT - NEW FEATURE
[ import location(s) as .csv]
[what]
- ] NEW feature to enable users to import .csv files
- ] REVIEW existing code (similar) - have existing code in page - view/person, that exports record to file( person record as a .vcf file)
- ] MOVE code to
[why]
- ] outlook addresses exported to .csv
- ] excel
- ] gmail
- ] many
[where]
- ]
[when]
- ]
[example]
- ]
[how-to]
- ] user uploads .csv file, in a specified format, ex locations.csv
- ] reads the file
- ] creates location entries for each
[reference]
- ]
developer implementation
[-process]
-
] export "format" required
-
] name
-
] url
-
] telephone
-
] street1
-
] street2
-
] city
-
] state/province
-
] country
-
] zip/postal
-
]
-
] overall process outline
-
] get(file) - user uploads file to server -> use file upload on ?? option - save file on server
-
] read(file)
-
] map line in file
-
ex {name, address1, address2, city,province,country,postal,telephone,url}
-
convert city name to city code
-
IF city doesnt exist {new city }
-
convert province name to province code
-
convert country name to country code
-
for location (aka parent id ) use "dfault || user specified
-
] handle empty fields
-
[-notes]
-
*] mysql has an input file function
-
] (BM on android)
-
*] use 1 insert statement with many values
-
] VS looping insert statement
-
] review export person as .vcf
-
] PAGE view/person - has block of server side code in POST section, code creates file .csv file to download,
-
] have "input type = submit, value=export" - which fires the code post code
-
] new class - exportFile
-
] moving code from PAGE(view/person) inline into class
-
] review export-people
-
] code highlightiing is broken in wm ide, 100+errors,
status
[-previous-]
- [2015-05-30] view/people -v-005
- ] -v-005 - new PAGE-version-005 - x] REMOVES code to write file as .vcf
- [2015-05-30] fileExport
- x] # 5213 - PAGE-CLASS-fileExport
[-current-]
-
]
[-next-]
-
]
// @place.street1+" "+@place.street2+"</street><locality>"+@city.name_sector+"</locality><region>"+@state.name_map+"</region><code>"+@place.postalORzip+"</code><country>"+@country.name_atlas+"
// string text = "fkdfdsfdflkdkfk@dfsdfjk72388389@kdkfkdfkkl@jkdjkfjd@jjjk@"; text = text.Replace("@", "@" + System.Environment.NewLine);
// var dataFile = Server.MapPath("/users/vCard4.vcf");
// successfully CREATES the file in the server directory, ] copy file to where i need it
// File.WriteAllText(@dataFile, vCard4);
// I want to write the file to the response object so the user is prompted to "SaveAs"
// TRY 1] response.redirect GET vCard4 file should prompt download of file
// WORKS to write the contents of the file to the browser,
// Response.Redirect(@Href("~/users/vCard4.vcf"));
// TRY 2] writeFile directly to response object
// WORK to write the contents of the file to the page,
// Response.TransmitFile(@dataFile);
// TRY 3] // WORKS to saveAS, PRB = ] filename & .ext cur=page filename and ext, need = custom and .vcf ext
/* current function VS this Response.Clear(); Response.ContentType = "text/vcard"; Response.TransmitFile("/users/vCard4.vcf"); // Response.WriteFile("/users/vCard4.vcf"); // ... */