Example #1
0
 public void PrepareCondition(MssqlCondition mssqlCondition, KPISearchInfo kpiSearch)
 {
     mssqlCondition.Add("[Id]", kpiSearch.IdStr, ConditionType.In);
     mssqlCondition.Add("[ParentID]", kpiSearch.ParentId, ConditionType.In);
     mssqlCondition.Add("[Name]", kpiSearch.Name, ConditionType.Like);
     mssqlCondition.Add("[CompanyId]", kpiSearch.CompanyID, ConditionType.In);
     mssqlCondition.Add("[State]", kpiSearch.State, ConditionType.Equal);
 }
Example #2
0
        protected override void PageLoad()
        {
            //string allCompanyID = CompanyBLL.SystemCompanyId + "," + base.ParentCompanyID + "," + base.SonCompanyID;
            base.PageLoad();
            base.Title = "KPI指标列表";

            string action = RequestHelper.GetQueryString <string>("Action");

            if (action == "Delete")
            {
                string selectID = RequestHelper.GetQueryString <string>("SelectID");
                if (!string.IsNullOrEmpty(selectID))
                {
                    base.CheckUserPower("DeleteKPI", PowerCheckType.Single);
                    KPIBLL.DeleteKPI(selectID);
                    AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("KPI"), selectID);
                    ResponseHelper.Redirect(Request.UrlReferrer.ToString());
                }
            }

            base.CheckUserPower("ReadKPI", PowerCheckType.Single);
            Company = CompanyBLL.ReadCompany(CompanyID);

            KPISearchInfo kpiSearch = new KPISearchInfo();

            kpiSearch.ParentId = "0";
            KPIClassList       = KPIBLL.SearchKPIList(kpiSearch);
            if (ClassID > 0)
            {
                kpiSearch.ParentId = ClassID.ToString();
            }
            else
            {
                kpiSearch.ParentId = string.Empty;
            }
            kpiSearch.Name = Name;
            if (CompanyID < 0)
            {
                kpiSearch.CompanyID = CompanyBLL.SystemCompanyId.ToString();
                if (!string.IsNullOrEmpty(base.ParentCompanyID))
                {
                    kpiSearch.CompanyID += "," + base.ParentCompanyID;
                }
                if (!string.IsNullOrEmpty(base.SonCompanyID))
                {
                    kpiSearch.CompanyID += "," + base.SonCompanyID;
                }
            }
            else
            {
                kpiSearch.CompanyID = CompanyID.ToString();
            }
            KPIList = KPIBLL.SearchKPIList(kpiSearch, base.CurrentPage, base.PageSize, ref this.Count);
            base.BindPageControl(ref base.CommonPager);
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                string Action = RequestHelper.GetQueryString <string>("Action");
                if (Action == "Delete")
                {
                    int id = RequestHelper.GetQueryString <int>("ID");
                    if (id != -2147483648)
                    {
                        base.CheckAdminPower("DeleteKPI", PowerCheckType.Single);
                        KPIBLL.DeleteKPI(id.ToString());
                        AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("KPI"), id);
                    }
                }

                if (companyId > 0)
                {
                    CompanyInfo company = CompanyBLL.ReadCompany(companyId);
                    _currentCompanyName = company.CompanySimpleName;
                    CompanyName.Value   = company.CompanyName;
                }

                base.CheckAdminPower("ReadKPI", PowerCheckType.Single);
                KPISearchInfo kpi = new KPISearchInfo();
                kpi.ParentId           = "0";
                KPICate.DataSource     = KPIBLL.SearchKPIList(kpi);
                KPICate.DataTextField  = "Name";
                KPICate.DataValueField = "ID";
                KPICate.DataBind();
                KPICate.Items.Insert(0, new ListItem("请选择分类", ""));

                if (parentId > 0)
                {
                    kpi.ParentId          = parentId.ToString();
                    KPICate.SelectedValue = parentId.ToString();
                }
                else
                {
                    kpi.ParentId = string.Empty;
                }
                kpi.Name = kpiName;
                if (companyId > 0)
                {
                    kpi.CompanyID = companyId.ToString();
                }
                base.BindControl(KPIBLL.SearchKPIList(kpi, base.CurrentPage, base.PageSize, ref this.Count), this.RecordList, this.MyPager);

                Name.Text = kpiName;
            }
        }
