Beispiel #1
0
        public int AddKPIEvaluate(KPIEvaluateInfo kpiEvaluate)
        {
            SqlParameter[] pt = new SqlParameter[] {
                new SqlParameter("@userId", SqlDbType.Int),
                new SqlParameter("@postId", SqlDbType.Int),
                new SqlParameter("@kPIId", SqlDbType.Int),
                new SqlParameter("@scorse", SqlDbType.Float),
                new SqlParameter("@rate", SqlDbType.Int),
                new SqlParameter("@state", SqlDbType.Int),
                //new SqlParameter("@evaluateDate", SqlDbType.NVarChar),
                new SqlParameter("@evaluateNameId", SqlDbType.Int),
                new SqlParameter("@evaluateUserId", SqlDbType.Int)
            };

            pt[0].Value = kpiEvaluate.UserId;
            pt[1].Value = kpiEvaluate.PostId;
            pt[2].Value = kpiEvaluate.KPIId;
            pt[3].Value = kpiEvaluate.Scorse;
            pt[4].Value = kpiEvaluate.Rate;
            pt[5].Value = kpiEvaluate.State;
            //pt[6].Value = kpiEvaluate.EvaluateDate;
            pt[6].Value = kpiEvaluate.EvaluateNameId;
            pt[7].Value = kpiEvaluate.EvaluateUserId;
            return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddKPIEvaluate", pt)));
        }
Beispiel #2
0
        public KPIEvaluateInfo ReadKPIEvaluate(int id)
        {
            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.NVarChar) };
            pt[0].Value = id;
            KPIEvaluateInfo info = new KPIEvaluateInfo();

            using (SqlDataReader dr = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadKPIEvaluate", pt))
            {
                if (dr.Read())
                {
                    info.ID             = int.Parse(dr["ID"].ToString());
                    info.UserId         = int.Parse(dr["ParentId"].ToString());
                    info.PostId         = int.Parse(dr["PostId"].ToString());
                    info.KPIId          = int.Parse(dr["KPIId"].ToString());
                    info.Scorse         = float.Parse(dr["Scorse"].ToString());
                    info.Rate           = int.Parse(dr["Rate"].ToString());
                    info.State          = int.Parse(dr["State"].ToString());
                    info.EvaluateDate   = dr["EvaluateDate"].ToString();
                    info.EvaluateNameId = int.Parse(dr["EvaluateNameId"].ToString());
                    info.AddDate        = Convert.ToDateTime(dr["AddDate"].ToString());
                    info.EvaluateUserId = int.Parse(dr["EvaluateUserId"].ToString());
                }
            }
            return(info);
        }
Beispiel #3
0
 public void PrepareModel(SqlDataReader dr, List <KPIEvaluateInfo> kpiEvaluateList)
 {
     while (dr.Read())
     {
         KPIEvaluateInfo info = new KPIEvaluateInfo();
         {
             info.ID             = int.Parse(dr["ID"].ToString());
             info.UserId         = int.Parse(dr["UserId"].ToString());
             info.PostId         = int.Parse(dr["PostId"].ToString());
             info.KPIId          = int.Parse(dr["KPIId"].ToString());
             info.Scorse         = float.Parse(dr["Scorse"].ToString());
             info.Rate           = int.Parse(dr["Rate"].ToString());
             info.State          = int.Parse(dr["State"].ToString());
             info.EvaluateDate   = dr["EvaluateDate"].ToString();
             info.EvaluateNameId = int.Parse(dr["EvaluateNameId"].ToString());
             info.AddDate        = Convert.ToDateTime(dr["AddDate"].ToString());
             info.EvaluateUserId = int.Parse(dr["EvaluateUserId"].ToString());
         }
         kpiEvaluateList.Add(info);
     }
 }
Beispiel #4
0
        public void UpdateKPIEvaluate(KPIEvaluateInfo kpiEvaluate)
        {
            SqlParameter[] pt = new SqlParameter[] {
                new SqlParameter("@id", SqlDbType.Int),
                new SqlParameter("@scorse", SqlDbType.Float),
                new SqlParameter("@rate", SqlDbType.Int),
                new SqlParameter("@state", SqlDbType.Int),
                //new SqlParameter("@evaluateDate", SqlDbType.NVarChar),
                new SqlParameter("@evaluateNameId", SqlDbType.Int),
                new SqlParameter("@evaluateUserId", SqlDbType.Int)
            };

            pt[0].Value = kpiEvaluate.ID;
            pt[1].Value = kpiEvaluate.Scorse;
            pt[2].Value = kpiEvaluate.Rate;
            pt[3].Value = kpiEvaluate.State;
            //pt[4].Value = kpiEvaluate.EvaluateDate;
            pt[4].Value = kpiEvaluate.EvaluateNameId;
            pt[5].Value = kpiEvaluate.EvaluateUserId;

            ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateKPIEvaluate", pt);
        }
