示例#1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public bool AddToClose()
        {
            // List<SMT.SaaS.FrameworkUI.Validator.ValidatorBase> validators = Group1.ValidateAll();
            string strMsg = "";

            RefreshUI(RefreshedTypes.ShowProgressBar);
            //if (validators.Count > 0)
            //{
            //    // Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), validators.Count.ToString() + " invalid validators");
            //    RefreshUI(RefreshedTypes.HideProgressBar);
            //    return false;
            //}
            if (!SMT.SaaS.FrameworkUI.Common.Utility.CheckDataIsValid(Group1))
            {
                RefreshUI(RefreshedTypes.HideProgressBar);
                needsubmit = false;
                return(false);
            }
            //if (cbxDepName.SelectedItem == null)
            //{
            //    //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "DEPARTMENTNAME"));
            //    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("STRINGNOTNULL", "DEPARTMENTNAME"),
            //      Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
            //    RefreshUI(RefreshedTypes.HideProgressBar);
            //    return false;
            //}
            //else
            //{
            //    T_HR_DEPARTMENTDICTIONARY ent = cbxDepName.SelectedItem as T_HR_DEPARTMENTDICTIONARY;
            //    PostDictionary.T_HR_DEPARTMENTDICTIONARY = new T_HR_DEPARTMENTDICTIONARY();
            //    postDictionary.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID = ent.DEPARTMENTDICTIONARYID;
            //}
            if (acbDepName.SelectedItem == null)
            {
                //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "DEPARTMENTNAME"));
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("STRINGNOTNULL", "DEPARTMENTNAME"),
                                               Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                RefreshUI(RefreshedTypes.HideProgressBar);
                return(false);
            }
            else
            {
                T_HR_DEPARTMENTDICTIONARY ent = acbDepName.SelectedItem as T_HR_DEPARTMENTDICTIONARY;
                PostDictionary.T_HR_DEPARTMENTDICTIONARY = new T_HR_DEPARTMENTDICTIONARY();
                postDictionary.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID = ent.DEPARTMENTDICTIONARYID;
            }


            if (FormTypes.New == this.FormType)
            {
                PostDictionary.CREATEDATE = System.DateTime.Now;
                ///TODO增加操作人
                PostDictionary.CREATEUSERID      = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                PostDictionary.OWNERCOMPANYID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                PostDictionary.OWNERDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                PostDictionary.OWNERPOSTID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                PostDictionary.OWNERID           = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                PostDictionary.EDITSTATE         = Convert.ToInt32(EditStates.UnActived).ToString();
                client.PostDictionaryAddAsync(PostDictionary, strMsg);
            }
            else
            {
                PostDictionary.UPDATEDATE = System.DateTime.Now;
                ///TODO增加修改人
                PostDictionary.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                client.PostDictionaryUpdateAsync(PostDictionary, strMsg, "Edit");
            }

            return(true);
        }