123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using LYFZ.WeixinServiceDate.DAL;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- namespace LYFZ.WeixinServers.DZKJ
- {
- public partial class DZKJTaskOneView : System.Web.UI.Page
- {
- public System.Text.StringBuilder TaskStatisticsViewListHtmlTb = new System.Text.StringBuilder();
- public string PagingInfoHtml = "";
- string Account = "";
- public string CompanyName = "";
- // string Token = "";
- int viewtype = -1;
- DateTime ExecDate = DateTime.Now;
- DAL_DZKJ_TaskExecutionStatistics dzkjTaskDal = new DAL_DZKJ_TaskExecutionStatistics();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Request.QueryString["viewtype"] != null)
- {
- try
- {
- viewtype = Convert.ToInt32(Request.QueryString["viewtype"].ToString());
- }
- catch { }
- }
- string ManagerProgramVersion = "爆客系统V1.8.3.1或更低";
- string SmallEifVersion = "小精灵V1.3.3或更低";
- if (Request.QueryString["Account"] != null)
- {
- Account = Request.QueryString["Account"].ToString();
- try
- {
- DataRow dzkjRow = Global.DZKJ_CustomerAccountDataTable.Rows.Find(Account);
- if (dzkjRow != null)
- {
- CompanyName = dzkjRow["CompanyName"].ToString();
- if (dzkjRow["ManagerProgramVersion"] != null && dzkjRow["ManagerProgramVersion"].ToString().Trim().Length > 1)
- {
- ManagerProgramVersion = "爆客系统V" + dzkjRow["ManagerProgramVersion"].ToString();
- }
- if (dzkjRow["SmallEifVersion"] != null && dzkjRow["SmallEifVersion"].ToString().Trim().Length > 1)
- {
- SmallEifVersion = "小精灵" + dzkjRow["SmallEifVersion"].ToString();
- }
- }
- }
- catch {
- CompanyName = "未知企业名";
- }
- }
-
- switch (viewtype)
- {
- case 0: CompanyName = CompanyName + " <br />帐号: 【" + Account + "】 <br />时间:" + ExecDate.ToString("yyyy年") + " <br />版本号:" + ManagerProgramVersion + "/"+SmallEifVersion+" 统计"; break;
- case 1: CompanyName = CompanyName + " <br />帐号: 【" + Account + "】 <br />时间:" + ExecDate.ToString("yyyy年MM月") + " <br />版本号:" + ManagerProgramVersion + "/" + SmallEifVersion + " 统计"; break;
- case 2: CompanyName = CompanyName + " <br />帐号: 【" + Account + "】 <br />时间:" + ExecDate.ToString("yyyy年MM月dd日") + " <br />版本号:" + ManagerProgramVersion + "/" + SmallEifVersion + " 统计"; break;
- }
- try
- {
- if (Request.QueryString["ExecDate"] != null)
- {
- ExecDate = Convert.ToDateTime(Request.QueryString["ExecDate"].ToString());
- }
- }
- catch { }
- System.Data.DataTable tb = dzkjTaskDal.GetTaskExecutionOneDataTable(viewtype, ExecDate, Account);
- if (tb != null)
- {
- if (tb.Rows.Count > 0)
- {
- float maxExecutionCount = 0;
- if (tb.Rows[0]["ExecutionCount"] != null && !string.IsNullOrEmpty(tb.Rows[0]["ExecutionCount"].ToString()))
- {
- maxExecutionCount = Convert.ToInt32(tb.Rows[0]["ExecutionCount"].ToString());
- }
- if (maxExecutionCount > 10000)
- {
- maxExecutionCount = maxExecutionCount+1000;
- }
- else if (maxExecutionCount > 1000 && maxExecutionCount <= 10000)
- {
- maxExecutionCount = maxExecutionCount + 100;
- }
- else if (maxExecutionCount > 100 && maxExecutionCount <= 1000)
- {
- maxExecutionCount = maxExecutionCount + 10;
- }
-
- else if (maxExecutionCount <= 100)
- {
- maxExecutionCount = 100;
- }
- foreach (DataRow row in tb.Rows)
- {
- float ExecutionCount = 0;
- if (row["ExecutionCount"] != null && !string.IsNullOrEmpty(row["ExecutionCount"].ToString()))
- {
- ExecutionCount = Convert.ToInt32(row["ExecutionCount"].ToString());
- }
- float percentage = Convert.ToSingle((ExecutionCount / maxExecutionCount) * 100);
- /* if (ExecutionCount > 0 && percentage <= 0)
- {
- percentage = 1;
- }*/
- TaskStatisticsViewListHtmlTb.Append("<tr>"
- + " <td>" + row["Features"].ToString() + "</td>"
- + " <td>" + ExecutionCount.ToString() + "</td>"
- + " <td><div style=\"width:100%;height:16px; background-color:rgba(189, 246, 189, 0.1)\"><div style=\"width:" + percentage.ToString("n6") + "%;height:16px; background-color:green;\"></div></div></td>"
- + " </tr>");
- }
- }
- else {
- TaskStatisticsViewListHtmlTb.Append("<tr>"
- + " <td>当前时间内未使用</td>"
- + " <td></td>"
- + " <td></td>"
- + " <td></td>"
- + " </tr>");
- }
- }
- else {
- TaskStatisticsViewListHtmlTb.Append("<tr>"
- + " <td>数据查询失败</td>"
- + " <td></td>"
- + " <td></td>"
- + " <td></td>"
- + " </tr>");
- }
- }
- }
- }
|