示例#1
0
        /// <summary>
        /// 保存KPI明细记录信息(接口专用)
        /// </summary>
        /// <param name="kpirecord"></param>
        /// <param name="AppraiseeID"></param>
        /// <param name="AppraiserID"></param>
        /// <param name="score"></param>
        /// <param name="scoretype"></param>
        /// <returns></returns>
        public T_HR_KPIRECORD SaveKPIRecordInterface(T_HR_KPIRECORD kpirecord, string AppraiseeID, string AppraiserID, int score, int scoretype)
        {
            try
            {
                bool isAdd = false; //判断是否为添加的标示。

                T_HR_KPIRECORD record = GetKPIRecordInterface(kpirecord.BUSINESSCODE);
                if (record == null)
                {
                    isAdd  = true;
                    record = InitialKPIRecordInterface(kpirecord);
                }
                //获取权限字段
                EmployeeBLL   bllEmployee = new EmployeeBLL();
                T_HR_EMPLOYEE ep          = bllEmployee.GetEmployeeByID(AppraiseeID);
                if (ep != null)
                {
                    record.OWNERID           = ep.OWNERID;
                    record.OWNERPOSTID       = ep.OWNERPOSTID;
                    record.OWNERDEPARTMENTID = ep.OWNERDEPARTMENTID;
                    record.OWNERCOMPANYID    = ep.OWNERCOMPANYID;
                }
                switch (scoretype)
                {
                //系统评分
                case 0:
                    record.SYSTEMSCORE  = score;
                    record.APPRAISEEID  = AppraiseeID;
                    record.UPDATEUSERID = AppraiseeID;
                    break;

                //手动评分
                case 1:
                    record.MANUALSCORE  = score;
                    record.APPRAISEEID  = AppraiseeID;
                    record.APPRAISERID  = AppraiserID;
                    record.UPDATEUSERID = AppraiserID;
                    break;

                //抽查评分
                case 2:
                    record.RANDOMSCORE    = score;
                    record.APPRAISEEID    = AppraiseeID;
                    record.RANDOMPERSONID = AppraiserID;
                    record.UPDATEUSERID   = AppraiserID;
                    break;
                }


                if (record.SYSTEMSCORE != null && //不需要机打,或者已经打过
                    record.MANUALSCORE != null && //不需要人打,或者已经打过
                    record.RANDOMSCORE != null)    //不需要抽查,或者已经打过
                {
                    record.SUMSCORE = CulcalateScore(record);
                }

                using (KPIRecordBll bll = new KPIRecordBll())
                {
                    record.UPDATEDATE = System.DateTime.Now; //修改时间
                    if (isAdd)
                    {
                        bll.KPIRecordAddInterface(record); //添加KPI明细记录
                    }
                    else
                    {
                        bll.KPIRecordUpdate(record); //修改KPI明细记录
                    }
                    return(record);
                }
            }
            catch (Exception ex)
            {
                Utility.SaveLog(ex.ToString());
                return(null);
            }
        }
