예제 #1
0
 private void btnEditOffice_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (OfficesGridView.GetFocusedRow() is Offices item)
     {
         frmAddEditOffice frm = new frmAddEditOffice(item, MethodType.Edit);
         frm.ShowDialog();
         Init();
     }
 }
예제 #2
0
 private void BtnDeleteUserRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (OfficesGridView.GetFocusedRow() is Offices item)
     {
         try
         {
             if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
             {
                 return;
             }
             UnitOfWork unitOfWork = new UnitOfWork();
             unitOfWork.OfficesRepo.Delete(m => m.Id == item.Id);
             unitOfWork.Save();
             Init();
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }