private void btnEditRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (ActionGrid.GetFocusedRow() is DocActions item) { frmDocActions frm = new frmDocActions(item, "", item.RefId) { MethodType = MethodType.Edit }; frm.ShowDialog(); } }
private void btnEditRepo_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (ActionGrid.GetFocusedRow() is DocActions item) { frmDocActions frm = new frmDocActions(tableName: "WorkOrders", refId: WOId, label: WorkOrders?.Employees?.EmployeeName + " - " + WorkOrders?.PPEs?.EquipmentTypes?.EquipmentType) { DocActions = item, MethodType = MethodType.Edit, }; frm.ShowDialog(); } }
private void btnDelRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (ActionGrid.GetFocusedRow() is DocActions item) { if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } try { UnitOfWork unitOfWork = new UnitOfWork(); unitOfWork.DocActionsRepo.Delete(x => x.Id == item.Id); unitOfWork.Save(); Details(unitOfWork.WorkOrdersRepo.Find(x => x.Id == item.RefId)); } catch (Exception exception) { MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
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(); } this.ActionGridControl.DataSource = unitOfWork.DocActionsRepo.Get(m => m.RefId == id && m.TableName == tableName); } } catch (Exception exception) { MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }