예제 #1
0
        private void Save()
        {
            List <SMT.SaaS.FrameworkUI.Validator.ValidatorBase> validators = Group1.ValidateAll();

            RefreshUI(RefreshedTypes.ProgressBar);
            if (validators.Count > 0)
            {
                RefreshUI(RefreshedTypes.ProgressBar);
                // MessageBox.Show(validators.Count.ToString() + " invalid validators");
            }
            else if (txtSalaryName.Text.Trim() == string.Empty)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "CUSTOMSALARYNAME"));
                RefreshUI(RefreshedTypes.ProgressBar);
                return;
            }
            else if (txtMoney.Text.Trim() == string.Empty)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "GUERDONSUM"));
                RefreshUI(RefreshedTypes.ProgressBar);
                return;
            }
            //else if (combproperty == null || combproperty.SelectedIndex < 1)
            //{
            //    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "GUERDONCATEGORY"));
            //    RefreshUI(RefreshedTypes.ProgressBar);
            //    return;
            //}
            else if (combcal == null || combcal.SelectedIndex < 0)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("PLEASESELECT", "CALCULATETYPE"));
                RefreshUI(RefreshedTypes.ProgressBar);
                return;
            }
            else
            {
                if (FormType == FormTypes.Edit || FormType == FormTypes.Resubmit)
                {
                    CustomGuerdonSet.GUERDONCATEGORY = combproperty.SelectedIndex.ToString();
                    CustomGuerdonSet.CALCULATORTYPE  = (combcal.SelectedIndex + 1).ToString();
                    CustomGuerdonSet.UPDATEDATE      = System.DateTime.Now;
                    client.CustomGuerdonSetUpdateAsync(CustomGuerdonSet, CustomGuerdonSetPost);
                }
                else
                {
                    if (Onlyone)
                    {
                        RefreshUI(RefreshedTypes.ProgressBar);
                        Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ALREADYEXISTS"));
                        //txtSalaryName.BorderBrush = new SolidColorBrush(Colors.Red);
                    }
                    else
                    {
                        //txtSalaryName.BorderBrush = new SolidColorBrush(Colors.White);
                        //CustomGuerdonSet.GUERDONCATEGORY = combproperty.SelectedIndex.ToString();
                        CustomGuerdonSet.CALCULATORTYPE     = (combcal.SelectedIndex + 1).ToString();
                        CustomGuerdonSet.CHECKSTATE         = "0";
                        CustomGuerdonSet.CREATEDATE         = System.DateTime.Now;
                        CustomGuerdonSet.GUERDONCATEGORY    = (CustomGuerdonSet.GUERDONCATEGORY == null) ? "1" : CustomGuerdonSet.GUERDONCATEGORY;
                        CustomGuerdonSet.OWNERCOMPANYID     = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        CustomGuerdonSet.OWNERDEPARTMENTID  = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        CustomGuerdonSet.OWNERID            = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        CustomGuerdonSet.OWNERPOSTID        = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                        CustomGuerdonSet.CREATEUSERID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        CustomGuerdonSet.CREATECOMPANYID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        CustomGuerdonSet.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        CustomGuerdonSet.CREATEPOSTID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;

                        client.CustomGuerdonSetAddAsync(CustomGuerdonSet, CustomGuerdonSetPost);
                    }
                }
            }
        }