static void Main(string[] args) { var headings = new List <string> { "Entity Name", "Entity Reference" }; var collection = new List <string[]>() { new string[] { "Jhon", "sdds621wd" } }; var Amend = new List <string[]>() { new string[] { "Jane", "fnshbsfkjdf55" } }; var fileDirectory = $"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}/Temp"; var fileName = "ExcelWirteTest"; var Excel = new WriteToExcel(); Excel.WriteToSheet(headings, collection, "Sheet1"); Excel.Save(fileName, fileDirectory); Excel.AmmendToSheet(Amend); Excel.Save(); Excel.ChangeSheet("Nooooo"); Excel.dispose(); Console.Read(); }
public void Write() { var Value = new List <string[]>(); foreach (var item in Collection) { item.Contact.Any(x => !string.IsNullOrEmpty(x.Email)); foreach (var Contact in item.Contact) { if (!string.IsNullOrEmpty(Contact.Email)) { var city = string.Empty; foreach (var deco in item.Deco) { city = (deco.StructuredAddress == null) ? "unknown" : deco.StructuredAddress.City; Value.Add(new string[] { Contact.FirstName, Contact.LastName, Contact.TelNo, Contact.CellNo, Contact.Email, string.Join(",", Contact.AdnConfiguration.Types), Contact.AdnConfiguration.Email.ToString(), Contact.AdnConfiguration.Sms.ToString(), item.Name, item.Reference, deco.Name, city, item.ClientId }); } } } } var newFile = new WriteToExcel(); newFile.WriteToSheet(Headings, Value); newFile.Save(FileName, FileDirectory); }
public IWriteToExcel CreateWriteToExcel() { IWriteToExcel result = null; result = new WriteToExcel(); return(result); }
public void Write() { var newFile = new WriteToExcel(); newFile.WriteToSheet(Headings, Collection); newFile.Save(FileName, Path); }
private void CreateExcelFile() { ExamModel model = (ExamModel)examsGrid.SelectedItem; WriteToExcel w = new WriteToExcel(model); GlobalConfig.Connection.UpdateExam_ById(model); int t = myCoursesList.SelectedIndex; myCoursesList.SelectedItem = null; myCoursesList.SelectedIndex = t; }
public static List <string> getRouteCustomerReference(string fileName, string path) { var routeCustomerRef = new List <string>(); var openFile = new WriteToExcel(); openFile.Open(fileName, path, "Sheet1"); var importCellsRef = openFile.WorkSheet.Cells["B2:B"]; foreach (var Cell in importCellsRef) { if (Cell.GetValue <string>() != "" && Cell.GetValue <string>() != null) { routeCustomerRef.Add(Cell.GetValue <string>()); } } return(routeCustomerRef); }
public static List <string> getCompareId() { var CompareId = new List <string>(); var openFile = new WriteToExcel(); openFile.Open("Nandos contact list 25.10.2018", $"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}/Temp", "owssvr (1)"); var importCellsRef = openFile.WorkSheet.Cells["A2:A"]; foreach (var Cell in importCellsRef) { if (Cell.GetValue <string>() != "") { CompareId.Add(Cell.GetValue <string>()); } } return(CompareId); }
public ActionResult Edit(int id, IFormCollection collection) { try { // TODO: Add update logic here WriteToExcel.WriteData(collection); if (ModelState.IsValid) { // TODO: Add update logic here return(RedirectToAction(nameof(Index))); } else { return(View()); } } catch (Exception ex) { return(View()); } }
public void Test_C_0_FetchPackagePrices() { // TESTparameters: Test_H_FetchPackagePrices string role = "Test Package Pricer"; string mainGroup = "00 - General"; string subGroup = "00 - Vehicle, complete"; string vehicleType = "All Scania Vehicles"; string variantDescription = "VariantDescription"; string reasonForPackage = "ReasonForPackage"; string packageName = "PackageToManage"; string packageDescription = "PackageDescription"; string workorderText = "WorkorderText"; string invoiceText = "InvoiceText"; string parts = "1110055"; string labour = "01015111"; string sundry = "18"; string approval = "GLOBAL\\testfprpricer (FPRPRICER IWNP)"; string packageStatus = "SENT FOR REVIEW"; // --------------------------------------------------------- LoginPage.LoginAs(role); verifyPageTitle(HomePage.mainPageTitle, driver); // Navigate Packages -> Create HomePage.menuPackages.Click(); // Wait for page to load WaitForAjax(driver, 10, true); // Click on menu "Create" HomePage.menuCreate.Click(); //Click on button Next WaitForElement(SearchPage.buttonNext); SearchPage.buttonNext.Click(); // Fill out description form WaitForElement(DescriptionPage.listMainGroup); DescriptionPage.ToFillOutDescription(mainGroup, subGroup, vehicleType, variantDescription, reasonForPackage, packageName, packageDescription, workorderText, invoiceText); // Click button Next DescriptionPage.buttonNext.Click(); // Fill out content form WaitForElements(ContentPage.allDropDownLists); ContentPage.ChoosePartLabourAndSundry(parts, labour, sundry); WaitForElement(ContentPage.checkbox_MAIN_PART); ContentPage.checkbox_MAIN_PART.Click(); // Click button Next DescriptionPage.buttonNext.Click(); Thread.Sleep(3000); PreviewPage.buttonApprove.Click(); Thread.Sleep(3000); PreviewPage.buttonApproveOnConfirmationDialog.Click(); Thread.Sleep(3000); PreviewPage.buttonNext.Click(); Thread.Sleep(3000); // Find and click on the market PricingPage.ToFindMarket("Sweden"); Thread.Sleep(3000); PricingPage.buttonPriceForGroup(); Thread.Sleep(3000); WaitForElements(PricingPage.listWithDiscountButtons); PricingPage.buttonOpenListWithParts.Click(); Thread.Sleep(3000); // Set discount PricingPage.ToSetDiscountPercentage(5.ToString()); WaitForAjax(driver, 2, true); // Fetch all fields double QTY = Convert.ToDouble(PricingPage.fieldQuantity.Text); double CostPrice = PricingPage.ToDouble(PricingPage.fieldCost); double RetailPrice = PricingPage.ToDouble(PricingPage.fieldRetailPrice); // + discountPercentage double SalesNetPrice = PricingPage.ToDouble(PricingPage.fieldSalesNetPrice); double TotalCost = PricingPage.ToDouble(PricingPage.fieldTotalCost); double TotalGross = PricingPage.ToDouble(PricingPage.fieldTotalGross); double TotalNet = PricingPage.ToDouble(PricingPage.fieldTotalNet); double GrossProfitAmount = PricingPage.ToDouble(PricingPage.fieldGrossProfitAmount); double GrossProfitPercentage = PricingPage.ToDouble(PricingPage.fieldGrossProfitPercentage); // Write to excel file WriteToExcel = new WriteToExcel(); double[] data = new double[10] { QTY, CostPrice, RetailPrice, 5, SalesNetPrice, TotalCost, TotalGross, TotalNet, GrossProfitAmount, GrossProfitPercentage }; WriteToExcel.WriteToRange("CalculationData", data, "A2", "J2"); }