Beispiel #5
0
        public List <KPIEvaluateInfo> SearchFixedKPIEvaluateList(KPIEvaluateSearchInfo kpiEvaluateSearch)
        {
            MssqlCondition mssqlCondition = new MssqlCondition();

            this.PrepareCondition(mssqlCondition, kpiEvaluateSearch);
            List <KPIEvaluateInfo> kpiEvaluateList = new List <KPIEvaluateInfo>();

            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@condition", SqlDbType.NVarChar) };
            pt[0].Value = mssqlCondition.ToString();
            using (SqlDataReader dr = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "SearchFixedKPIEvaluateList", pt))
            {
                while (dr.Read())
                {
                    KPIEvaluateInfo info = new KPIEvaluateInfo();
                    {
                        info.KPIId = int.Parse(dr["KPIId"].ToString());
                        info.Rate  = int.Parse(dr["Rate"].ToString());
                    }
                    kpiEvaluateList.Add(info);
                }
            }
            return(kpiEvaluateList);
        }
Beispiel #6
0
 public static void UpdateKPIEvaluate(KPIEvaluateInfo kpiEvaluate)
 {
     dal.UpdateKPIEvaluate(kpiEvaluate);
 }
Beispiel #7
0
 public static int AddKPIEvaluate(KPIEvaluateInfo kpiEvaluate)
 {
     return(dal.AddKPIEvaluate(kpiEvaluate));
 }
