protected void importm_Click(object sender, EventArgs e) { MostreDB mostre = new MostreDB(); if (FileUpload1.PostedFile.FileName != "") { string ServerPath = ""; if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".XLS")) { ServerPath = Server.MapPath("~/Downloads/FisiereReceptie/"); } else { if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith("B1COP.CSV") || FileUpload1.PostedFile.FileName.ToUpper().EndsWith("B2COP.CSV")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Bacto/"); } if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith("CCOP.CSV") || FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C2COP.CSV") || FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C3COP.CSV")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Combi/"); } if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C.CSV")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/CombiDelta/"); } if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C1COP.CSV")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Combi/"); } /* * if ((Path.GetFileName(FileUpload1.PostedFile.FileName).ToUpper().IndexOf("A") >= 0) && FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".TXT")) * { * ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Crio/"); * loglink = GetApplicationPath() + @"/Downloads/CSV_ImportateManual/Crio/"; * } */ } string filenameserver = ServerPath + Path.GetFileName(FileUpload1.PostedFile.FileName); FileUpload1.PostedFile.SaveAs(filenameserver); if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".XLS")) { mostre.ImportFisReceptie(filenameserver); } if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".CSV") || (Path.GetFileName(FileUpload1.PostedFile.FileName).ToUpper().IndexOf("A") >= 0 && FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".TXT"))) { mostre.ImportManual(filenameserver); } BindData(); } }
protected void importcr_Click(object sender, EventArgs e) { MostreDB mostre = new MostreDB(); if (FileUpload1.PostedFile.FileName != "" && FileUpload2.PostedFile.FileName != "") { string ServerPath = ""; if ((Path.GetFileName(FileUpload1.PostedFile.FileName).ToUpper().IndexOf("A3") >= 0) && FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".TXT")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Crio/"); } string filenameserver = ServerPath + Path.GetFileName(FileUpload1.PostedFile.FileName); string xlsnameserver = ServerPath + Path.GetFileName(FileUpload2.PostedFile.FileName); filenameserver = filenameserver.ToLower(); xlsnameserver = xlsnameserver.ToLower(); FileUpload1.PostedFile.SaveAs(filenameserver); FileUpload2.PostedFile.SaveAs(xlsnameserver); mostre.ImportManual(filenameserver); BindData(); } }
protected void importm_Click(object sender, EventArgs e) { MostreDB mostre = new MostreDB(); if (FileUpload1.PostedFile.FileName != "") { string ServerPath = ""; if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".XLS")) { ServerPath = Server.MapPath("~/Downloads/FisiereReceptie/"); } else { if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith("B1.CSV") || FileUpload1.PostedFile.FileName.ToUpper().EndsWith("B2.CSV")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Bacto/"); } if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C.CSV") || FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C2.CSV") || FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C3.CSV") || FileUpload1.PostedFile.FileName.ToUpper().EndsWith("C1.CSV")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Combi/"); } if ((Path.GetFileName(FileUpload1.PostedFile.FileName).ToUpper().IndexOf("A") >= 0) && FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".TXT")) { ServerPath = Server.MapPath("~/Downloads/CSV_ImportateManual/Crio/"); } } string filenameserver = ServerPath + Path.GetFileName(FileUpload1.PostedFile.FileName); FileUpload1.PostedFile.SaveAs(filenameserver); if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".XLS")) mostre.ImportFisReceptie(filenameserver); if (FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".CSV") || (Path.GetFileName(FileUpload1.PostedFile.FileName).ToUpper().IndexOf("A") >= 0 && FileUpload1.PostedFile.FileName.ToUpper().EndsWith(".TXT"))) mostre.ImportManual(filenameserver); BindData(); } }