private void LoadKpiData() { int kpiId = Convert.ToInt32(KpiIdHiddenField.Value); int userId = UserBLL.GetUserIdByUsername(User.Identity.Name); UserIdHiddenField.Value = userId.ToString(); KPI kpi = KPIBLL.GetKPIById(kpiId); KpiNameLiteral.Text = kpi.Name; //Inicializo los valores conocidos string lang = LanguageUtilities.GetLanguageFromContext(); KPITypeBLL theBll = new KPITypeBLL(); KPIType type = theBll.GetKPITypesByID(kpi.KpiTypeID, lang); KpiType.Text = type != null ? type.TypeName : kpi.KpiTypeID; //WebServiceId.Text = "<div class='col-md-4 col-sm-4'>Web Service ID:</div><div class='col-md-8 col-sm-8'>SERV-Reliavility</div>"; ReportingUnit.Text = kpi.ReportingUnitName; KpiTarget.Text = (kpi.TargetPeriod == 0 ? Resources.KpiDetails.NoTargetLabel : kpi.TargetPeriod + " " + kpi.ReportingUnitID); //if (caso <= 50) //{ // StartingDate.Text = "<div class='col-md-4 col-sm-4'>Starting Date:</div><div class='col-md-8 col-sm-8'>01/15/16</div>"; // MeanTimeGraphic.Visible = true; // MeanTimeProgress.Visible = true; //} //else //{ StartingDate.Text = kpi.StartDate != DateTime.MinValue ? kpi.StartDate.ToShortDateString() : "-"; RevenueCollectionGraphic.Visible = true; //RevenueCollectionProgress.Visible = true; ChartControl.KpiId = kpiId; ExportControl.KpiId = kpiId; StatsControl.KpiId = kpiId; MeasurementsControl.KpiId = kpiId; MeasurementsControl.Unit = kpi.UnitID; MeasurementsControl.Currency = kpi.Currency; MeasurementsControl.CurrencyUnit = kpi.CurrencyUnitForDisplay; UnitIdHiddenField.Value = kpi.UnitID; CurrencyHiddenField.Value = kpi.Currency; CurrencyUnitHiddenField.Value = kpi.CurrencyUnitForDisplay; //CurrencyUnitBLL currencyUnitBll = new CurrencyUnitBLL(); //CurrencyUnit currencyUnit = currencyUnitBll.GetCurrencyUnitsById(lang, ; //MeasurementsControl.Currency = kpi.Currency; //} List <KPICategoyCombination> categories = KPICategoryCombinationBLL.GetCategoryItemsCombinatedByKpiId(kpiId); if (categories.Count > 0) { CategoriesRepeater.DataSource = categories; CategoriesRepeater.DataBind(); CategoriesPanel.Visible = true; } }
public string GetSearchTitle() { if (RequestHelper.GetQueryString <string>("Action") == "search") { StringBuilder HtmlOut = new StringBuilder(); if (companyId > 0) { HtmlOut.Append(_currentCompanyName); } if (!string.IsNullOrEmpty(kpiName)) { HtmlOut.Append(" [指标:" + kpiName + "] "); } if (parentId > 0) { HtmlOut.Append(" [分类:" + KPIBLL.ReadKPI(parentId).Name + "] "); } if (!string.IsNullOrEmpty(HtmlOut.ToString())) { HtmlOut.Insert(0, "<tr><td colspan=\"7\">"); HtmlOut.Append("</td></tr>"); } return(HtmlOut.ToString()); } return(string.Empty); }
public string GetSearchTitle() { if (RequestHelper.GetQueryString <string>("Action") == "search") { StringBuilder HtmlOut = new StringBuilder(); if (CompanyID >= 0) { if (CompanyID == CompanyBLL.SystemCompanyId) { HtmlOut.Append("系统指标"); } else { HtmlOut.Append(CompanyBLL.ReadCompany(CompanyID).CompanyName); } } if (!string.IsNullOrEmpty(Name)) { HtmlOut.Append(" [指标:" + Name + "] "); } if (ClassID > 0) { HtmlOut.Append(" [分类:" + KPIBLL.ReadKPI(ClassID).Name + "] "); } if (!string.IsNullOrEmpty(HtmlOut.ToString())) { HtmlOut.Insert(0, "<tr><td colspan=\"7\">"); HtmlOut.Append("</td></tr>"); } return(HtmlOut.ToString()); } return(string.Empty); }
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); }
protected void DeleteButton_Click(object sender, EventArgs e) { base.CheckAdminPower("DeleteKPI", PowerCheckType.Single); string intsForm = RequestHelper.GetIntsForm("SelectID"); if (intsForm != string.Empty) { KPIBLL.DeleteKPI(intsForm); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("KPI"), intsForm); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl); } }
protected override void OnPreRender(EventArgs e) { try { KPI objKpi = KPIBLL.GetKPIById(KpiId); decimal currentValue = 0; decimal lowestValue = 0; decimal highestValue = 0; decimal averageValue = 0; decimal progress = 0; decimal trend = 0; bool isTime = objKpi.UnitID == "TIME"; int firstDayOfWeek = Artexacta.App.Configuration.Configuration.GetFirstDayOfWeek(); KPIBLL.GetKpiStats(KpiId, CategoryId, CategoryItemId, firstDayOfWeek, ref currentValue, ref lowestValue, ref highestValue, ref averageValue, ref progress, ref trend); CurrentValueLiteral.Text = GetValue(currentValue, objKpi.UnitID, objKpi.Currency, objKpi.CurrencyUnitID); LowestValueLiteral.Text = GetValue(lowestValue, objKpi.UnitID, objKpi.Currency, objKpi.CurrencyUnitID); HighestValueLiteral.Text = GetValue(highestValue, objKpi.UnitID, objKpi.Currency, objKpi.CurrencyUnitID); AverageLiteral.Text = GetValue(averageValue, objKpi.UnitID, objKpi.Currency, objKpi.CurrencyUnitID); ProgressLiteral.Text = progress == decimal.MinValue ? "-" : progress != 0 ? progress.ToString(CultureInfo.InvariantCulture) + "%": "0%"; if (trend < 0) { IconLabel.CssClass = "text-danger"; IconLabel.Text = "<i class='zmdi zmdi-long-arrow-down zmdi-hc-fw'></i>"; TrendLiteral.Text = Resources.Kpi.DownLabel; } else if (trend > 0) { IconLabel.CssClass = "text-success"; IconLabel.Text = "<i class='zmdi zmdi-long-arrow-up zmdi-hc-fw'></i>"; TrendLiteral.Text = Resources.Kpi.UpLabel; } else { IconLabel.Text = "-"; TrendLiteral.Text = Resources.KpiStats.NoChangesLabel; PeriodLiteral.Text = objKpi.ReportingUnitName.ToLower(); return; } TrendPercentageLiteral.Text = Math.Abs(trend).ToString() + " %"; PeriodLiteral.Text = objKpi.ReportingUnitName.ToLower(); } catch (Exception ex) { log.Error("Error getting stats for KPI", ex); } }
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; } }
protected override void PostBack() { KPIInfo kpiClass = new KPIInfo(); kpiClass.ID = ID; kpiClass.CompanyID = RequestHelper.GetForm <int>("CompanyID"); kpiClass.ParentId = RequestHelper.GetForm <int>("ClassID"); kpiClass.Name = StringHelper.AddSafe(RequestHelper.GetForm <string>("Name")); kpiClass.EvaluateInfo = StringHelper.AddSafe(RequestHelper.GetForm <string>("Introduction")); kpiClass.Method = StringHelper.AddSafe(RequestHelper.GetForm <string>("Method")); kpiClass.Type = (KPIType)RequestHelper.GetForm <int>("Type"); int score = RequestHelper.GetForm <int>("Score"); if (score > 0) { kpiClass.Scorse = (float)score; } else { kpiClass.Scorse = 0; } kpiClass.Sort = RequestHelper.GetForm <int>("Sort"); string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (kpiClass.ID == int.MinValue) { base.CheckUserPower("AddKPI", PowerCheckType.Single); int id = KPIBLL.AddKPI(kpiClass); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("KPI"), id); } else { base.CheckUserPower("UpdateKPI", PowerCheckType.Single); KPIBLL.UpdateKPI(kpiClass); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("KPI"), kpiClass.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } string returnURL = ServerHelper.UrlDecode(RequestHelper.GetQueryString <string>("ReturnURL")); if (string.IsNullOrEmpty(returnURL)) { ScriptHelper.Alert(alertMessage, "/User/KPIAdd.aspx?CompanyID=" + kpiClass.CompanyID.ToString() + "&ClassID=" + kpiClass.ParentId.ToString()); } else { ScriptHelper.Alert(alertMessage, returnURL); } }
protected void SubmitButton_Click(object sender, EventArgs e) { KPIInfo kpiCate = new KPIInfo(); CompanyID = RequestHelper.GetForm <int>("CompanyId"); if (CompanyID < 0) { ScriptHelper.Alert("请重新选择公司"); } kpiCate.CompanyID = CompanyID; kpiCate.ID = RequestHelper.GetQueryString <int>("ID"); if (string.IsNullOrEmpty(FatherID.Text)) { ScriptHelper.Alert("请选择分类"); } kpiCate.ParentId = Convert.ToInt32(FatherID.SelectedValue); kpiCate.Sort = Convert.ToInt32(Sort.Text); kpiCate.Name = ClassName.Text; kpiCate.EvaluateInfo = Introduction.Text;// string.Empty; kpiCate.Method = Method.Text; kpiCate.Type = (KPIType)int.Parse(Type.Text); if (!string.IsNullOrEmpty(Score.Text)) { kpiCate.Scorse = float.Parse(Score.Text); } else { kpiCate.Scorse = 0; } string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (kpiCate.ID == int.MinValue) { base.CheckAdminPower("AddKPI", PowerCheckType.Single); int id = KPIBLL.AddKPI(kpiCate); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("KPI"), id); ScriptHelper.Alert(alertMessage, Request.Url.AbsolutePath + "?CompanyId=" + kpiCate.CompanyID.ToString() + "&ParentID=" + kpiCate.ParentId.ToString()); } else { base.CheckAdminPower("UpdateKPI", PowerCheckType.Single); KPIBLL.UpdateKPI(kpiCate); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("KPI"), kpiCate.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); ScriptHelper.Alert(alertMessage, base.Server.UrlDecode(RequestHelper.GetQueryString <string>("ReturnUrl"))); } }
protected void KpiRepeater_ItemCommand(object source, RepeaterCommandEventArgs e) { int kpiId = 0; try { kpiId = Convert.ToInt32(e.CommandArgument); } catch (Exception ex) { log.Error("Error getting object id", ex); } if (kpiId <= 0) { SystemMessages.DisplaySystemErrorMessage(Resources.Organization.MessageNoComplete); return; } if (e.CommandName == "Restore") { try { TrashBLL.RestoreTrash(KpiHF.Value, kpiId); } catch (Exception ex) { SystemMessages.DisplaySystemErrorMessage(ex.Message); return; } KpiRepeater.DataBind(); } if (e.CommandName == "DeleteKpi") { try { KPIBLL.DeletePermanentlyKPI(kpiId); } catch (Exception ex) { SystemMessages.DisplaySystemErrorMessage(ex.Message); return; } KpiRepeater.DataBind(); } }
private void LoadKPI() { if (KPIId > 0 && DataTypeHiddenField.Value.Equals("KPI")) { KPI theData = null; try { theData = KPIBLL.GetKPIById(KPIId); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); } if (theData != null) { if (theData.OrganizationID > 0) { pnlKPIEnabled.Style["display"] = "block"; pnlKPIDisabled.Style["display"] = "none"; } else { pnlKPIEnabled.Style["display"] = "none"; pnlKPIDisabled.Style["display"] = "block"; } if (theData.AreaID > 0 || theData.ProjectID > 0 || theData.ActivityID > 0 || theData.PersonID > 0) { pnlKPIData.Style["display"] = "block"; } else { pnlKPIData.Style["display"] = "none"; } OrganizationId = theData.OrganizationID; AreaId = theData.AreaID; ProjectId = theData.ProjectID; ActivityId = theData.ActivityID; PersonId = theData.PersonID; } } }
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; } } }
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; } }
private void LoadData() { //-- verify is user is OWNER PermissionObject theUser = new PermissionObject(); try { theUser = PermissionObjectBLL.GetPermissionsByUser(PermissionObject.ObjectType.KPI.ToString(), Convert.ToInt32(KPIIdHiddenField.Value)); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); Response.Redirect("~/Kpi/KpiList.aspx"); } if (theUser == null || !theUser.TheActionList.Exists(i => i.ObjectActionID.Equals("OWN"))) { SystemMessages.DisplaySystemWarningMessage(Resources.ShareData.UserNotOwnKpi); Response.Redirect("~/Kpi/KpiList.aspx"); } //-- show Data KPI theData = null; try { theData = KPIBLL.GetKPIById(Convert.ToInt32(KPIIdHiddenField.Value)); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); Response.Redirect("~/Kpi/KpiList.aspx"); } if (theData != null) { KPINameLiteral.Text = theData.Name; } }
private void LoadKPI() { if (KPIId > 0 && DataTypeHiddenField.Value.Equals("KPI")) { KPI theData = null; try { theData = KPIBLL.GetKPIById(KPIId); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); } if (theData != null) { OrganizationId = theData.OrganizationID; AreaId = theData.AreaID; ProjectId = theData.ProjectID; ActivityId = theData.ActivityID; PersonId = theData.PersonID; } } }
protected string GetTrHtml(List <KPIInfo> kpiList) { StringBuilder trHtml = new StringBuilder(); int i = 1; foreach (KPIInfo info in kpiList) { trHtml.AppendLine("<tr data-type=\"" + info.ParentId + "\" class=\"listTableMain\" onmousemove=\"changeColor(this,'#FFFDD7')\" onmouseout=\"changeColor(this,'#FFF')\">"); if (i == 1) { trHtml.AppendLine(" <td rowspan=\"" + kpiList.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>"); } trHtml.AppendLine(" <td class=\"choose\">" + info.Method + "</td>"); trHtml.AppendLine(" <td class=\"evaluation_content choose\" data-id=\"" + info.ID.ToString() + "\">" + i.ToString() + "." + info.Name + "</td>"); trHtml.Append(" <td class=\"choose\">"); if (info.CompanyID == 0) { trHtml.Append("系统指标"); } else if (info.CompanyID == _companyId) { trHtml.Append(Company.CompanySimpleName); } else { trHtml.Append(CompanyBLL.ReadCompany(info.CompanyID).CompanySimpleName); } trHtml.Append("</td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine("</tr>"); i++; } return(trHtml.ToString()); }
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> </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> </td>"); } } if (num == 0) { tableContent.Append("<td> </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> </td></tr>"); } } } }
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; } } } } }
private void CreateKPI(int organizationID, int areaID, int projectID, int activityID, int personID) { PopulateDatabaseDSTableAdapters.QueriesTableAdapter qta = new PopulateDatabaseDSTableAdapters.QueriesTableAdapter(); int kpisToGenerate = r.Next(0, Convert.ToInt32(KPIDropDownList.SelectedValue)); for (int i = 0; i < kpisToGenerate; i++) { KPITest theTest = kpiTests[r.Next(0, kpiTests.Count)]; // Randomply select a test KPI bool hasTarget = r.Next(0, 10) < Convert.ToInt32(KPITargetsDropDownList.SelectedValue) ? true : false; // 60% of the time the KPI has a target bool hasCategories = r.Next(0, 10) < Convert.ToInt32(KPICategoriesDropDownList.SelectedValue) ? true : false; // 80% of the time the KPI doesn not have a target int noCategories = r.Next(1, Convert.ToInt32(CategoriesDropDownList.SelectedValue)); List <Category> cat = new List <Category>(); decimal? target = null; if (hasCategories) { for (int j = 0; j < noCategories; j++) { List <CategoryItem> items = new List <CategoryItem>(); foreach (CategoryItem catItem in categories[j].Items) { decimal?cattarget = null; if (hasTarget) { cattarget = (Decimal)(r.NextDouble() * 500); } items.Add(new CategoryItem(catItem.ItemID, catItem.ItemName, cattarget)); } cat.Add(new Category(categories[j].ID, categories[j].ID, items)); } } if (hasTarget && !hasCategories) { target = (Decimal)(r.NextDouble() * 500); } DateTime startDate = DateTime.MinValue; if (hasTarget) { startDate = DateTime.Today.Subtract(new TimeSpan(r.Next(5, 350), 0, 0, 0, 0)); } string unitID = ""; switch (theTest.Type) { case "GENINT": unitID = "INT"; break; case "GENPER": unitID = "PERCENT"; break; case "GENTIME": unitID = "TIME"; break; case "GENDEC": unitID = "DECIMAL"; break; default: unitID = ""; break; } string reportUnit = reportingUnits[r.Next(0, reportingUnits.Length)]; int currencyIndex = r.Next(0, currencies.Length); int kpiID = KPIBLL.CreateKPI(organizationID, areaID, projectID, activityID, personID, theTest.Name, unitID, theTest.Direction, theTest.Strategy, startDate, reportUnit, hasTarget ? r.Next(0, 350) : 0, currencies[currencyIndex].Currency, currencies[currencyIndex].Unit, theTest.Type, cat.ToArray(), target, currentUsers[r.Next(0, currentUsers.Length)]); // Make between 0 and X people owners of the KPI string[] owners = GetRandomSetOfUsers(r.Next(0, Convert.ToInt32(AllowedOwnDropDownList.SelectedValue) + 1), null); foreach (string myOwner in owners) { qta.InsertObjectPermissions("KPI", kpiID, myOwner, "OWN"); } bool allowAllViewKPIs = false; // X% of the time we will allow Everyone to view the KPI allowAllViewKPIs = (r.Next(0, 100) < Convert.ToInt32(PublicKPIDropDownList.SelectedValue)); if (allowAllViewKPIs) { qta.InsertObjectPublic("KPI", kpiID, "VIEW_KPI"); } // Get between 0 and X random people to give them permissons to View or Enter Data on this object string[] others = GetRandomSetOfUsers(r.Next(0, Convert.ToInt32(AllowedViewKPIDropdownList.SelectedValue) + 1), owners); foreach (string myOthers in others) { StringBuilder permissions = new StringBuilder(); // Get the permissons that we will give them. They can be one of // of VIEW_KPI or ENTER_DATA but not both. VIEW_KPI cannot be added // if these permissons are public as above. // 50% of the time give them VIEW_KPI if (r.Next(0, 100) < 10 && !allowAllViewKPIs) { permissions.Append("VIEW_KPI"); } else if ((r.Next(0, 100) < 50)) { // and if we did not give them VIEW_KPI 50% of the time we will give them ENTER_DATA permissions.Append("ENTER_DATA"); } if (permissions.Length > 0) { qta.InsertObjectPermissions("KPI", kpiID, myOthers, permissions.ToString()); } } // X% of the time, lets generate data for the KPI if (r.Next(0, 10) < Convert.ToInt32(MeasurementsDropDownList.SelectedValue)) { List <KPIMeasurement> measurements = new List <KPIMeasurement>(); int reportPeriods = r.Next(0, Convert.ToInt32(MeasurementsToGenerateDropDownList.SelectedValue)); // Generate MAX X reports for (int j = 0; j < reportPeriods; j++) { if (hasCategories) { foreach (Category catX in cat) { foreach (CategoryItem catXItem in catX.Items) { measurements.Add( new KPIMeasurement( kpiID, DateTime.Today.Subtract(new TimeSpan(r.Next(0, 300), 0, 0, 0)), GenerateMeasurement(theTest.Type), catX.ID, catXItem.ItemID)); } } } else { measurements.Add( new KPIMeasurement( kpiID, DateTime.Today.Subtract(new TimeSpan(r.Next(0, 300), 0, 0, 0)), GenerateMeasurement(theTest.Type), "", "")); } } KPIBLL.InsertKPIMeasurements(measurements); } } }
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; } } }
protected void KpisGridView_RowCommand(object sender, GridViewCommandEventArgs e) { int kpiId = 0; try { kpiId = Convert.ToInt32(e.CommandArgument); } catch (Exception ex) { log.Error(Resources.Kpi.MessageErrorKpiID, ex); } if (kpiId <= 0) { SystemMessages.DisplaySystemErrorMessage(Resources.Kpi.MessageNotAction); return; } if (e.CommandName == "ViewKpi") { Session["KpiId"] = kpiId.ToString(); Session["SEARCH_PARAMETER"] = KPISearchControl.Query; Response.Redirect("~/Kpis/KpiDetails.aspx"); } if (e.CommandName == "EditKpi") { Session["KPI_ID"] = kpiId.ToString(); Response.Redirect("~/Kpi/KpiForm.aspx"); } if (e.CommandName == "ShareKpi") { Session["KPIID"] = kpiId.ToString(); Response.Redirect("~/Kpi/ShareKpi.aspx"); } if (e.CommandName == "ListValuesKpi") { Session["KPIID"] = kpiId.ToString(); Response.Redirect("~/Kpi/ImportData.aspx"); } if (e.CommandName == "ViewOrganization") { Session["SEARCH_PARAMETER"] = "@organizationID " + kpiId.ToString(); Response.Redirect("~/Organization/ListOrganizations.aspx"); } if (e.CommandName == "ViewProject") { Session["SEARCH_PARAMETER"] = "@projectID " + kpiId.ToString(); Response.Redirect("~/Project/ProjectList.aspx"); } if (e.CommandName == "ViewArea") { Session["OrganizationId"] = kpiId.ToString(); Response.Redirect("~/Organization/EditOrganization.aspx"); } if (e.CommandName == "DeleteKpi") { try { KPIBLL.DeleteKPI(kpiId); } catch (Exception ex) { SystemMessages.DisplaySystemErrorMessage(ex.Message); return; } KpisGridView.DataBind(); } }
public void BuildChart() { int kpiId = KpiId; string strategyId = ""; string startingPeriod = ""; string endingPeriod = ""; decimal target = 0; int firstDayOfWeek = Artexacta.App.Configuration.Configuration.GetFirstDayOfWeek(); List <KpiChartData> measurements = KpiMeasurementBLL.GetKPIMeasurementForChart(kpiId, CategoryId, CategoryItemId, firstDayOfWeek, ref strategyId, ref target, ref startingPeriod, ref endingPeriod); Dictionary <string, object> standardSerie = new Dictionary <string, object>(); Dictionary <string, object> targetStandardSerie = new Dictionary <string, object>(); Dictionary <string, object> sumSerie = new Dictionary <string, object>(); Dictionary <string, object> targetSumSerie = new Dictionary <string, object>(); KPI objKpi = KPIBLL.GetKPIById(kpiId); bool hasTarget = target != -1; bool isSum = strategyId == "SUM"; bool isTargetUsable = false; //bool isSerieUsable = false; decimal sumMeasurement = 0; decimal sumTarget = 0; foreach (var item in measurements) { //if (!string.IsNullOrEmpty(startingPeriod) && item.Period == startingPeriod) // isSerieUsable = true; //if (isSerieUsable) standardSerie.Add(item.Period, item.Measurement); //else // standardSerie.Add(item.Period, null); if (isSum) { sumMeasurement = sumMeasurement + item.Measurement; //if (isSerieUsable) sumSerie.Add(item.Period, sumMeasurement); //else // sumSerie.Add(item.Period, null); if (hasTarget) { if (!string.IsNullOrEmpty(startingPeriod) && item.Period == startingPeriod) { isTargetUsable = true; } if (!string.IsNullOrEmpty(endingPeriod) && item.Period == endingPeriod) { isTargetUsable = false; } if (isTargetUsable) { sumTarget = sumTarget + target; targetSumSerie.Add(item.Period, sumTarget); } else { targetSumSerie.Add(item.Period, null); } } } if (hasTarget) { if (!string.IsNullOrEmpty(startingPeriod) && item.Period == startingPeriod) { isTargetUsable = true; } if (!string.IsNullOrEmpty(endingPeriod) && item.Period == endingPeriod) { isTargetUsable = false; } if (isTargetUsable) { targetStandardSerie.Add(item.Period, target); } else { targetStandardSerie.Add(item.Period, null); } } } List <Series> series = new List <Series>(); series.Add(new Series { Name = Resources.KpiDetails.ValuesLabel, Data = new Data(standardSerie.Values.ToArray <object>()) }); if (hasTarget) { series.Add(new Series { Name = Resources.KpiDetails.KpiTargetLabel, Color = System.Drawing.Color.Red, Data = new Data(targetStandardSerie.Values.ToArray <object>()) }); } DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts(ClientID) .InitChart(new Chart() { Type = ChartTypes.Line }) .SetTitle(new Title() { Text = "" }) .SetXAxis(new XAxis { Categories = standardSerie.Keys.ToArray <string>() }) .SetSeries(series.ToArray()) .SetLegend(new Legend() { Layout = Layouts.Horizontal, Align = HorizontalAligns.Center, VerticalAlign = VerticalAligns.Bottom, BorderWidth = 0 }); if (objKpi.UnitID != "TIME") { //chart.SetTooltip(new Tooltip() //{ // ValueSuffix = " " + objKpi.uni.ToLower() + "s" //}); } else { chart.SetTooltip(new Tooltip() { Formatter = "function (){" + "return decimalToYYMMDDhhmm(this.y).toString('" + Resources.DataTime.YearsValueSingle + "','" + Resources.DataTime.YearsValue + "'," + "'" + Resources.DataTime.MonthsValueSingle + "'," + "'" + Resources.DataTime.MonthsValue + "'," + "'" + Resources.DataTime.DaysValueSingle + "'," + "'" + Resources.DataTime.DaysValue + "'," + "'" + Resources.DataTime.HoursValueSingle + "'," + "'" + Resources.DataTime.HoursValue + "'," + "'" + Resources.DataTime.MinutesValueSingle + "'," + "'" + Resources.DataTime.MinutesValue + "');" + "}" }); } ChartLiteral.Text = chart.ToHtmlString(); if (isSum) { series = new List <Series>(); series.Add(new Series { Name = Resources.KpiDetails.ValuesLabel, Data = new Data(sumSerie.Values.ToArray <object>()) }); if (hasTarget) { series.Add(new Series { Name = Resources.KpiDetails.KpiTargetLabel, Color = System.Drawing.Color.Red, Data = new Data(targetSumSerie.Values.ToArray <object>()) }); } chart = new DotNet.Highcharts.Highcharts(ClientID + "_sum") .InitChart(new Chart() { Type = ChartTypes.Line }) .SetTitle(new Title() { Text = "" }) .SetXAxis(new XAxis { Categories = standardSerie.Keys.ToArray <string>() }) .SetSeries(series.ToArray()) .SetLegend(new Legend() { Layout = Layouts.Horizontal, Align = HorizontalAligns.Center, VerticalAlign = VerticalAligns.Bottom, BorderWidth = 0 }); if (objKpi.UnitID != "TIME") { //chart.SetTooltip(new Tooltip() //{ // ValueSuffix = " " + objKpi.uni.ToLower() + "s" //}); } else { chart.SetTooltip(new Tooltip() { Formatter = "function (){" + "return decimalToYYMMDDhhmm(this.y).toString('" + Resources.DataTime.YearsValueSingle + "','" + Resources.DataTime.YearsValue + "'," + "'" + Resources.DataTime.MonthsValueSingle + "'," + "'" + Resources.DataTime.MonthsValue + "'," + "'" + Resources.DataTime.DaysValueSingle + "'," + "'" + Resources.DataTime.DaysValue + "'," + "'" + Resources.DataTime.HoursValueSingle + "'," + "'" + Resources.DataTime.HoursValue + "'," + "'" + Resources.DataTime.MinutesValueSingle + "'," + "'" + Resources.DataTime.MinutesValue + "');" + "}" }); } SumChartLiteral.Text = chart.ToHtmlString(); SumChartPanel.Visible = true; } }
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"); } }
private void LoadData() { //-- verify is user has permissions PermissionObject theUser = new PermissionObject(); try { theUser = PermissionObjectBLL.GetPermissionsByUser(PermissionObject.ObjectType.KPI.ToString(), Convert.ToInt32(KPIIdHiddenField.Value)); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); Response.Redirect("~/Kpi/KpiList.aspx"); } if (theUser == null) { SystemMessages.DisplaySystemWarningMessage(Resources.ShareData.UserNotOwnKpi); Response.Redirect("~/Kpi/KpiList.aspx"); } if (theUser.TheActionList.Exists(i => i.ObjectActionID.Equals("OWN"))) { pnlUploadFile.Visible = true; pnlEnterData.Visible = false; KpiMeasurementGridView.Columns[0].Visible = true; } else if (theUser.TheActionList.Exists(i => i.ObjectActionID.Equals("ENTER_DATA"))) { pnlUploadFile.Visible = true; pnlEnterData.Visible = false; KpiMeasurementGridView.Columns[0].Visible = false; } else if (theUser.TheActionList.Exists(i => i.ObjectActionID.Equals("VIEW_KPI"))) { pnlUploadFile.Visible = false; pnlEnterData.Visible = false; KpiMeasurementGridView.Columns[0].Visible = false; } else { SystemMessages.DisplaySystemWarningMessage(Resources.ShareData.UserNotOwnKpi); Response.Redirect("~/Kpi/KpiList.aspx"); } //-- show Data KPI theData = null; try { theData = KPIBLL.GetKPIById(Convert.ToInt32(KPIIdHiddenField.Value)); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); Response.Redirect("~/Kpi/KpiList.aspx"); } if (theData != null) { SubtitleLabel.Text = theData.Name; KPIType.Text = theData.KPITypeName; ReportingPeriod.Text = theData.ReportingUnitName; StartingDate.Text = theData.StartDate == DateTime.MinValue ? " - " : TextUtilities.GetDateTimeToString(theData.StartDate); UnitIdHiddenField.Value = theData.UnitID; CurrencyHiddenField.Value = theData.Currency; CurrencyUnitHiddenField.Value = theData.CurrencyUnitForDisplay; switch (UnitIdHiddenField.Value) { case "TIME": DataDescriptionLabel.Text = Resources.ImportData.TimeDataDescription; break; case "INT": DataDescriptionLabel.Text = Resources.ImportData.IntegerDataDescription; break; default: DataDescriptionLabel.Text = Resources.ImportData.DecimalDataDescription; break; } BindGridView(); } }
public void BuildChart() { bool hasTarget = true; decimal currentValue = 0; int firstDayOfWeek = Artexacta.App.Configuration.Configuration.GetFirstDayOfWeek(); decimal progress = KPIBLL.GetKpiProgress(KpiId, CategoryId, CategoryItemId, firstDayOfWeek, ref hasTarget, ref currentValue); if (!hasTarget) { CurrentValueLiteral.Text = currentValue.ToString(CultureInfo.InvariantCulture); CurrentValuePanel.Visible = true; return; } DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts(ClientID) .InitChart(new Chart() { Type = ChartTypes.Gauge, PlotBackgroundColor = null, PlotBackgroundImage = null, PlotBorderWidth = 0, PlotShadow = false }) .SetTitle(new Title() { Text = "" }) .SetTooltip(new Tooltip() { ValueSuffix = "%" }) .SetPane(new Pane() { StartAngle = -150, EndAngle = 150, Background = new DotNet.Highcharts.Helpers.BackgroundObject[] { new DotNet.Highcharts.Helpers.BackgroundObject() { BackgroundColor = new DotNet.Highcharts.Helpers.BackColorOrGradient(new DotNet.Highcharts.Helpers.Gradient() { LinearGradient = new int[] { 0, 0, 0, 1 }, Stops = new object[, ] { { 0, "#FFF" }, { 1, "#333" } } }), BorderWidth = new DotNet.Highcharts.Helpers.PercentageOrPixel(1), OuterRadius = new DotNet.Highcharts.Helpers.PercentageOrPixel(109, true) }, new DotNet.Highcharts.Helpers.BackgroundObject() { BackgroundColor = new DotNet.Highcharts.Helpers.BackColorOrGradient(new DotNet.Highcharts.Helpers.Gradient() { LinearGradient = new int[] { 0, 0, 0, 1 }, Stops = new object[, ] { { 0, "#FFF" }, { 1, "#333" } } }), BorderWidth = new DotNet.Highcharts.Helpers.PercentageOrPixel(1), OuterRadius = new DotNet.Highcharts.Helpers.PercentageOrPixel(107, true) }, new DotNet.Highcharts.Helpers.BackgroundObject() , new DotNet.Highcharts.Helpers.BackgroundObject() { BackgroundColor = new DotNet.Highcharts.Helpers.BackColorOrGradient(ColorTranslator.FromHtml("#DDD")), BorderWidth = new DotNet.Highcharts.Helpers.PercentageOrPixel(0), OuterRadius = new DotNet.Highcharts.Helpers.PercentageOrPixel(105, true), InnerRadius = new DotNet.Highcharts.Helpers.PercentageOrPixel(103, true) } } }).SetYAxis(new YAxis() { Min = 0, Max = 100, MinorTickWidth = 1, MinorTickLength = 10, MinorTickPosition = TickPositions.Inside, MinorTickColor = ColorTranslator.FromHtml("#666"), TickPixelInterval = 30, TickWidth = 2, TickPosition = TickPositions.Inside, TickLength = 10, TickColor = ColorTranslator.FromHtml("#666"), Labels = new YAxisLabels() { Step = 2 }, Title = new YAxisTitle() { Text = "%" }, PlotBands = new YAxisPlotBands[] { new YAxisPlotBands() { From = 0, To = 33, Color = ColorTranslator.FromHtml("#DF5353") }, new YAxisPlotBands() { From = 33, To = 66, Color = ColorTranslator.FromHtml("#DDDF0D") }, new YAxisPlotBands() { From = 66, To = 100, Color = ColorTranslator.FromHtml("#55BF3B") } } }) .SetSeries(new Series() { Name = Resources.KpiDetails.CompleteLabel, Data = new DotNet.Highcharts.Helpers.Data(new object[] { progress }) }); ChartLiteral.Text = chart.ToHtmlString(); }
protected string GetTrHtml(List <KPIInfo> kpiList) { StringBuilder trHtml = new StringBuilder(); int i = 1; foreach (KPIInfo info in kpiList) { trHtml.AppendLine("<tr data-type=\"" + info.ParentId + "\">"); if (i == 1) { trHtml.AppendLine(" <td rowspan=\"" + kpiList.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>"); } trHtml.AppendLine(" <td class=\"choose\">" + info.Method + "</td>"); trHtml.AppendLine(" <td class=\"evaluation_content choose\" data-id=\"" + info.ID.ToString() + "\">" + i.ToString() + "." + info.Name + "</td>"); //trHtml.AppendLine(" <td class=\"choose\">" + ((info.CompanyID == 0) ? "系统指标" : CompanyBLL.ReadCompany(info.CompanyID).CompanySimpleName) + "</td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine("</tr>"); i++; } return(trHtml.ToString()); }