예제 #1
0
        public void UploadDatabaseRecords(DataTable convertedTable)
        {
            //Delete all old records for that supplier/admin
            SupplierFuelsPricesTableAdapter adapter = new SupplierFuelsPricesTableAdapter();

            adapter.Connection = new SqlConnection(ExecutionHelper.GetConnectionString());
            adapter.DeleteAll(_AdminClientId, _SupplierId);

            //Bulk insert the new records
            using (SqlBulkCopy s = new SqlBulkCopy(ExecutionHelper.GetConnectionString()))
            {
                s.DestinationTableName = "SupplierFuelsPrices";
                s.BatchSize            = 5000;

                s.ColumnMappings.Add("Vendor", "Vendor");
                s.ColumnMappings.Add("IATA", "IATA");
                s.ColumnMappings.Add("ICAO", "ICAO");
                s.ColumnMappings.Add("FBOName", "FBOName");
                s.ColumnMappings.Add("Min", "Min");
                s.ColumnMappings.Add("Max", "Max");
                s.ColumnMappings.Add("TotalWithTax", "TotalWithTax");
                s.ColumnMappings.Add("Expires", "Expires");
                s.ColumnMappings.Add("Product", "Product");
                s.ColumnMappings.Add("Notes", "Notes");
                s.ColumnMappings.Add("AdminClientId", "AdminClientID");
                s.ColumnMappings.Add("SupplierId", "SupplierID");
                s.ColumnMappings.Add("EffectiveDate", "EffectiveDate");
                s.ColumnMappings.Add("VendorEmail", "VendorEmail");

                s.WriteToServer(convertedTable);
                s.Close();
            }

            adapter.UpdateSupplierFuelsPricesMax(_AdminClientId, _SupplierId);
        }
예제 #2
0
        private VFMClasses.DataSets.SupplierFuelPricesDataSet.SupplierFuelsPricesDataTable GetSupplierFuelsPricesDataTable(int adminId)
        {
            SupplierFuelsPricesTableAdapter adapter = new SupplierFuelsPricesTableAdapter();

            adapter.Connection = new SqlConnection(Degatech.Utilities.SQL.ConnectionHelper.GetConnectionString("SQLFLString"));
            VFMClasses.DataSets.SupplierFuelPricesDataSet.SupplierFuelsPricesDataTable table = adapter.GetData(adminId);
            return(table);
        }