コード例 #1
0
        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));
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public MoveEventArgs(EditFormActionType actionType)
 {
     MoveType = actionType;
 }
コード例 #6
0
 public ActionEventArgs(EditFormActionType actionType)
 {
     ActionType = actionType;
 }