Пример #1
0
        /// <summary>
        /// 保存页面信息
        /// </summary>
        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"), Utility.GetResourceStr("STRINGNOTNULL", "KPITYPENAME"));
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
            else if (CheckKPIInfo())
            {
                //KPI类别
                KPIType.KPITYPENAME   = txtKPITypeName.Text.Trim();
                KPIType.KPITYPEREMARK = txtKPITYPEDESC.Text.Trim();
                #region 评分标准
                try
                {
                    //系统评分标准
                    KPIType.T_HR_SCORETYPE.INITIALPOINT = System.Convert.ToDecimal(txtInitailDate.Value);   //计分原点
                    KPIType.T_HR_SCORETYPE.INITIALSCORE = System.Convert.ToDecimal(txtInitailScore.Value);  //初始分
                    KPIType.T_HR_SCORETYPE.COUNTUNIT    = System.Convert.ToDecimal(txtScoreUnit.Value);     //单位天数
                    // 1s 冉龙军
                    KPIType.T_HR_SCORETYPE.LATERUNIT = System.Convert.ToDecimal(txtLaterUnit.Value);        //延迟小时数
                    // 1e
                    KPIType.T_HR_SCORETYPE.ADDSCORE    = System.Convert.ToDecimal(txtAddForForward.Value);  //加分
                    KPIType.T_HR_SCORETYPE.REDUCESCORE = System.Convert.ToDecimal(txtReduceForDelay.Value); //减分
                    KPIType.T_HR_SCORETYPE.MAXSCORE    = System.Convert.ToDecimal(txtMaxScore.Value);       //上限
                    KPIType.T_HR_SCORETYPE.MINSCORE    = System.Convert.ToDecimal(txtMinScore.Value);       //下限
                }
                catch
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), validators.Count.ToString() + " string Convert int error.");
                }
                #endregion
                #region 评分方式
                //评分方式
                if (chkIsMachine.IsChecked.Value)
                {
                    try
                    {
                        //需要进行数据验证
                        //系统评分
                        KPIType.T_HR_SCORETYPE.ISSYSTEMSCORE = "1";
                        KPIType.T_HR_SCORETYPE.SYSTEMWEIGHT  = System.Convert.ToDecimal(txtMachineWeight.Value);
                    }
                    catch
                    {
                        Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), validators.Count.ToString() + " string Convert int error.");
                    }
                }
                else
                {
                    KPIType.T_HR_SCORETYPE.ISSYSTEMSCORE = "0";
                }

                if (chkIsPerson.IsChecked.Value)
                {
                    //手动评分
                    KPIType.T_HR_SCORETYPE.ISMANUALSCORE = "1";
                    KPIType.T_HR_SCORETYPE.MANUALWEIGHT  = System.Convert.ToDecimal(txtPersonWeight.Value);
                }
                else
                {
                    KPIType.T_HR_SCORETYPE.ISMANUALSCORE = "0";
                }

                if (chkIsRandom.IsChecked.Value)
                {
                    //抽查评分
                    KPIType.T_HR_SCORETYPE.ISRANDOMSCORE = "1";
                    KPIType.T_HR_SCORETYPE.RANDOMWEIGHT  = System.Convert.ToDecimal(txtRandomWeight.Value);
                    //抽查组信息
                    KPIType.T_HR_SCORETYPE.T_HR_RANDOMGROUP = new T_HR_RANDOMGROUP();
                    KPIType.T_HR_SCORETYPE.T_HR_RANDOMGROUP.RANDOMGROUPID = (cboRandomGroup.SelectedItem as T_HR_RANDOMGROUP).RANDOMGROUPID;
                }
                else
                {
                    KPIType.T_HR_SCORETYPE.ISRANDOMSCORE    = "0";
                    KPIType.T_HR_SCORETYPE.T_HR_RANDOMGROUP = null;
                }

                #endregion 评分方式

                //提醒信息

                KPIType.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                KPIType.UPDATEDATE   = DateTime.Now;
                string strMsg = string.Empty;
                if (FormType == FormTypes.Edit)
                {
                    client.UpdateKPITypeAndRemindAsync(KPIType, GetRemindList("add"), GetRemindList("update"), GetRemindList("del"), strMsg);
                }
                else if (FormType == FormTypes.New)
                {
                    //所属
                    KPIType.CREATECOMPANYID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    KPIType.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    KPIType.CREATEPOSTID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    KPIType.OWNERCOMPANYID     = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    KPIType.OWNERDEPARTMENTID  = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    KPIType.OWNERPOSTID        = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    KPIType.OWNERID            = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                    KPIType.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    KPIType.CREATEDATE   = DateTime.Now;
                    KPIType.T_HR_SCORETYPE.T_HR_KPIREMIND = GetRemindList("add");
                    client.AddKPITypeAsync(KPIType, strMsg);
                }
                //this.DialogResult = true;
            }
        }