void LoadSharpPaymentClick(object sender, EventArgs e) { openFileDialog.Filter = "Csv file format (*.csv)|*.csv"; if (openFileDialog.ShowDialog() == DialogResult.OK) { importStrategies = new PaymentImportCsv(openFileDialog.FileName, Payment.DOCOPER_CREDIT_ORDER); Import(); } DataTable customerTable = accountingDoc.GetCustomerTable(true); foreach (DataRow row in importStrategies.PaymentTable().Rows) { DataRow[] findedCustomer = customerTable.Select( String.Format("code='{0}'", row[PaymentImportCsv.CODE]) ); if (findedCustomer.Length == 0) { row[PaymentImport.IDCUSTOMER_COLUMN] = null; row[PaymentImport.CUSTOMERNAME_COLUMN] = "НЕ НАЙДЕН"; } else { row[PaymentImport.IDCUSTOMER_COLUMN] = findedCustomer[0][PaymentImport.IDCUSTOMER_COLUMN]; row[PaymentImport.CUSTOMERNAME_COLUMN] = findedCustomer[0][PaymentImport.CUSTOMERNAME_COLUMN]; } } }
void LoadNonCashPaymentClick(object sender, EventArgs e) { openFileDialog.Filter = "Client bank exchange file format (*.txt)|*.txt"; if (openFileDialog.ShowDialog() == DialogResult.OK) { DataRow seller = accountingDoc.GetSeller(Settings.Base.idseller); if (seller == null && seller["inn"] == DBNull.Value) { throw new ArgumentException("Не найден продавец! Укажите в настройках продавца по-умолчанию!"); } importStrategies = new ClientBankExchangeImport((string)seller["inn"], openFileDialog.FileName); Import(); DataTable customerTable = accountingDoc.GetCustomerTable(false); foreach (DataRow row in importStrategies.PaymentTable().Rows) { DataRow[] findedCustomer = customerTable.Select( String.Format("inn='{0}'", row[ClientBankExchangeImport.PAYMENT_PAYER_INN]) ); row[PaymentImport.IDCUSTOMER_COLUMN] = (findedCustomer.Length == 0) ? null : findedCustomer[0][PaymentImport.IDCUSTOMER_COLUMN]; row[PaymentImport.CUSTOMERNAME_COLUMN] = (findedCustomer.Length == 0) ? "НЕ НАЙДЕН" : findedCustomer[0][PaymentImport.CUSTOMERNAME_COLUMN]; } } }
void ToolStripButton4Click(object sender, EventArgs e) { openFileDialog.Filter = "Csv file format (*.csv)|*.csv"; if (openFileDialog.ShowDialog() == DialogResult.OK) { importStrategies = new PaymentImportCsv(openFileDialog.FileName, Payment.DOCOPER_OPENING_BALANCE_CASH); Import(); } }