示例#2
0
        public void AddKPIRecordComplain(T_HR_KPIRECORDCOMPLAIN entType)
        {
            //System.Data.Common.DbTransaction tran = null;
            try
            {
                // 1s 冉龙军
                //DataContext.Connection.Open();
                //entType.CHECKSTATE = "1";
                //if (DataContext.Connection.State == System.Data.ConnectionState.Closed)
                //{
                //    DataContext.Connection.Open();
                //}
                //// 1e
                //tran = DataContext.Connection.BeginTransaction();
                //dal.BeginTransaction();
                //实体不存在
                if (entType == null)
                {
                    throw new Exception("{REQUIREDFIELDS}");
                }
                //KPI明细记录不存在
                if (entType.T_HR_KPIRECORD == null)
                {
                    throw new Exception("{KPIRECORDREQUIREDFIELDS}");
                }

                var tempEnt = dal.GetObjects <T_HR_KPIRECORDCOMPLAIN>().FirstOrDefault(s => s.COMPLAINID == entType.COMPLAINID);
                if (tempEnt != null)
                {
                    throw new Exception("Repetition");
                }
                entType.UPDATEDATE = System.DateTime.Now;
                entType.CREATEDATE = System.DateTime.Now;

                //更新KPI类别信息
                var ents = from ent in dal.GetObjects <T_HR_KPIRECORD>()
                           where ent.KPIRECORDID == entType.T_HR_KPIRECORD.KPIRECORDID
                           select ent;
                if (ents.Count() > 0)
                {
                    var ent = ents.FirstOrDefault();
                    //更新评分方式
                    Utility.CloneEntity <T_HR_KPIRECORD>(entType.T_HR_KPIRECORD, ent);
                    // 1s 冉龙军
                    //ent.COMPLAINSTATUS = "1";
                    ent.COMPLAINSTATUS = "0";


                    KPIRecordBll bll = new KPIRecordBll();

                    if (ent.T_HR_KPIPOINT != null)
                    {
                        ent.T_HR_KPIPOINTReference.EntityKey =
                            new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_KPIPOINT", "KPIPOINTID", ent.T_HR_KPIPOINT.KPIPOINTID);

                        ent.T_HR_KPIPOINT.EntityKey =
                            new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_KPIPOINT", "KPIPOINTID", ent.T_HR_KPIPOINT.KPIPOINTID);
                    }
                    Utility.RefreshEntity(ent);

                    bll.Update(ent);


                    if (entType.T_HR_KPIRECORD != null)
                    {
                        entType.T_HR_KPIRECORDReference.EntityKey =
                            new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_KPIRECORD", "KPIRECORDID", entType.T_HR_KPIRECORD.KPIRECORDID);

                        entType.T_HR_KPIRECORD.EntityKey =
                            new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_KPIRECORD", "KPIRECORDID", entType.T_HR_KPIRECORD.KPIRECORDID);
                    }
                    Utility.RefreshEntity(entType);
                    dal.Add(entType);


                    //ent.T_HR_KPIRECORDCOMPLAIN.Add(entType);
                }

                //统一提交
                //dal.SaveContextChanges();
                //DataContext.SaveChanges();

                //提交事务
                //dal.CommitTransaction();
            }
            catch (Exception ex)
            {
                //dal.RollbackTransaction();
                SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + " AddKPIRecordComplain:" + ex.Message);
                throw ex;
            }
            finally
            {
            }
        }
