示例#1
0
 private void btnDelRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
     {
         return;
     }
     try
     {
         using (UnitOfWork unitOfWork = new UnitOfWork())
         {
             if (ActionGrid.GetFocusedRow() is DocActions item)
             {
                 unitOfWork.DocActionsRepo.Delete(m => m.Id == item.Id);
                 unitOfWork.Save();
             }
             ActionBindingSource.DataSource = unitOfWork.DocActionsRepo.Get(m => m.RefId == WOId && m.TableName == "WorkOrders");
             ActionGrid.RefreshData();
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#2
0
 public void LoadActions()
 {
     ActionBindingSource.DataSource = new UnitOfWork().DocActionsRepo.Get(m => m.RefId == WOId && m.TableName == "WorkOrders");
     ActionGrid.RefreshData();
 }