public static string Execute() { var db = new ProductsCatalogData(); var excelReader = new ExcelCatalogProductsReader(db.Products); var zipParser = new ZipParser("../../../Jan 2015 Report.zip", new List<string>() { ".xls" }, excelReader); zipParser.Parse(); return "Products added to MongoDB products catalog"; }
public ActionResult Post() { string username, password, json; HttpPostedFileBase file; try // Extracting the form contents from request. { username = Request.Form["username"]; password = Request.Form["password"]; file = Request.Files["file"]; } catch { TempData["Message"] = "Invalid data in form"; return(new RedirectResult("/")); } try // Uploaded zip file structure interpreted to JSON. { json = ZipParser.zipToJSONString(file); } catch { TempData["Message"] = "Invalid zip file"; return(new RedirectResult("/")); } // Makes request to DataManagementSystem switch (RequestMaker.makeReqest(json, username, password)) { // User gets a different message depending // on the response from DataManagementSystem. case 200: { TempData["Message"] = "Successfully sent zip"; return(new RedirectResult("/")); } case 401: { TempData["Message"] = "Invalid username or password"; return(new RedirectResult("/")); } default: { TempData["Message"] = "Problem sending data"; return(new RedirectResult("/")); } } }
public static string Execute() { var db = new ProductsCatalogData(); var excelReader = new ExcelCatalogProductsReader(db.Products); var zipParser = new ZipParser("../../../Jan 2015 Report.zip", new List <string>() { ".xls" }, excelReader); zipParser.Parse(); return("Products added to MongoDB products catalog"); }
public static string Execute() { var storesDb = new StoresData(); var excelReader = new ExcelSalesReader(storesDb.Sales, storesDb.Products); var zipParser = new ZipParser("../../../Jan 2015 Report.zip", new List <string>() { ".xls" }, excelReader); zipParser.Parse(true); storesDb.SaveChanges(); return("Excels imported"); }
private void button1_Click(object sender, EventArgs e) { ZipParser <SiteLink> zipParser = new ZipParser <SiteLink>(); zipParser.GetListfromFile("https://zipzip.ru/price.zip"); }