Beispiel #8
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "添加KPI指标";

            base.CheckUserPower("AddEvaluate", PowerCheckType.Single);

            if (companyID <= 0)
            {
                companyID = base.UserCompanyID;
            }

            string tempKPI  = string.Empty; //临时指标ID
            string fixedKPI = string.Empty; //永久指标ID

            //获取岗位ID后,加载岗位KPI列表
            if (Action == "step1")
            {
                if (userId == int.MinValue)
                {
                    userName = RequestHelper.GetForm <string>("UserName");
                    UserSearchInfo user = new UserSearchInfo();
                    user.EqualRealName = userName;
                    user.InCompanyID   = companyID.ToString();
                    List <UserInfo> userList = UserBLL.SearchUserList(user);
                    if (userList.Count > 0)
                    {
                        userId = userList[0].ID;
                    }
                    else
                    {
                        ScriptHelper.Alert("找不到此用户");
                    }
                }
                workPostId     = RequestHelper.GetForm <int>("PostId");
                evaluateNameId = RequestHelper.GetForm <int>("EvaluationName");

                //获取UserId值

                if (workPostId > 0)
                {
                    KPISearchInfo kpiSearch = new KPISearchInfo();
                    kpiSearch.IdStr = WorkingPostBLL.ReadWorkingPostView(workPostId).KPIContent;
                    if (!string.IsNullOrEmpty(kpiSearch.IdStr))
                    {
                        List <KPIInfo> kpiList = KPIBLL.SearchKPIList(kpiSearch);

                        List <KPIInfo> tempList1 = new List <KPIInfo>();
                        List <KPIInfo> tempList2 = new List <KPIInfo>();
                        List <KPIInfo> tempList3 = new List <KPIInfo>();
                        foreach (KPIInfo info in kpiList)
                        {
                            if (info.Type == KPIType.Fixed)
                            {
                                if (string.IsNullOrEmpty(fixedKPI))
                                {
                                    fixedKPI = info.ID.ToString();
                                }
                                else
                                {
                                    fixedKPI = fixedKPI + "," + info.ID.ToString();
                                }
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(tempKPI))
                                {
                                    tempKPI = info.ID.ToString();
                                }
                                else
                                {
                                    tempKPI = tempKPI + "," + info.ID.ToString();
                                }
                            }

                            switch (info.ParentId)
                            {
                            case 1:
                                tempList1.Add(info);
                                break;

                            case 2:
                                tempList2.Add(info);
                                break;

                            case 3:
                                tempList3.Add(info);
                                break;
                            }
                        }

                        int i = 1;
                        foreach (KPIInfo info in tempList1)
                        {
                            trHtml.AppendLine("<tr>");
                            if (i == 1)
                            {
                                trHtml.AppendLine("	<td rowspan=\"" + tempList1.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>");
                            }
                            if (info.Type == KPIType.Fixed)
                            {
                                trHtml.AppendLine("	<td  class=\"forever\">" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>");
                            }
                            else
                            {
                                trHtml.AppendLine("	<td>" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>");
                            }
                            trHtml.AppendLine("	<td class=\"evaluation_content\" data-id=\"" + info.ID + "\">" + i.ToString() + "." + info.Name + "</td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("</tr>");
                            i++;
                        }

                        i = 1;
                        foreach (KPIInfo info in tempList2)
                        {
                            trHtml.AppendLine("<tr>");
                            if (i == 1)
                            {
                                trHtml.AppendLine("	<td rowspan=\"" + tempList2.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>");
                            }
                            if (info.Type == KPIType.Fixed)
                            {
                                trHtml.AppendLine("	<td  class=\"forever\">" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>");
                            }
                            else
                            {
                                trHtml.AppendLine("	<td>" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>");
                            }
                            trHtml.AppendLine("	<td class=\"evaluation_content\" data-id=\"" + info.ID + "\">" + i.ToString() + "." + info.Name + "</td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("</tr>");
                            i++;
                        }

                        i = 1;
                        foreach (KPIInfo info in tempList3)
                        {
                            trHtml.AppendLine("<tr>");
                            if (i == 1)
                            {
                                trHtml.AppendLine("	<td rowspan=\"" + tempList3.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>");
                            }
                            if (info.Type == KPIType.Fixed)
                            {
                                trHtml.AppendLine("	<td  class=\"forever\">" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>");
                            }
                            else
                            {
                                trHtml.AppendLine("	<td>" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>");
                            }
                            trHtml.AppendLine("	<td class=\"evaluation_content\" data-id=\"" + info.ID + "\">" + i.ToString() + "." + info.Name + "</td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("	<td class=\"schedule\"></td>");
                            trHtml.AppendLine("</tr>");
                            i++;
                        }
                    }
                }

                if (userId > 0)
                {
                    KPIEvaluateSearchInfo kpiEvaluate = new KPIEvaluateSearchInfo();
                    kpiEvaluate.UserId         = userId.ToString();
                    kpiEvaluate.EvaluateNameId = evaluateNameId;
                    kpiEvaluate.PostId         = workPostId.ToString();

                    //取得临时指标的值
                    if (!string.IsNullOrEmpty(tempKPI))
                    {
                        kpiEvaluate.KPIdStr = tempKPI;
                        foreach (KPIEvaluateInfo info in KPIEvaluateBLL.SearchKPIEvaluateList(kpiEvaluate))
                        {
                            if (string.IsNullOrEmpty(kpiIdStr))
                            {
                                kpiIdStr = info.KPIId + ":" + info.Rate;
                            }
                            else
                            {
                                kpiIdStr = kpiIdStr + "," + info.KPIId + ":" + info.Rate;
                            }
                        }
                    }

                    //取得永久指标的值
                    if (!string.IsNullOrEmpty(fixedKPI))
                    {
                        kpiEvaluate.KPIdStr = fixedKPI;
                        List <KPIEvaluateInfo> fixedKPIEValuateList = KPIEvaluateBLL.SearchKPIEvaluateList(kpiEvaluate);
                        //如果临时指标和永久指标的记录都为空的话,则为新增评估,调取永久指标记录
                        if (string.IsNullOrEmpty(kpiIdStr) && fixedKPIEValuateList.Count <= 0)
                        {
                            kpiEvaluate.EvaluateNameId = int.MinValue;
                            kpiEvaluate.PostId         = string.Empty; //所有岗位的评估记录都有效(包括已删除岗位的评估记录)
                            fixedKPIEValuateList       = KPIEvaluateBLL.SearchFixedKPIEvaluateList(kpiEvaluate);
                        }
                        foreach (KPIEvaluateInfo info in fixedKPIEValuateList)//BLLKPIEvaluate.SearchFixedKPIEvaluateList(kpiEvaluate)
                        {
                            if (string.IsNullOrEmpty(kpiIdStr))
                            {
                                kpiIdStr = info.KPIId + ":" + info.Rate;
                            }
                            else
                            {
                                kpiIdStr = kpiIdStr + "," + info.KPIId + ":" + info.Rate;
                            }
                        }
                    }
                }
            }
            else if (Action == "step2")
            {
                kpiIdStr = RequestHelper.GetForm <string>("kpiidstr");
                //workPostId = RequestHelper.GetForm<int>("PostId");
                string alertMessage = ShopLanguage.ReadLanguage("AddOK");
                base.CheckUserPower("AddEvaluate", PowerCheckType.Single);
                if (!string.IsNullOrEmpty(kpiIdStr))
                {
                    KPIEvaluateBLL.DeleteKPIEvaluate(userId, workPostId, evaluateNameId);
                    foreach (string item in kpiIdStr.Split(','))
                    {
                        KPIEvaluateInfo kpiEvaluate = new KPIEvaluateInfo();
                        kpiEvaluate.KPIId  = int.Parse(item.Split(':')[0]);
                        kpiEvaluate.Scorse = float.Parse(item.Split(':')[1]);
                        kpiEvaluate.UserId = userId;
                        //kpiEvaluate.EvaluateDate = evaluateDate;
                        kpiEvaluate.EvaluateNameId = evaluateNameId;
                        kpiEvaluate.PostId         = workPostId;
                        kpiEvaluate.Rate           = int.Parse(item.Split(':')[1]);

                        int id = KPIEvaluateBLL.AddKPIEvaluate(kpiEvaluate);
                        AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Evaluate"), id);
                    }
                }
                ScriptHelper.Alert(alertMessage, "EvaluateAdd.aspx");
            }
        }