Example #4
0
        public List <KPIInfo> SearchKPIList(KPISearchInfo kpiSearch)
        {
            MssqlCondition mssqlCondition = new MssqlCondition();

            this.PrepareCondition(mssqlCondition, kpiSearch);
            List <KPIInfo> kpiList = new List <KPIInfo>();

            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@condition", SqlDbType.NVarChar) };
            pt[0].Value = mssqlCondition.ToString();
            using (SqlDataReader dr = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "SearchKPIList", pt))
            {
                this.PrepareModel(dr, kpiList);
            }
            return(kpiList);
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                if (CompanyID >= 0)
                {
                    CompanyName.Value = CompanyBLL.ReadCompany(CompanyID).CompanyName;
                }

                KPISearchInfo kpi = new KPISearchInfo();
                kpi.ParentId = "0";

                this.FatherID.DataSource     = KPIBLL.SearchKPIList(kpi);
                this.FatherID.DataTextField  = "Name";
                this.FatherID.DataValueField = "ID";
                this.FatherID.DataBind();
                this.FatherID.Items.Insert(0, new ListItem("请选择分类", ""));
                FatherID.SelectedValue = ParentID.ToString();

                Type.DataSource     = EnumHelper.ReadEnumList <KPIType>();
                Type.DataTextField  = "ChineseName";
                Type.DataValueField = "Value";
                Type.DataBind();

                int queryString = RequestHelper.GetQueryString <int>("ID");

                if (queryString != int.MinValue)
                {
                    base.CheckAdminPower("ReadKPI", PowerCheckType.Single);
                    KPIInfo info = KPIBLL.ReadKPI(queryString);
                    CompanyName.Value = CompanyBLL.ReadCompany(info.CompanyID).CompanyName;
                    CompanyID         = info.CompanyID;
                    Type.Text         = ((int)info.Type).ToString();
                    FatherID.Text     = info.ParentId.ToString();
                    Sort.Text         = info.Sort.ToString();
                    ClassName.Text    = info.Name;
                    Introduction.Text = info.EvaluateInfo;
                    Score.Text        = info.Scorse.ToString();
                    Method.Text       = info.Method;
                }
            }
        }
Example #6
0
        public List <KPIInfo> SearchKPIList(KPISearchInfo kpiSearch, int currentPage, int pageSize, ref int count)
        {
            List <KPIInfo>      kpiList = new List <KPIInfo>();
            ShopMssqlPagerClass class2  = new ShopMssqlPagerClass();

            class2.TableName   = ShopMssqlHelper.TablePrefix + "KPI";
            class2.Fields      = "*";
            class2.CurrentPage = currentPage;
            class2.PageSize    = pageSize;
            class2.OrderField  = "[ID]";
            class2.OrderType   = OrderType.Desc;
            this.PrepareCondition(class2.MssqlCondition, kpiSearch);
            class2.Count = count;
            count        = class2.Count;
            using (SqlDataReader dr = class2.ExecuteReader())
            {
                this.PrepareModel(dr, kpiList);
            }
            return(kpiList);
        }
Example #7
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "Ìí¼ÓKPIÖ¸±ê";

            base.CheckUserPower("ReadKPI,AddKPI,UpdateKPI", PowerCheckType.OR);

            KPISearchInfo kpiSearch = new KPISearchInfo();

            kpiSearch.ParentId = "0";
            KPIClassList       = KPIBLL.SearchKPIList(kpiSearch);

            KPITypeList = EnumHelper.ReadEnumList <KPIType>();

            if (ID > 0)
            {
                KPI       = KPIBLL.ReadKPI(ID);
                CompanyID = KPI.CompanyID;
                ClassID   = KPI.ParentId;
            }
        }
