市长热线演示版

YearContrastPic.aspx.cs 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. namespace HySoft.BaseCallCenter.Web.reportmanage.operationdata
  9. {
  10. public partial class YearContrastPic : System.Web.UI.Page
  11. {
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. if (!this.IsPostBack)
  15. {
  16. for (int i = 2013; i < 2055; i++)
  17. {
  18. this.dptBgn.Items.Add(new ListItem(i.ToString()));
  19. this.dptEnd.Items.Add(new ListItem(i.ToString()));
  20. }
  21. this.dptBgn.SelectedValue = (System.DateTime.Now.Year - 1).ToString();
  22. this.dptEnd.SelectedValue = System.DateTime.Now.Year.ToString();
  23. }
  24. }
  25. //客户呼叫数
  26. public string GetKhCall(string strtime)
  27. {
  28. DataTable dt = new DataTable();
  29. string str = "";
  30. for (int i = 1; i <= 12; i++)
  31. {
  32. string sqltimeCallRecords = "";
  33. string strmm = i.ToString();
  34. if (i <= 9)
  35. {
  36. strmm = "0" + i;
  37. }
  38. if (strtime != "")
  39. {
  40. sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
  41. sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
  42. }
  43. dt = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct from rep_trunk_call_in where 1=1 " + sqltimeCallRecords).Tables[0];
  44. if (dt != null && dt.Rows.Count > 0)
  45. {
  46. if (dt.Rows[0]["ct"].ToString() != "")
  47. {
  48. str += dt.Rows[0]["ct"].ToString() + ",";
  49. }
  50. else
  51. {
  52. str += "0,";
  53. }
  54. }
  55. else
  56. {
  57. str += "0,";
  58. }
  59. }
  60. if (str != "")
  61. {
  62. str.Remove(str.Length - 1);
  63. }
  64. return str;
  65. }
  66. //坐席接听数
  67. public string GetZxJt(string strtime)
  68. {
  69. DataTable dt = new DataTable();
  70. string str = "";
  71. for (int i = 1; i <= 12; i++)
  72. {
  73. string sqltimeCallRecords = "";
  74. string strmm = i.ToString();
  75. if (i <= 9)
  76. {
  77. strmm = "0" + i;
  78. }
  79. if (strtime != "")
  80. {
  81. sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
  82. sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
  83. }
  84. dt = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct from rep_trunk_call_in where PeriodTalking>0 " + sqltimeCallRecords).Tables[0];
  85. if (dt != null && dt.Rows.Count > 0)
  86. {
  87. if (dt.Rows[0]["ct"].ToString() != "")
  88. {
  89. str += dt.Rows[0]["ct"].ToString() + ",";
  90. }
  91. else
  92. {
  93. str += "0,";
  94. }
  95. }
  96. else
  97. {
  98. str += "0,";
  99. }
  100. }
  101. if (str != "")
  102. {
  103. str.Remove(str.Length - 1);
  104. }
  105. return str;
  106. }
  107. //坐席接听率
  108. public string GetJTL(string strtime)
  109. {
  110. DataTable dt = new DataTable();
  111. string str = "";
  112. for (int i = 1; i <= 12; i++)
  113. {
  114. string sqltimeCallRecords = "";
  115. string strmm = i.ToString();
  116. if (i <= 9)
  117. {
  118. strmm = "0" + i;
  119. }
  120. if (strtime != "")
  121. {
  122. sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)>=CONVERT(varchar , '" + strtime + "-" + strmm + "-01 00:00:01', 120) ";
  123. sqltimeCallRecords += " and CONVERT(varchar , timecallin, 120)<=CONVERT(varchar , '" + strtime + "-" + strmm + "-31 23:59:59', 120) ";
  124. }
  125. dt = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct,(select COUNT(*) from rep_trunk_call_in where PeriodTalking>0 " + sqltimeCallRecords + ") as jt from rep_trunk_call_in where 1=1 " + sqltimeCallRecords).Tables[0];
  126. int ibgnjt = 0;
  127. double ibgnjtl = 0.00;
  128. if (dt != null && dt.Rows.Count > 0)
  129. {
  130. if (dt.Rows[0]["jt"].ToString() != "")
  131. {
  132. ibgnjt = int.Parse(dt.Rows[0]["jt"].ToString());
  133. }
  134. if (dt.Rows[0]["ct"].ToString() != "" && dt.Rows[0]["ct"].ToString() != "0")
  135. {
  136. ibgnjtl = ibgnjt / Convert.ToDouble(dt.Rows[0]["ct"].ToString());
  137. str += (ibgnjtl * 100).ToString("0.00") + ",";
  138. }
  139. else
  140. {
  141. str += "0.00,";
  142. }
  143. }
  144. else
  145. {
  146. str += "0.00,";
  147. }
  148. }
  149. if (str != "")
  150. {
  151. str.Remove(str.Length - 1);
  152. }
  153. return str;
  154. }
  155. }
  156. }