Esempio n. 1
0
 private async void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     using (CapNhat.AddaiLy frm = new CapNhat.AddaiLy(new tbl_DaiLi()))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 tblDaiLiBindingSource.Add(frm.VDInfor);
                 ds.tbl_DaiLi.Add(frm.VDInfor);
                 await ds.SaveChangesAsync();
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show(ex.Message, "Message");
             }
         }
     }
 }
Esempio n. 2
0
        private async void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tbl_DaiLi obj = tblDaiLiBindingSource.Current as tbl_DaiLi;

            if (obj != null)
            {
                using (CapNhat.AddaiLy frm = new CapNhat.AddaiLy(obj))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            tblDaiLiBindingSource.EndEdit();
                            await ds.SaveChangesAsync();
                        }
                        catch (Exception ex)
                        {
                            XtraMessageBox.Show(ex.Message, "Lỗi Dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }