Esempio n. 1
0
        private void Save()
        {
            //处理页面验证
            List <SMT.SaaS.FrameworkUI.Validator.ValidatorBase> validators = Group1.ValidateAll();

            RefreshUI(RefreshedTypes.ShowProgressBar);
            if (validators.Count > 0)
            {
                //could use the content of the list to show an invalid message summary somehow
                // Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), validators.Count.ToString() + " invalid validators");
                //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "RANDOMGROUPNAME"));
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("STRINGNOTNULL", "RANDOMGROUPNAME"),
                                               Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
            else
            {
                //抽查组
                RandomGroup.RANDOMGROUPNAME = txtRandomGroupName.Text.Trim();
                RandomGroup.GROUPREMARK     = txtRandomGroupDesc.Text.Trim();
                RandomGroup.UPDATEUSERID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                RandomGroup.UPDATEDATE      = DateTime.Now;
                string strMsg = string.Empty;
                if (FormType == FormTypes.Edit)
                {
                    client.UpdateRandomGroupAsync(RandomGroup, strMsg);
                }
                else if (FormType == FormTypes.New)
                {
                    //所属
                    RandomGroup.CREATECOMPANYID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    RandomGroup.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    RandomGroup.CREATEPOSTID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    RandomGroup.OWNERCOMPANYID     = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    RandomGroup.OWNERDEPARTMENTID  = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    RandomGroup.OWNERPOSTID        = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    RandomGroup.OWNERID            = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                    RandomGroup.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    RandomGroup.CREATEDATE   = DateTime.Now;
                    client.AddRandomGroupAsync(RandomGroup, strMsg);
                }
            }
        }