Example #8
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "综合能力评估";
            base.CheckUserPower("ReadTPRReport", PowerCheckType.Single);

            action = Request["Action"];
            if (action == "Detail")
            {
                evaluateNameId = RequestHelper.GetQueryString <int>("EvaluateNameId");
                evaluateType   = RequestHelper.GetQueryString <int>("EvaluateType");
            }
            companyIDString = base.UserCompanyID.ToString();
            if (companyID == 0)
            {
                companyIDString = base.SonCompanyID;
            }
            else if (companyID > 0)
            {
                companyIDString = companyID.ToString();
            }
            if (!base.ExistsSonCompany)
            {
                companyID = base.UserCompanyID;
            }

            if (!string.IsNullOrEmpty(action))
            {
                KPISearchInfo kpiSearch = new KPISearchInfo();
                kpiSearch.ParentId  = evaluateType.ToString();
                kpiSearch.CompanyID = CompanyBLL.SystemCompanyId.ToString() + "," + companyID.ToString();
                List <KPIInfo> kpiList = KPIBLL.SearchKPIList(kpiSearch);
                string         kpiStr  = string.Empty;
                //定义KPIId数组
                ArrayList IdArray = new ArrayList();
                if (kpiList.Count > 0)
                {
                    string[,] kpiArray = new string[kpiList.Count, 3];

                    foreach (KPIInfo info in kpiList)
                    {
                        IdArray.Add(info.ID);
                        if (string.IsNullOrEmpty(kpiStr))
                        {
                            kpiStr = info.ID.ToString();
                        }
                        else
                        {
                            kpiStr += "," + info.ID;
                        }
                        int i = IdArray.IndexOf(info.ID);
                        kpiArray[i, 0] = info.ID.ToString();
                        kpiArray[i, 1] = info.Name;
                        kpiArray[i, 2] = info.EvaluateInfo;
                    }

                    KPIEvaluateSearchInfo kpiEvaluate = new KPIEvaluateSearchInfo();
                    if (action == "Search" && string.IsNullOrEmpty(userIdStr))
                    {
                        //UserSearchInfo userSearch = new UserSearchInfo();
                        //userSearch.InCompanyID = base.UserCompanyID.ToString();
                        //userIdStr = UserBLL.ReadUserIdStr(UserBLL.SearchUserList(userSearch));

                        if (postID > 0 || !string.IsNullOrEmpty(companyIDString))
                        {
                            kpiEvaluate.Condition = "[UserID] in (select id from [_User] where [Status]!=" + (int)UserState.Del;
                            if (postID > 0)
                            {
                                kpiEvaluate.Condition += " And [WorkingPostID] in (" + postID.ToString() + ")";
                            }
                            if (!string.IsNullOrEmpty(companyIDString))
                            {
                                kpiEvaluate.Condition += " And [CompanyId] in (" + companyIDString + ")";
                            }
                            kpiEvaluate.Condition += ")";
                        }
                    }
                    else
                    {
                        user               = UserBLL.ReadUser(int.Parse(userIdStr));
                        evaluateName       = EvaluateNameBLL.ReadEvaluateName(evaluateNameId);
                        kpiEvaluate.UserId = userIdStr;
                    }
                    kpiEvaluate.EvaluateNameId = evaluateNameId;
                    kpiEvaluate.KPIdStr        = kpiStr;
                    List <KPIEvaluateInfo> kpiEvaluateList = KPIEvaluateBLL.SearchKPIEvaluateList(kpiEvaluate);

                    ArrayList userIdArray = new ArrayList();//new ArrayList(userIdStr.Split(','));
                    if (kpiEvaluateList.Count > 0)
                    {
                        foreach (KPIEvaluateInfo info in kpiEvaluateList)
                        {
                            if (!userIdArray.Contains(info.UserId))
                            {
                                userIdArray.Add(info.UserId);
                            }
                        }
                    }
                    string[, ,] dataArray = new string[kpiList.Count + 1, userIdArray.Count, 4];
                    //评估人数组
                    ArrayList evaluateUserIdArray = new ArrayList();
                    if (kpiEvaluateList.Count > 0)
                    {
                        foreach (KPIEvaluateInfo info in kpiEvaluateList)
                        {
                            if (!evaluateUserIdArray.Contains(info.EvaluateUserId))
                            {
                                evaluateUserIdArray.Add(info.EvaluateUserId);
                            }
                            dataArray[IdArray.IndexOf(info.KPIId), userIdArray.IndexOf(info.UserId), evaluateUserIdArray.IndexOf(info.EvaluateUserId)] = info.Scorse.ToString();
                        }
                    }
                    if (action != "Detail")//companyID >= 0
                    {
                        tableContent.Append("<tr><th class=\"project\">项目</th><th class=\"content\">内容</th>");
                        foreach (int item in userIdArray)
                        {
                            tableContent.Append("<th class=\"roll\"><a href=\"?Action=Detail&UserId=" + item + "&EvaluateNameId=" + evaluateNameId + "&EvaluateType=" + evaluateType + "\">" + UserBLL.ReadUser(item).RealName + "</a></th>");
                        }
                        for (int i = 0; i < dataArray.GetLength(0) - 1; i++)
                        {
                            tableContent.Append("<tr><td>" + kpiArray[i, 1] + "</td><td>" + kpiArray[i, 2] + "</td>");
                            for (int j = 0; j < userIdArray.Count; j++)
                            {
                                double totalScore = 0;
                                int    num        = 0;
                                for (int k = 0; k < 4; k++)
                                {
                                    if (!string.IsNullOrEmpty(dataArray[i, j, k]) || dataArray[i, j, k] != null)
                                    {
                                        totalScore += double.Parse(dataArray[i, j, k]);
                                        num++;
                                    }
                                }
                                if (totalScore == 0)
                                {
                                    tableContent.Append("<td>&nbsp;</td>");
                                }
                                else
                                {
                                    tableContent.Append("<td>" + Math.Round((totalScore / num), 1) + "</td>");
                                    if (string.IsNullOrEmpty(dataArray[dataArray.GetLength(0) - 1, j, 0]) || dataArray[dataArray.GetLength(0) - 1, j, 0] == null)
                                    {
                                        dataArray[dataArray.GetLength(0) - 1, j, 0] = Math.Round((totalScore / num), 1).ToString();
                                    }
                                    else
                                    {
                                        dataArray[dataArray.GetLength(0) - 1, j, 0] = (double.Parse(dataArray[dataArray.GetLength(0) - 1, j, 0]) + Math.Round((totalScore / num), 1)).ToString();
                                    }
                                }
                            }
                            tableContent.Append("</tr>");
                        }
                        tableContent.Append("<tr class=\"count\"><td colspan=\"2\">合计</td>");
                        for (int j = 0; j < userIdArray.Count; j++)
                        {
                            //员工综合能力评估合计要除以2
                            if (evaluateType == 530)
                            {
                                tableContent.Append("<td>" + Math.Round(double.Parse(dataArray[dataArray.GetLength(0) - 1, j, 0]) / 2, 1) + "</td>");
                            }
                            else
                            {
                                tableContent.Append("<td>" + dataArray[dataArray.GetLength(0) - 1, j, 0] + "</td>");
                            }
                        }
                        tableContent.Append("</tr>");
                    }
                    else
                    {
                        tableContent.Append("<tr><th class=\"project\">项目</th><th class=\"content\">内容</th>");
                        foreach (int item in evaluateUserIdArray)
                        {
                            tableContent.Append("<th class=\"roll\">评估" + (evaluateUserIdArray.IndexOf(item) + 1) + "</th>");
                        }
                        tableContent.Append("<th class=\"average\">平均分</th></tr>");
                        for (int i = 0; i < dataArray.GetLength(0) - 1; i++)
                        {
                            tableContent.Append("<tr><td>" + kpiArray[i, 1] + "</td><td>" + kpiArray[i, 2] + "</td>");
                            double totalScore = 0;
                            int    num        = 0;
                            for (int j = evaluateUserIdArray.Count - 1; j >= 0; j--)//for (int j = 0; j < evaluateUserIdArray.Count; j++)
                            {
                                if (dataArray[i, 0, j] != null)
                                {
                                    tableContent.Append("<td>" + dataArray[i, 0, j] + "</td>");
                                    totalScore += double.Parse(dataArray[i, 0, j]);
                                    num++;

                                    if (string.IsNullOrEmpty(dataArray[dataArray.GetLength(0) - 1, 0, j]) || dataArray[dataArray.GetLength(0) - 1, 0, j] == null)
                                    {
                                        dataArray[dataArray.GetLength(0) - 1, 0, j] = dataArray[i, 0, j];
                                    }
                                    else
                                    {
                                        dataArray[dataArray.GetLength(0) - 1, 0, j] = (double.Parse(dataArray[dataArray.GetLength(0) - 1, 0, j]) + double.Parse(dataArray[i, 0, j])).ToString();
                                    }
                                }
                                else
                                {
                                    tableContent.Append("<td>&nbsp;</td>");
                                }
                            }
                            if (num == 0)
                            {
                                tableContent.Append("<td>&nbsp;</td>");
                            }
                            else
                            {
                                tableContent.Append("<td>" + Math.Round((totalScore / num), 1) + "</td></tr>");
                            }
                        }
                        //员工综合能力评估合计要除以2
                        if (evaluateType == 530)
                        {
                            tableContent.Append("<tr class=\"count\"><td colspan=\"2\">合计(总分200,除2后取得分数)</td>");
                            for (int j = evaluateUserIdArray.Count - 1; j >= 0; j--)
                            {
                                tableContent.Append("<td>" + Math.Round(double.Parse(dataArray[dataArray.GetLength(0) - 1, 0, j]) / 2, 1) + "</td>");
                            }
                        }
                        else
                        {
                            tableContent.Append("<tr class=\"count\"><td colspan=\"2\">合计</td>");
                            for (int j = evaluateUserIdArray.Count - 1; j >= 0; j--)
                            {
                                tableContent.Append("<td>" + Math.Round(double.Parse(dataArray[dataArray.GetLength(0) - 1, 0, j]), 1) + "</td>");
                            }
                        }
                        tableContent.Append("<td>&nbsp;</td></tr>");
                    }
                }
            }
        }
