Exemple #1
0
        private void CheckOrderAction()
        {
            object value = this.OrderEntity.GetObjValue("Entity.CHECKSTATES");

            SMT.FB.UI.FBCommonWS.CheckStates checkState = (SMT.FB.UI.FBCommonWS.CheckStates)Convert.ToInt32(value);

            // 草稿状态
            bool isNotDraft = checkState != SMT.FB.UI.FBCommonWS.CheckStates.UnSubmit;
            bool isWritable = (this.OperationType == OperationTypes.Add || this.OperationType == OperationTypes.Edit);


            // 表单不是草稿状态,而且以添加或修改进入的,则与只读浏览的操作进行操作。
            if (isNotDraft && isWritable)
            {
                if (!this.orderEntity.IsReSubmit)
                {
                    this.OperationType = OperationTypes.Browse;
                }
            }

            //控制上传控件在审核时保持只读状态
            if (!isWritable || isNotDraft)
            {
                SMT.FB.UI.Common.Controls.FBUploadControl fbUpload = null;
                foreach (IControlAction item in this.Controls)
                {
                    if (item.GetType() == typeof(SMT.FB.UI.Common.Controls.FBUploadControl))
                    {
                        fbUpload = (SMT.FB.UI.Common.Controls.FBUploadControl)item;
                        break;
                    }
                }

                if (fbUpload != null)
                {
                    fbUpload.InitControl(OperationTypes.Browse);
                }
            }
        }
Exemple #2
0
        public List <ToolbarItem> GetToolBarItems()
        {
            if (!isDataOK)
            {
                return(new List <ToolbarItem>());
            }

            bool canSave             = true;
            bool canSubmit           = true;
            List <ToolbarItem> items = new List <ToolbarItem>();

            switch (this.EditForm.OperationType)
            {
            case OperationTypes.Browse:
                canSave   &= false;
                canSubmit &= false;
                break;

            case OperationTypes.Audit:
                canSave   &= false;
                canSubmit &= false;
                break;

            case OperationTypes.ReSubmit:
                canSave   = false;
                canSubmit = true;
                break;

            case OperationTypes.Add:
                canSubmit = false;
                canSave   = true;
                break;
            }
            if (!IsUnSubmit)
            {
                canSave   &= false;
                canSubmit &= false;
            }
            else if ((this.OrderEntity.OrderType == typeof(T_FB_DEPTBUDGETSUMMASTER) ||
                      this.OrderEntity.OrderType == typeof(T_FB_COMPANYBUDGETSUMMASTER)))
            {
                canSave &= false;
            }

            if (this.OrderEntity.IsReSubmit)
            {
                object states = this.OrderEntity.GetObjValue(EntityFieldName.CheckStates);
                SMT.FB.UI.FBCommonWS.CheckStates currentStates = CommonFunction.TryConvertValue <SMT.FB.UI.FBCommonWS.CheckStates>(states);
                if (currentStates == FBCommonWS.CheckStates.UnApproved)
                {
                    canSubmit = true;
                }

                if ((currentStates == FBCommonWS.CheckStates.Approved) &&
                    (this.OrderEntity.OrderType == typeof(T_FB_DEPTBUDGETAPPLYMASTER) ||
                     this.OrderEntity.OrderType == typeof(T_FB_COMPANYBUDGETAPPLYMASTER)))
                {
                    var isValid = Convert.ToString(this.OrderEntity.Entity.GetObjValue("ISVALID"));
                    if (isValid == "2")
                    {
                        canSubmit = true;
                    }
                }
            }

            if (canSave)
            {
                // items.Add(ToolBarItems.SaveAndClose);
                items.Add(ToolBarItems.Save);
                if (this.EditForm.OperationType != OperationTypes.Add)
                {
                    ToolbarItem item = new ToolbarItem
                    {
                        DisplayType = ToolbarItemDisplayTypes.Image,
                        Key         = "Delete",
                        Title       = "删除单据",
                        ImageUrl    = "/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/ico_16_delete.png"
                    };

                    items.Add(item);
                }
            }

            //预算汇总设置不需要提交
            if (this.OrderEntity.OrderType == typeof(T_FB_SUMSETTINGSMASTER))
            {
                canSubmit = false;
            }

            if (canSubmit)
            {
                items.Add(ToolBarItems.Submit);
            }

            return(items);
        }