private void button1_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { this.productsDataSet1.CleanDatabase(); using (System.IO.StreamReader rdr = new System.IO.StreamReader(openFileDialog1.FileName , Encoding.GetEncoding("windows-1251"))) { string s = string.Empty; while ((s = rdr.ReadLine()) != null) { AddString(s); } } using (ProductsDataSetTableAdapters.ProductsTblTableAdapter tAdapter = new TSDServer.ProductsDataSetTableAdapters.ProductsTblTableAdapter()) { tAdapter.Update(this.productsDataSet1); } this.productsDataSet1.AcceptChanges(); MessageBox.Show("Загрузка завершена", "Статус загрузки", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception err) { MessageBox.Show("Ошибка: "+err.Message, "Статус загрузки на сервер", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private ActionsClass() { int shift = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours; if (shift != 4) _timeShift = 11; FamilTsdDB.DataTable.BaseDate = Program.Default.BaseDate; FamilTsdDB.DataTable.StartupPath = Program.Default.DatabaseStoragePath; btPrint = BTPrintClass.PrintClass; dateFormat.ShortDatePattern = "dd.MM.yyyy"; dateFormat.FullDateTimePattern = "dd.MM.yyyy HH:mm:ss"; dateFormat.DateSeparator = "."; nfi.NumberDecimalSeparator = "."; nfi.NumberGroupSeparator = ""; actionsDict.Add(TSDUtils.ActionCode.NoAction, new ActOnProduct(NoActionProc)); actionsDict.Add(TSDUtils.ActionCode.Reprice, new ActOnProduct(RepriceActionProc)); actionsDict.Add(TSDUtils.ActionCode.Returns, new ActOnProduct(ReturnActionProc)); actionsDict.Add(TSDUtils.ActionCode.Remove, new ActOnProduct(RemoveActionProc)); actionsDict.Add(TSDUtils.ActionCode.QuickHelp, new ActOnProduct(RemoveActionProc)); actionsDict.Add(TSDUtils.ActionCode.InventoryGlobal, new ActOnProduct(InventoryGlobalActionProc)); actionsDict.Add(TSDUtils.ActionCode.SimpleIncome, new ActOnProduct(SimpleIncomeActionProc)); actionsDict.Add(TSDUtils.ActionCode.InventoryLocal, new ActOnProduct(InventoryLocalActionProc)); actionsDict.Add(TSDUtils.ActionCode.NotFound, new ActOnProduct(NotFoundActionProc)); actionsDict.Add(TSDUtils.ActionCode.DocNotFound, new ActOnProduct(DocNotFoundActionProc)); //actionsDict.Add(TSDUtils.ActionCode.BoxWProducts, new ActOnProduct(BoxWProductsActionProc)); /* tmr = new System.Threading.Timer( new System.Threading.TimerCallback(OnTimer) , null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); scannedTA = new TSDServer.ScannedProductsDataSetTableAdapters.ScannedBarcodesTableAdapter(_scannedProducts); */ productsTa = new ProductsDataSetTableAdapters.ProductsTblTableAdapter(this._products); docsTa = new ProductsDataSetTableAdapters.DocsTblTableAdapter(this._products); DatabaseFile = System.IO.Path.Combine( Program.Default.DatabaseStoragePath, "scannedbarcodes.txt"); onRowChanged = new System.Data.DataRowChangeEventHandler(ScannedBarcodes_RowChanged); onColChanged = new System.Data.DataColumnChangeEventHandler(ScannedBarcodes_ColumnChanged); }