Example #9
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "评估结果";

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

            if (workPostId > 0)
            {
                KPISearchInfo kpiSearch = new KPISearchInfo();
                kpiSearch.IdStr = WorkingPostBLL.ReadWorkingPostView(workPostId).KPIContent;
                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>");
                    }
                    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>");
                    }
                    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>");
                    }
                    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.PostId         = workPostId.ToString();
                kpiEvaluate.EvaluateNameId = evaluateNameId;

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

                //取得临时指标的值
                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;
                        }
                    }
                }
            }
        }
Example #10
0
 public static List <KPIInfo> SearchKPIList(KPISearchInfo kpiSearch, int currentPage, int pageSize, ref int count)
 {
     return(dal.SearchKPIList(kpiSearch, currentPage, pageSize, ref count));
 }
Example #11
0
 public static List <KPIInfo> SearchKPIList(KPISearchInfo kpiSearch)
 {
     return(dal.SearchKPIList(kpiSearch));
 }
Example #12
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");
            }
        }
Example #13
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "岗位列表";
            base.CheckUserPower("ReadWorkingPost,AddWorkingPost,UpdateWorkingPost", PowerCheckType.OR);

            string allCompanyID = CompanyBLL.SystemCompanyId.ToString();

            if (!string.IsNullOrEmpty(base.ParentCompanyID))
            {
                allCompanyID += "," + base.ParentCompanyID;
            }
            //if (!string.IsNullOrEmpty(base.SonCompanyID))
            //    allCompanyID += "," + base.SonCompanyID;

            if (CompanyID < 0)
            {
                CompanyID = base.UserCompanyID;
            }
            if (WorkPostID > 0)
            {
                WorkingPost = WorkingPostBLL.ReadWorkingPost(WorkPostID);
                CompanyID   = WorkingPost.CompanyId;
                KPIContent  = KPITempletBLL.ReadKPITemplet(WorkingPost.KPITempletId).KPIContent;
                if (CompanyID != base.UserCompanyID)
                {
                    string parentCompanyID = CompanyBLL.ReadParentCompanyId(CompanyID);
                    string sonCompanyID    = CompanyBLL.ReadCompanyIdList(CompanyID.ToString());
                    allCompanyID = CompanyBLL.SystemCompanyId.ToString();
                    if (!string.IsNullOrEmpty(parentCompanyID))
                    {
                        allCompanyID += "," + parentCompanyID;
                    }
                    //if (!string.IsNullOrEmpty(sonCompanyID))
                    //    allCompanyID += "," + sonCompanyID;
                }
            }

            WorkingPostSearchInfo workingPostSearch = new WorkingPostSearchInfo();

            workingPostSearch.CompanyId = CompanyID.ToString();
            workingPostSearch.ParentId  = "0";
            workingPostSearch.IsPost    = 0;
            WorkingPostClassList        = WorkingPostBLL.SearchWorkingPostList(workingPostSearch);

            KPISearchInfo kpiSearch = new KPISearchInfo();

            kpiSearch.CompanyID = allCompanyID;
            kpiSearch.ParentId  = "1,2,3";
            List <KPIInfo> kpiList = KPIBLL.SearchKPIList(kpiSearch);

            foreach (KPIInfo info in kpiList)
            {
                switch (info.ParentId)
                {
                case 1:
                    TempList1.Add(info);
                    break;

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

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