private void PerformMove(EditFormActionType moveType) { BeforeMove?.Invoke(bs.Current, new MoveEventArgs(moveType)); bbiDelete.Enabled = true; switch (moveType) { case EditFormActionType.Next: bs.DataSource = MasterData.Next(bs.Current); break; case EditFormActionType.Previous: bs.DataSource = MasterData.Previous(bs.Current); break; case EditFormActionType.First: bs.DataSource = MasterData.First(bs.Current); break; case EditFormActionType.Last: bs.DataSource = MasterData.Last(bs.Current); break; case EditFormActionType.New: bs.DataSource = MasterData.New(bs.Current); bbiSave.Enabled = bbiSaveAndClose.Enabled = bbiSaveAndNew.Enabled = true; bbiNext.Enabled = bbiLast.Enabled = bbiPrev.Enabled = bbiFirst.Enabled = false; bbiReset.Enabled = true; bbiAddNew.Enabled = false; bbiEdit.Enabled = false; bbiDelete.Enabled = false; ChangeControlsReadOnly(false); key.Enabled = true; break; } AfterMove?.Invoke(bs.Current, new MoveEventArgs(moveType)); }
public virtual T FindByMove(EditFormActionType actionType) { switch (actionType) { case EditFormActionType.First: return(First()); case EditFormActionType.Last: return(Last()); case EditFormActionType.Next: return(Next()); case EditFormActionType.Previous: return(Previous()); case EditFormActionType.Edit: return(Find()); case EditFormActionType.New: var o = new T(); if (GetKeys.Contains("CompanyCode") && !(Current is tbl_Company)) { o.SetValue("CompanyCode", Current.GetValue("CompanyCode")); } if (GetKeys.Contains("BranchCode") && !(Current is tbl_Branch)) { o.SetValue("BranchCode", Current.GetValue("BranchCode")); } return(o); } return(new T()); }
private T ActionMove(object sender, EditFormActionType actionType) { T row = sender as T; using (var useData = new UseData <T>(User, FormName, MasterKey, row)) { return(useData.FindByMove(actionType)); } }
private bool PerformSave(EditFormActionType actionType) { if (Save == null) { return(true); } ActionEventArgs args = new ActionEventArgs(actionType); Save.Invoke(args); if (args.Cancel) { args.Message.ForEach(msg => { MessageBox.Show(msg); }); } else { bbiSave.Enabled = bbiSaveAndClose.Enabled = bbiSaveAndNew.Enabled = false; MessageBox.Show("تم الحفظ"); } return(args.Cancel); }
public MoveEventArgs(EditFormActionType actionType) { MoveType = actionType; }
public ActionEventArgs(EditFormActionType actionType) { ActionType = actionType; }