示例#3
0
        /// <summary>
        /// 绩效控件手动打分,并返回结果
        /// </summary>
        /// <param name="kpiPoint"></param>
        /// <param name="formCode"></param>
        /// <param name="flowID"></param>
        /// <param name="lastStepCode"></param>
        /// <param name="AppraiseeID"></param>
        /// <param name="AppraiserID"></param>
        /// <param name="score"></param>
        /// <param name="scoretype"></param>
        /// <returns></returns>
        public T_HR_KPIRECORD SaveKPIRecord(T_HR_KPIPOINT kpiPoint, string formCode, string flowID, string lastStepCode, string AppraiseeID, string AppraiserID, int score, int scoretype)
        {
            try
            {
                bool isAdd = false; //判断是否为添加的标示。
                // 1s 冉龙军
                // 改stepID为stepCode(当流程中有重复的步骤时,此方法不可取)
                //T_HR_KPIRECORD record = GetKPIRecord(formCode, flowID, lastStepCode);
                T_HR_KPIRECORD record = GetKPIRecord(formCode, flowID, kpiPoint.STEPID);
                // 1e
                if (record == null)
                {
                    isAdd  = true;
                    record = InitialKPIRecord(formCode, flowID, lastStepCode, kpiPoint);
                }
                // 1s 冉龙军
                else
                {
                    if (record.OWNERCOMPANYID != null && record.OWNERDEPARTMENTID != null && record.OWNERPOSTID != null &&
                        record.OWNERID != null)
                    {
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(AppraiseeID))
                        {
                        }
                        else
                        {
                            // 绩效所有者
                            using (EmployeeBLL kpiDetailEmployeeBLL = new EmployeeBLL())
                            {
                                V_EMPLOYEEPOST kpiDetailRecord = kpiDetailEmployeeBLL.GetEmployeeDetailByID(AppraiseeID);
                                if (kpiDetailRecord != null && kpiDetailRecord.EMPLOYEEPOSTS[0] != null &&
                                    kpiDetailRecord.EMPLOYEEPOSTS[0].T_HR_POST != null &&
                                    kpiDetailRecord.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT != null &&
                                    kpiDetailRecord.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY != null)
                                {
                                    record.OWNERCOMPANYID =
                                        kpiDetailRecord.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.COMPANYID;
                                    record.OWNERDEPARTMENTID =
                                        kpiDetailRecord.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT.DEPARTMENTID;
                                    record.OWNERPOSTID  = kpiDetailRecord.EMPLOYEEPOSTS[0].T_HR_POST.POSTID;
                                    record.OWNERID      = AppraiseeID;
                                    record.CREATEUSERID = AppraiseeID;
                                }
                            }
                        }
                    }
                }
                // 1e
                switch (scoretype)
                {
                //系统评分
                case 0:
                    record.SYSTEMSCORE  = score;
                    record.APPRAISEEID  = AppraiseeID;
                    record.UPDATEUSERID = AppraiseeID;
                    break;

                //手动评分
                case 1:
                    record.MANUALSCORE  = score;
                    record.APPRAISEEID  = AppraiseeID;
                    record.APPRAISERID  = AppraiserID;
                    record.UPDATEUSERID = AppraiserID;
                    break;

                //抽查评分
                case 2:
                    record.RANDOMSCORE    = score;
                    record.APPRAISEEID    = AppraiseeID;
                    record.RANDOMPERSONID = AppraiserID;
                    record.UPDATEUSERID   = AppraiserID;
                    break;

                // 1s 冉龙军
                //抽查评分
                case 3:
                    record.RANDOMPERSONID = AppraiserID;
                    break;
                    // 1e
                }

                //判断打分是否已经全部打完
                // 1s 冉龙军
                //if ((kpiPoint.T_HR_SCORETYPE.ISSYSTEMSCORE.Trim() == "0" || record.SYSTEMSCORE != null)         //不需要机打,或者已经打过
                //    && (kpiPoint.T_HR_SCORETYPE.ISMANUALSCORE.Trim() == "0" || record.MANUALSCORE != null)      //不需要人打,或者已经打过
                //    && (kpiPoint.T_HR_SCORETYPE.ISRANDOMSCORE.Trim() == "0" || record.RANDOMSCORE != null))     //不需要抽查,或者已经打过
                //{
                //    record.SUMSCORE = CulcalateScore(record);
                //}
                #region 全部打完才出总分
                //if (kpiPoint != null && kpiPoint.T_HR_SCORETYPE != null)
                //{
                //    if ((kpiPoint.T_HR_SCORETYPE.ISSYSTEMSCORE.Trim() == "0" || record.SYSTEMSCORE != null) //不需要机打,或者已经打过
                //        && (kpiPoint.T_HR_SCORETYPE.ISMANUALSCORE.Trim() == "0" || record.MANUALSCORE != null)
                //        //不需要人打,或者已经打过
                //        && (kpiPoint.T_HR_SCORETYPE.ISRANDOMSCORE.Trim() == "0" || record.RANDOMSCORE != null))
                //    //不需要抽查,或者已经打过
                //    {
                //        record.SUMSCORE = CulcalateScore(record);
                //    }
                //}
                #endregion
                // 计算总分
                record.SUMSCORE = CulcalateScore(record);

                // 1e
                KPIRecordBll bll = new KPIRecordBll();

                record.UPDATEDATE = System.DateTime.Now; //修改时间
                if (isAdd)
                {
                    bll.KPIRecordAdd(record); //添加KPI明细记录
                }
                else
                {
                    bll.KPIRecordUpdate(record); //修改KPI明细记录
                }

                SumPerformanceBll bllSumPerf = new SumPerformanceBll();
                bllSumPerf.SaveMyRecordByKPIRd(record);

                return(record);
            }
            catch (Exception ex)
            {
                Utility.SaveLog("绩效控件执行手动打分出错,出错原因:" + ex.ToString());
                return(null);
            }
        }