コード例 #1
0
 private void LoadData()
 {
     try
     {
         db = new tradeEntities(DbModel.Tools.TradeConnectionString(Properties.Settings.Default.barcodeCS.ToString()));
         appReportsBindingSource.DataSource = db.AppReports.Select(x => new { x.ID, x.AddTime, x.UserName, x.Message, hasFile = x.FileName == null || x.FileName == string.Empty ? false : true, x.ClosedTime }).OrderByDescending(x => x.ClosedTime).ThenByDescending(x => x.AddTime).Take(500).ToList();
     }
     catch (Exception ex)
     {
         Debug.Print(ex.ToString());
     }
 }
コード例 #2
0
 public static bool SaveDb(ref DbModel.tradeEntities db)
 {
     try
     {
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         showDbSaveExceptions(ex);
         return(false);
     }
 }
コード例 #3
0
ファイル: FrmPosEdit.cs プロジェクト: daleksShared/ZovMarket
        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();
                }
            }
        }
コード例 #4
0
ファイル: FrmDealers.cs プロジェクト: daleksShared/ZovMarket
        private void FormMain_Load(object sender, EventArgs e)
        {
            db = new tradeEntities(DbModel.Tools.TradeConnectionString(Properties.Settings.Default.barcodeCS.ToString()));
            //              ID StatusName
            //              1   Новый
            //              2   На рассмотрении
            //              3   OK
            //              4   Закрыт
            //try
            //{

            //var sp1 = db.StatusOfPos.Where(x=>x.ID==1).FirstOrDefault();
            //sp1.StatusColorInt = Color.LightGray.ToArgb();
            //sp1.StatusColor = Color.LightGray.Name;
            //var sp2 = db.StatusOfPos.Where(x => x.ID == 2).FirstOrDefault();
            //sp2.StatusColorInt = Color.Yellow.ToArgb();
            //sp2.StatusColor = Color.Yellow.Name;
            //var sp3 = db.StatusOfPos.Where(x => x.ID == 3).FirstOrDefault();
            //sp3.StatusColorInt = Color.LightGreen.ToArgb();
            //sp3.StatusColor = Color.LightGreen.Name;
            //var sp4 = db.StatusOfPos.Where(x => x.ID == 4).FirstOrDefault();
            //sp4.StatusColorInt = Color.OrangeRed.ToArgb();
            //sp4.StatusColor = Color.OrangeRed.Name;
            //db.SaveChanges();
            //}
            //catch (Exception ex)
            //{

            //    throw;
            //}
            splashScreenManager1.ShowWaitForm();

            db.StatusOfPos.Load();
            GetDealersTree();
            splashScreenManager1.CloseWaitForm();
        }