Esempio n. 1
0
 private void OnActionEnd(object sender, ABCStandardEventArg arg)
 {
     if (ActionEndEvent != null)
     {
         ActionEndEvent(sender, arg);
     }
 }
Esempio n. 2
0
 public virtual void OnAddComment(CommentObject comment, ABCStandardEventArg e)
 {
     if (this.AddCommentEvent != null)
     {
         this.AddCommentEvent(comment, e);
     }
 }
Esempio n. 3
0
        public void AddComment(String strComment)
        {
            if (String.IsNullOrWhiteSpace(strComment))
            {
                return;
            }
            ABCStandardEventArg arg = new ABCStandardEventArg();

            OnAddComment(new CommentObject(this.TableName, ObjectID, strComment, Tags, TagsDisplay), arg);
            if (arg.Cancel)
            {
                return;
            }
            AddComment(this.TableName, ObjectID, strComment);
        }
Esempio n. 4
0
        void GridControl_BarItemClick(object sender, string strTag)
        {
            ABCStandardEventArg arg = new ABCStandardEventArg(strTag);

            OnActionStart(sender, arg);
            if (arg.Cancel)
            {
                return;
            }

            switch (strTag)
            {
            case "Save":
                DialogResult dlgResult = ABCHelper.ABCMessageBox.Show("Bạn có muốn lưu dữ liệu ? ", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dlgResult == DialogResult.Yes)
                {
                    if (this.Binding != null)
                    {
                        this.Binding.Save(true, true);
                    }
                    else
                    {
                        ActionSave(true);
                    }
                }
                break;

            case "Refresh":
                ActionRefresh();
                break;

            case "Delete":
                ActionRemove();

                break;
            }

            OnActionEnd(sender, new ABCStandardEventArg(strTag));
        }
Esempio n. 5
0
        public void ActionSave(bool isShowWaitingDlg)
        {
            if (ChangedItems.Count > 0 && ABCScreenManager.Instance.CheckTablePermission(this.TableName, TablePermission.AllowEdit) == false)
            {
                return;
            }
            if (RemovedItems.Count > 0 && ABCScreenManager.Instance.CheckTablePermission(this.TableName, TablePermission.AllowDelete) == false)
            {
                return;
            }
            if (NewItems.Count > 0 && ABCScreenManager.Instance.CheckTablePermission(this.TableName, TablePermission.AllowNew) == false)
            {
                return;
            }

            if (isShowWaitingDlg)
            {
                ABCHelper.ABCWaitingDialog.Show("", "Đang lưu ....");
            }

            List <T> lstDeletings = new List <T>();
            List <T> lstUpdatings = new List <T>();
            List <T> lstCreatings = new List <T>();

            #region Init
            foreach (T objT in RemovedItems.Values)
            {
                lstDeletings.Add(objT);
            }

            foreach (Guid iID in ChangedItems)
            {
                BusinessObject objT = GetItemByID(iID);
                if (objT != null)
                {
                    BusinessObjectHelper.SetAutoValue(objT);
                    lstUpdatings.Add((T)objT);
                }
            }

            foreach (int iIndex in NewItems)
            {
                BusinessObjectHelper.SetDefaultValue(this[iIndex]);
                BusinessObjectHelper.SetAutoValue(this[iIndex]);
                Guid iID = BusinessObjectHelper.GetIDValue(this[iIndex]);
                if (iID == Guid.Empty)
                {
                    lstCreatings.Add(this[iIndex]);
                }
                else
                {
                    lstUpdatings.Add(this[iIndex]);
                }
            }

            #endregion

            ABCStandardEventArg arg = new ABCStandardEventArg();
            OnSaving(this, ref lstDeletings, ref lstUpdatings, ref lstCreatings, arg);
            if (arg.Cancel)
            {
                return;
            }

            foreach (T objT in lstDeletings)
            {
                DeleteItem(objT);
            }

            foreach (T objT in lstUpdatings)
            {
                Controller.UpdateObject(objT);
            }

            foreach (T objT in lstCreatings)
            {
                Controller.CreateObject(objT);
            }

            ClearDetections();

            DataCachingProvider.RefreshLookupTable(this.TableName);

            OnSaved(this, ref lstDeletings, ref lstUpdatings, ref lstCreatings, new ABCStandardEventArg());

            if (isShowWaitingDlg)
            {
                ABCHelper.ABCWaitingDialog.Close();
            }
        }
Esempio n. 6
0
 private void OnSaved(object sender, ref List <T> lstDeletings, ref List <T> lstUpdatings, ref List <T> lstCreatings, ABCStandardEventArg arg)
 {
     if (SavedEvent != null)
     {
         SavedEvent(sender, ref lstDeletings, ref lstUpdatings, ref lstCreatings, arg);
     }
 }
Esempio n. 7
0
 public void OnAddCommentEvent(ABCComment.CommentObject comment, ABCStandardEventArg e)
 {
 }