private static DataTable LoadTotalCustomers() { DataTable tempCustomers = new DataTable(); tempCustomers.Columns.Add("Number", typeof(string)); tempCustomers.Columns.Add("Address", typeof(Address)); tempCustomers.Columns.Add("Count", typeof(int)); int[] columnsString = new int[2] { 0, 1 }; int[] columnNumber = new int[1] { 2 }; string[,] output = ExcelReader_NPOI.ReadAllXLSX("Customers.xlsx", columnsString, columnNumber, false); for (int i = 0; i < output.GetLength(0); i++) { if (output[i, 0] != null) { string houseNumber = output[i, 0].ToString(); float totalBought = float.Parse(output[i, 2]); Address address = null; for (int j = 0; j < totalAddresses.Count; j++) { if (totalAddresses[j].Road == output[i, 1]) { address = totalAddresses[j]; break; } } tempCustomers.Rows.Add(houseNumber, address, totalBought); } } return(tempCustomers); }
public static void _LoadForeignAddresses() { int[] columns = new int[3] { 0, 1, 2, }; int[] latLong = new int[2] { 3, 4 }; string[,] output = ExcelReader_NPOI.ReadAllXLSX("ForeignAddressList.xlsx", columns, latLong, false); for (int i = 1; i < output.GetLength(0); i++) { Address address = new Address(output[i, 0], output[i, 1], output[i, 2], double.Parse(output[i, 3]), double.Parse(output[i, 4])); totalAddresses.Add(address); } }
private static List <Address> LoadAddressesFrom(string source, bool local) { List <Address> addresses = new List <Address>(); int[] columns = new int[3] { 0, 1, 2, }; int[] latLong = new int[2] { 3, 4 }; string[,] output = ExcelReader_NPOI.ReadAllXLSX(source, columns, latLong, local); for (int i = 1; i < output.GetLength(0); i++) { Address address = new Address(output[i, 0], output[i, 1], output[i, 2], double.Parse(output[i, 3]), double.Parse(output[i, 4])); addresses.Add(address); } return(addresses); }
public static DataTable LoadOrderLog() { DataTable tempCustomers = new DataTable(); tempCustomers.Columns.Add("Number", typeof(string)); tempCustomers.Columns.Add("Address", typeof(Address)); tempCustomers.Columns.Add("PhoneNumber", typeof(int)); tempCustomers.Columns.Add("Date", typeof(string)); int[] columnsString = new int[] { 0, 1, 2 }; int[] columnNumber = new int[] { 3 }; string[,] output = ExcelReader_NPOI.ReadAllXLSX("OrderLog.xlsx", columnsString, columnNumber, false); for (int i = 0; i < output.GetLength(0); i++) { if (output[i, 0] != null) { string houseNumber = output[i, 0].ToString(); int phoneNumber; string phoneNumberString = output[i, 2]; bool phoneNumberWork = int.TryParse(phoneNumberString, out phoneNumber); string date = output[i, 3].ToString(); Address address = null; for (int j = 0; j < totalAddresses.Count; j++) { if (totalAddresses[j].Road == output[i, 1]) { address = totalAddresses[j]; break; } } tempCustomers.Rows.Add(houseNumber, address, phoneNumber, date); } } /*DataView dv = tempCustomers.DefaultView; * dv.Sort = "occr desc"; * tempCustomers = dv.ToTable();*/ return(tempCustomers); }