市长热线演示版

QcResultList.aspx.cs 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.qualitymanage
  9. {
  10. public partial class QcResultList : System.Web.UI.Page
  11. {
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-01");
  15. txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
  16. if (!this.IsPostBack)
  17. {
  18. DataTable dt = DBUtility.DbHelperSQL.Query("select F_DeptId,F_DeptName,F_Remark from T_Sys_Department where F_ParentId!=0 and F_State=0").Tables[0];
  19. this.dtDpt.DataTextField = "F_DeptName";
  20. this.dtDpt.DataValueField = "F_DeptId";
  21. this.dtDpt.DataSource = dt;
  22. this.dtDpt.DataBind();
  23. this.dtDpt.Items.Insert(0, new ListItem("请选择"));
  24. this.dtDpt.SelectedIndex = 0;
  25. }
  26. }
  27. public string GetColoms()
  28. {
  29. string strColom = "";
  30. DataSet ds = DBUtility.DbHelperSQL.Query("select F_CategoryId,F_CategoryName,F_ParentId from T_QC_IndexCategory where F_DeleteFlag=0 order by F_CategoryId asc");
  31. DataTable dsConten = DBUtility.DbHelperSQL.Query("select F_IndexId,F_Content,F_Score,F_CategoryId from T_QC_IndexBase order by F_IndexId asc").Tables[0];
  32. if (ds != null && ds.Tables.Count > 0)
  33. {
  34. DataTable dt = ds.Tables[0];
  35. DataRow[] drlist = dt.Select("F_ParentId=0");
  36. if(drlist!=null)
  37. {
  38. for (int i = 0; i < drlist.Length; i++)
  39. {
  40. strColom += "{ display: '" + drlist[i]["F_CategoryName"] + "' ";
  41. DataRow[] drlistnew = dt.Select("F_ParentId=" + drlist[i]["F_CategoryId"]);
  42. if (drlistnew != null && drlist.Length > 0)
  43. {
  44. strColom += ",columns:[";
  45. for (int n = 0; n < drlistnew.Length; n++)
  46. {
  47. strColom += "{ display: '" + drlistnew[n]["F_CategoryName"] + "' }";
  48. DataRow[] drContent = dsConten.Select("F_CategoryId=" + drlistnew[n]["F_CategoryId"]);
  49. if (drContent != null && drContent.Length > 0)
  50. {
  51. strColom += ",columns:[";
  52. for (int m = 0; m < drContent.Length; m++)
  53. {
  54. strColom += "{ display: '" + drContent[m]["F_Content"] + "',name: '_fqc" + drContent[m]["F_IndexId"] + "', width: 50 }";
  55. if (m < drContent.Length - 1)
  56. {//最后一个不要逗号
  57. strColom += ",";
  58. }
  59. }
  60. strColom += "] ";
  61. }
  62. if (n <drlistnew.Length - 1)
  63. {//最后一个不要逗号
  64. strColom += ",";
  65. }
  66. }
  67. strColom += "] ";
  68. }
  69. strColom += " },{ display: '分项得分', name: '_item"+i+"', width: 50 },";
  70. }
  71. }
  72. }
  73. return strColom;
  74. }
  75. protected void exportExcel_Click(object sender, EventArgs e)
  76. {
  77. string fileName = "质检报表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
  78. Response.Clear();
  79. Response.Charset = "GB2312";
  80. Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
  81. Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName));
  82. Response.ContentType = "application/ms-excel";
  83. Response.Write(this.htHtmlReport.Value);
  84. Response.End();
  85. }
  86. }
  87. }