Beispiel #1
0
 private bool saveData()
 {
     if (db.PosRanks.Local.First().Pos_ID == null)
     {
         MessageBox.Show("Не все поля определены!!!!");
         return(false);
     }
     try
     {
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         Tools.showDbSaveExceptions(ex);
         return(false);
     }
     return(true);
 }
Beispiel #2
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     if (gridView1.RowCount > 0 && gridView1.IsValidRowHandle(gridView1.FocusedRowHandle) && !gridView1.IsNewItemRow(gridView1.FocusedRowHandle))
     {
         int rowHandle = gridView1.FocusedRowHandle;
         int apprId    = (int)gridView1.GetRowCellValue(rowHandle, "ID");
         var rep       = db.AppReports.Find(apprId);
         if (rep != null)
         {
             if (rep.CloseAction == null || !(bool)rep.CloseAction)
             {
                 rep.CloseAction = true;
                 db.SaveChanges();
                 db.Dispose();
                 LoadData();
             }
         }
     }
 }
Beispiel #3
0
        private void simpleButton9_Click(object sender, EventArgs e)
        {
            var frmSelectDealer = new Forms.FrmDealerChoose();

            if (frmSelectDealer.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    var dbNew      = new tradeEntities(DbModel.Tools.TradeConnectionString(Properties.Settings.Default.barcodeCS.ToString()));
                    var pos2change = dbNew.Pos.Where(x => x.ID == posId).FirstOrDefault();
                    pos2change.dealer_ID = frmSelectDealer.DealerId;
                    dbNew.SaveChanges();
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                    this.Close();
                }
            }
        }