634 lines
		
	
	
		
			21 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			634 lines
		
	
	
		
			21 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Data;
 | ||
| using System.Linq;
 | ||
| using System.Reflection;
 | ||
| using System.Text;
 | ||
| using System.Web.UI.WebControls;
 | ||
| using BLL;
 | ||
| using Model;
 | ||
| using Newtonsoft.Json.Linq;
 | ||
| using AspNet = System.Web.UI.WebControls;
 | ||
| 
 | ||
| namespace FineUIPro.Web.ZHGL.Performance
 | ||
| {
 | ||
|     public partial class PerformanceAllData : PageBase
 | ||
|     {
 | ||
|         #region 定义项
 | ||
|         /// <summary>
 | ||
|         /// 主键
 | ||
|         /// </summary>
 | ||
|         public string PerformanceGid
 | ||
|         {
 | ||
|             get
 | ||
|             {
 | ||
|                 return (string)ViewState["PerformanceGid"];
 | ||
|             }
 | ||
|             set
 | ||
|             {
 | ||
|                 ViewState["PerformanceGid"] = value;
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         public string CompileDateMonth
 | ||
|         {
 | ||
|             get
 | ||
|             {
 | ||
|                 return (string)ViewState["CompileDateMonth"];
 | ||
|             }
 | ||
|             set
 | ||
|             {
 | ||
|                 ViewState["CompileDateMonth"] = value;
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         public string CreateUser
 | ||
|         {
 | ||
|             get
 | ||
|             {
 | ||
|                 return (string)ViewState["CreateUser"];
 | ||
|             }
 | ||
|             set
 | ||
|             {
 | ||
|                 ViewState["CreateUser"] = value;
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|       
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|         #endregion
 | ||
|         protected void Page_Load(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (!IsPostBack)
 | ||
|             {
 | ||
|                 //根据projectid加载CQMS_Performance表中成功的user数据
 | ||
|                 BLL.PerformanceService.InitAllUserDropDownList(drpUser, true);
 | ||
|                 CreateUser = Request.QueryString["CreateUser"];
 | ||
|                 if (!string.IsNullOrEmpty(CreateUser))
 | ||
|                 {
 | ||
|                     drpUser.SelectedValue = CreateUser;
 | ||
|                 }
 | ||
| 
 | ||
|                 drpCompileDateMonth.Text = DateTime.Now.ToString();
 | ||
| 
 | ||
|                 if (drpUser.SelectedValue != BLL.Const._Null)
 | ||
|                 {
 | ||
|                     // BindGrid();
 | ||
|                     //OutputSummaryData();
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|         #region 加载数据
 | ||
|         public class Grid1Model
 | ||
|         {
 | ||
|             public int SortId { get; set; }
 | ||
|             /// <summary>
 | ||
|             /// 时间
 | ||
|             /// </summary>
 | ||
|             public string CreateDateMonth { get; set; }
 | ||
| 
 | ||
|             /// <summary>
 | ||
|             /// 项目名称
 | ||
|             /// </summary>
 | ||
|             public string ProjectName { get; set; }
 | ||
| 
 | ||
|             /// <summary>
 | ||
|             /// 工程范围
 | ||
|             /// </summary>
 | ||
|             public string WorkRange { get; set; }
 | ||
| 
 | ||
|             /// <summary>
 | ||
|             /// 责任人
 | ||
|             /// </summary>
 | ||
|             public string HeadUserid { get; set; }
 | ||
| 
 | ||
|             /// <summary>
 | ||
|             /// 工作负荷
 | ||
|             /// </summary>
 | ||
|             public decimal? Workloads { get; set; }
 | ||
| 
 | ||
|             /// <summary>
 | ||
|             /// 出差天数
 | ||
|             /// </summary>
 | ||
|             public int? OutDay { get; set; }
 | ||
| 
 | ||
|             public decimal? EvaScore1 { get; set; }
 | ||
|             public decimal? EvaScore2 { get; set; }
 | ||
|             public decimal? EvaScore3 { get; set; }
 | ||
|             public decimal? EvaScore4 { get; set; }
 | ||
|             public decimal? EvaScore5 { get; set; }
 | ||
|             public decimal? EvaScore6 { get; set; }
 | ||
| 
 | ||
|             /// <summary>
 | ||
|             /// 总得分
 | ||
|             /// </summary>
 | ||
|             public decimal? SumZdf { get; set; }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 加载数据
 | ||
|         /// </summary>
 | ||
|         private void BindGrid()
 | ||
|         {
 | ||
|             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 //根据年份和查询的人来加载
 | ||
| 
 | ||
|                 //去年12月到今年11月
 | ||
|                 var StartDate = Convert.ToDateTime((Convert.ToInt32(drpCompileDateMonth.Text) - 1).ToString() + "-12");
 | ||
|                 var EndDate = Convert.ToDateTime(drpCompileDateMonth.Text + "-11");
 | ||
| 
 | ||
|                 List<Grid1Model> listGrid1 = new List<Grid1Model>();
 | ||
|                
 | ||
|                 var Plist = db.CQMS_Performance.Where(x => x.CreateDate >= StartDate && x.CreateDate <= EndDate && x.CreateMan == drpUser.SelectedValue
 | ||
|                 && x.States == "1")
 | ||
|                     .OrderBy(x => x.CreateDate).ToList();
 | ||
|                
 | ||
|                 var i = 1;
 | ||
|                 foreach (var item in Plist)
 | ||
|                 {
 | ||
|                     Grid1Model gmodel = new Grid1Model();
 | ||
|                     gmodel.CreateDateMonth = item.CreateDateMonth;
 | ||
|                     gmodel.ProjectName = ProjectService.GetProjectNameByProjectId(item.ProjectId);
 | ||
|                     gmodel.WorkRange = item.WorkRange;
 | ||
|                     gmodel.HeadUserid = item.HeadUserid;
 | ||
|                     gmodel.Workloads = item.Workloads;
 | ||
|                     gmodel.OutDay = item.OutDay;
 | ||
|                     //加载6个得分
 | ||
|                     var Child1List = db.CQMS_Performance_Child1.Where(x => x.PerformanceGid == item.PerformanceGid).OrderBy(x => x.SortIndex).ToList();
 | ||
|                     gmodel.EvaScore1 = Child1List[0].EvaScore;
 | ||
|                     gmodel.EvaScore2 = Child1List[1].EvaScore;
 | ||
|                     gmodel.EvaScore3 = Child1List[2].EvaScore;
 | ||
|                     gmodel.EvaScore4 = Child1List[3].EvaScore;
 | ||
|                     gmodel.EvaScore5 = Child1List[4].EvaScore;
 | ||
|                     gmodel.EvaScore6 = Child1List[5].EvaScore;
 | ||
| 
 | ||
|                     gmodel.SumZdf = gmodel.EvaScore1 + gmodel.EvaScore2 + gmodel.EvaScore3 + gmodel.EvaScore4 + gmodel.EvaScore5 + gmodel.EvaScore6;
 | ||
|                     gmodel.SortId = i;
 | ||
|                     i += 1;
 | ||
|                     listGrid1.Add(gmodel);
 | ||
|                 }
 | ||
|                 if (listGrid1.Count > 0)
 | ||
|                 {
 | ||
|                     var table = ToDataTable<Grid1Model>(listGrid1);
 | ||
|                     Grid1.DataSource = table;
 | ||
|                     Grid1.DataBind();
 | ||
|                     OutputSummaryData();
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     ShowNotify("未查询到数据。", MessageBoxIcon.Warning);
 | ||
|                 }
 | ||
| 
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 合计
 | ||
|         private void OutputSummaryData()
 | ||
|         {
 | ||
|             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
| 
 | ||
|            
 | ||
|             //根据年份和查询的人来加载
 | ||
| 
 | ||
|             //去年12月到今年11月
 | ||
|             var StartDate = Convert.ToDateTime((Convert.ToInt32(drpCompileDateMonth.Text) - 1).ToString() + "-12");
 | ||
|             var EndDate = Convert.ToDateTime(drpCompileDateMonth.Text + "-11");
 | ||
| 
 | ||
|             List<Grid1Model> listGrid1 = new List<Grid1Model>();
 | ||
| 
 | ||
|             var Plist = db.CQMS_Performance.Where(x => x.CreateDate >= StartDate && x.CreateDate <= EndDate && x.CreateMan == drpUser.SelectedValue
 | ||
|             && x.States == "1")
 | ||
|                 .OrderBy(x => x.CreateDate).ToList();
 | ||
| 
 | ||
|             var i = 1;
 | ||
|             foreach (var item in Plist)
 | ||
|             {
 | ||
|                 Grid1Model gmodel = new Grid1Model();
 | ||
|                 gmodel.CreateDateMonth = item.CreateDateMonth;
 | ||
|                 gmodel.ProjectName = ProjectService.GetProjectNameByProjectId(item.ProjectId);
 | ||
|                 gmodel.WorkRange = item.WorkRange;
 | ||
|                 gmodel.HeadUserid = item.HeadUserid;
 | ||
|                 gmodel.Workloads = item.Workloads;
 | ||
|                 gmodel.OutDay = item.OutDay;
 | ||
|                 //加载6个得分
 | ||
|                 var Child1List = db.CQMS_Performance_Child1.Where(x => x.PerformanceGid == item.PerformanceGid).OrderBy(x => x.SortIndex).ToList();
 | ||
|                 gmodel.EvaScore1 = Child1List[0].EvaScore;
 | ||
|                 gmodel.EvaScore2 = Child1List[1].EvaScore;
 | ||
|                 gmodel.EvaScore3 = Child1List[2].EvaScore;
 | ||
|                 gmodel.EvaScore4 = Child1List[3].EvaScore;
 | ||
|                 gmodel.EvaScore5 = Child1List[4].EvaScore;
 | ||
|                 gmodel.EvaScore6 = Child1List[5].EvaScore;
 | ||
| 
 | ||
|                 gmodel.SumZdf = gmodel.EvaScore1 + gmodel.EvaScore2 + gmodel.EvaScore3 + gmodel.EvaScore4 + gmodel.EvaScore5 + gmodel.EvaScore6;
 | ||
|                 gmodel.SortId = i;
 | ||
|                 i += 1;
 | ||
|                 listGrid1.Add(gmodel);
 | ||
|             }
 | ||
|             var table = ToDataTable<Grid1Model>(listGrid1);
 | ||
|             double Workloads = 0.0f;
 | ||
|             int OutDay = 0;
 | ||
|             double SumZdf = 0.0f;
 | ||
|             foreach (DataRow row in table.Rows)
 | ||
|             {
 | ||
|                 var rowWorkloads = row["Workloads"].ToString();
 | ||
|                 if (rowWorkloads == "")
 | ||
|                 {
 | ||
|                     rowWorkloads = "0";
 | ||
|                 }
 | ||
| 
 | ||
|                 var rowSumZdf = row["SumZdf"].ToString();
 | ||
|                 if (rowSumZdf == "")
 | ||
|                 {
 | ||
|                     rowSumZdf = "0";
 | ||
|                 }
 | ||
| 
 | ||
|                 var rowOutDay = row["OutDay"].ToString();
 | ||
|                 if (rowOutDay == "")
 | ||
|                 {
 | ||
|                     rowOutDay = "0";
 | ||
|                 }
 | ||
|                 Workloads += Convert.ToDouble(rowWorkloads);
 | ||
|                 OutDay += Convert.ToInt32(rowOutDay);
 | ||
|                 SumZdf += Convert.ToDouble(rowSumZdf);
 | ||
| 
 | ||
|             }
 | ||
|             JObject summary = new JObject();
 | ||
|             summary.Add("CreateDateMonth", "总计");
 | ||
|             summary.Add("Workloads", Workloads.ToString("F2"));
 | ||
|             summary.Add("OutDay", OutDay.ToString());
 | ||
|             summary.Add("SumZdf", SumZdf.ToString("F2"));
 | ||
| 
 | ||
|             Grid1.SummaryData = summary;
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region list转换datatable
 | ||
|         /// <summary>
 | ||
|         /// Convert a List{T} to a DataTable.
 | ||
|         /// </summary>
 | ||
|         private DataTable ToDataTable<T>(List<T> items)
 | ||
|         {
 | ||
|             var tb = new DataTable(typeof(T).Name);
 | ||
| 
 | ||
|             PropertyInfo[] props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
 | ||
| 
 | ||
|             foreach (PropertyInfo prop in props)
 | ||
|             {
 | ||
|                 Type t = GetCoreType(prop.PropertyType);
 | ||
|                 tb.Columns.Add(prop.Name, t);
 | ||
|             }
 | ||
| 
 | ||
|             foreach (T item in items)
 | ||
|             {
 | ||
|                 var values = new object[props.Length];
 | ||
| 
 | ||
|                 for (int i = 0; i < props.Length; i++)
 | ||
|                 {
 | ||
|                     values[i] = props[i].GetValue(item, null);
 | ||
|                 }
 | ||
| 
 | ||
|                 tb.Rows.Add(values);
 | ||
|             }
 | ||
| 
 | ||
|             return tb;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Determine of specified type is nullable
 | ||
|         /// </summary>
 | ||
|         public static bool IsNullable(Type t)
 | ||
|         {
 | ||
|             return !t.IsValueType || (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>));
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Return underlying type if type is Nullable otherwise return the type
 | ||
|         /// </summary>
 | ||
|         public static Type GetCoreType(Type t)
 | ||
|         {
 | ||
|             if (t != null && IsNullable(t))
 | ||
|             {
 | ||
|                 if (!t.IsValueType)
 | ||
|                 {
 | ||
|                     return t;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     return Nullable.GetUnderlyingType(t);
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 return t;
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         protected void drpUser_SelectedIndexChanged(object sender, EventArgs e)
 | ||
|         {
 | ||
|             //if (drpUser.SelectedValue == BLL.Const._Null)
 | ||
|             //{
 | ||
|             //    ShowNotify("请选择要打分的施工工程师。", MessageBoxIcon.Warning);
 | ||
|             //    return;
 | ||
|             //}
 | ||
|             //if (string.IsNullOrEmpty(drpCompileDateMonth.Text))
 | ||
|             //{
 | ||
|             //    ShowNotify("请选择年份。", MessageBoxIcon.Warning);
 | ||
|             //    return;
 | ||
|             //}
 | ||
|             //BindGrid();
 | ||
|         }
 | ||
| 
 | ||
|         #region 导出excel
 | ||
|         #region 导出excel
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 格式化html
 | ||
|         /// </summary>
 | ||
|         /// <param name="grid"></param>
 | ||
|         /// <returns></returns>
 | ||
|         private string GetGridTableHtml(Grid grid)
 | ||
|         {
 | ||
|             StringBuilder sb = new StringBuilder();
 | ||
| 
 | ||
|             MultiHeaderTable mht = new MultiHeaderTable();
 | ||
|             mht.ResolveMultiHeaderTable(Grid1.Columns);
 | ||
| 
 | ||
| 
 | ||
|             sb.Append("<meta http-equiv=\"Content-Type\" content=\"application/vnd.ms-excel;charset=utf-8\"/>");
 | ||
| 
 | ||
| 
 | ||
|             sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
 | ||
| 
 | ||
|             ////列数
 | ||
|             //var rowCount = "";
 | ||
|             //var list = Funs.DB.Base_Project.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).OrderBy(x => x.ProjectCode).ToList();
 | ||
|             //for (int i = 0; i < list.Count; i++)
 | ||
|             //{
 | ||
|             //    rowCount+="{}"
 | ||
|             //}
 | ||
| 
 | ||
|             foreach (List<object[]> rows in mht.MultiTable)
 | ||
|             {
 | ||
|                 sb.Append("<tr>");
 | ||
|                 foreach (object[] cell in rows)
 | ||
|                 {
 | ||
|                     int rowspan = Convert.ToInt32(cell[0]);
 | ||
|                     int colspan = Convert.ToInt32(cell[1]);
 | ||
|                     GridColumn column = cell[2] as GridColumn;
 | ||
| 
 | ||
|                     sb.AppendFormat("<th{0}{1}{2}>{3}</th>",
 | ||
|                         rowspan != 1 ? " rowspan=\"" + rowspan + "\"" : "",
 | ||
|                         colspan != 1 ? " colspan=\"" + colspan + "\"" : "",
 | ||
|                         colspan != 1 ? " style=\"text-align:center;\"" : "",
 | ||
|                         column.HeaderText);
 | ||
|                 }
 | ||
|                 sb.Append("</tr>");
 | ||
|             }
 | ||
| 
 | ||
|             int i = 0;
 | ||
|             foreach (GridRow row in grid.Rows)
 | ||
|             {
 | ||
|                 sb.Append("<tr>");
 | ||
| 
 | ||
|                 string MenuC = "";
 | ||
|                 int y = 1;
 | ||
|                 foreach (GridColumn column in mht.Columns)
 | ||
|                 {
 | ||
|                     string html = row.Values[column.ColumnIndex].ToString();
 | ||
|                     sb.AppendFormat("<td>{0}</td>", html);
 | ||
| 
 | ||
|                     #endregion
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|                     y += 1;
 | ||
|                 }
 | ||
|                 i += 1;
 | ||
|                 sb.Append("</tr>");
 | ||
|             }
 | ||
| 
 | ||
|             sb.Append("</table>");
 | ||
| 
 | ||
|             return sb.ToString();
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         public static string MidStrEx(string sourse, string startstr, string endstr)
 | ||
|         {
 | ||
|             string result = string.Empty;
 | ||
|             int startindex, endindex;
 | ||
|             try
 | ||
|             {
 | ||
|                 startindex = sourse.IndexOf(startstr);
 | ||
|                 if (startindex == -1)
 | ||
|                     return result;
 | ||
|                 string tmpstr = sourse.Substring(startindex + startstr.Length);
 | ||
|                 endindex = tmpstr.IndexOf(endstr);
 | ||
|                 if (endindex == -1)
 | ||
|                     return result;
 | ||
|                 result = tmpstr.Remove(endindex);
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
| 
 | ||
|             }
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         #region 多表头处理
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 处理多表头的类
 | ||
|         /// </summary>
 | ||
|         public class MultiHeaderTable
 | ||
|         {
 | ||
|             // 包含 rowspan,colspan 的多表头,方便生成 HTML 的 table 标签
 | ||
|             public List<List<object[]>> MultiTable = new List<List<object[]>>();
 | ||
|             // 最终渲染的列数组
 | ||
|             public List<GridColumn> Columns = new List<GridColumn>();
 | ||
| 
 | ||
| 
 | ||
|             public void ResolveMultiHeaderTable(GridColumnCollection columns)
 | ||
|             {
 | ||
|                 List<object[]> row = new List<object[]>();
 | ||
|                 foreach (GridColumn column in columns)
 | ||
|                 {
 | ||
|                     object[] cell = new object[4];
 | ||
|                     cell[0] = 1;    // rowspan
 | ||
|                     cell[1] = 1;    // colspan
 | ||
|                     cell[2] = column;
 | ||
|                     cell[3] = null;
 | ||
| 
 | ||
|                     row.Add(cell);
 | ||
|                 }
 | ||
| 
 | ||
|                 ResolveMultiTable(row, 0);
 | ||
| 
 | ||
|                 ResolveColumns(row);
 | ||
|             }
 | ||
| 
 | ||
|             private void ResolveColumns(List<object[]> row)
 | ||
|             {
 | ||
|                 foreach (object[] cell in row)
 | ||
|                 {
 | ||
|                     GroupField groupField = cell[2] as GroupField;
 | ||
|                     if (groupField != null && groupField.Columns.Count > 0)
 | ||
|                     {
 | ||
|                         List<object[]> subrow = new List<object[]>();
 | ||
|                         foreach (GridColumn column in groupField.Columns)
 | ||
|                         {
 | ||
|                             subrow.Add(new object[]
 | ||
|                             {
 | ||
|                                 1,
 | ||
|                                 1,
 | ||
|                                 column,
 | ||
|                                 groupField
 | ||
|                             });
 | ||
|                         }
 | ||
| 
 | ||
|                         ResolveColumns(subrow);
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         Columns.Add(cell[2] as GridColumn);
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
|             }
 | ||
| 
 | ||
|             private void ResolveMultiTable(List<object[]> row, int level)
 | ||
|             {
 | ||
|                 List<object[]> nextrow = new List<object[]>();
 | ||
| 
 | ||
|                 foreach (object[] cell in row)
 | ||
|                 {
 | ||
|                     GroupField groupField = cell[2] as GroupField;
 | ||
|                     if (groupField != null && groupField.Columns.Count > 0)
 | ||
|                     {
 | ||
|                         // 如果当前列包含子列,则更改当前列的 colspan,以及增加父列(向上递归)的colspan
 | ||
|                         cell[1] = Convert.ToInt32(groupField.Columns.Count);
 | ||
|                         PlusColspan(level - 1, cell[3] as GridColumn, groupField.Columns.Count - 1);
 | ||
| 
 | ||
|                         foreach (GridColumn column in groupField.Columns)
 | ||
|                         {
 | ||
|                             nextrow.Add(new object[]
 | ||
|                             {
 | ||
|                                 1,
 | ||
|                                 1,
 | ||
|                                 column,
 | ||
|                                 groupField
 | ||
|                             });
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
|                 MultiTable.Add(row);
 | ||
| 
 | ||
|                 // 如果当前下一行,则增加上一行(向上递归)中没有子列的列的 rowspan
 | ||
|                 if (nextrow.Count > 0)
 | ||
|                 {
 | ||
|                     PlusRowspan(level);
 | ||
| 
 | ||
|                     ResolveMultiTable(nextrow, level + 1);
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|             private void PlusRowspan(int level)
 | ||
|             {
 | ||
|                 if (level < 0)
 | ||
|                 {
 | ||
|                     return;
 | ||
|                 }
 | ||
| 
 | ||
|                 foreach (object[] cells in MultiTable[level])
 | ||
|                 {
 | ||
|                     GroupField groupField = cells[2] as GroupField;
 | ||
|                     if (groupField != null && groupField.Columns.Count > 0)
 | ||
|                     {
 | ||
|                         // ...
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         cells[0] = Convert.ToInt32(cells[0]) + 1;
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
|                 PlusRowspan(level - 1);
 | ||
|             }
 | ||
| 
 | ||
|             private void PlusColspan(int level, GridColumn parent, int plusCount)
 | ||
|             {
 | ||
|                 if (level < 0)
 | ||
|                 {
 | ||
|                     return;
 | ||
|                 }
 | ||
| 
 | ||
|                 foreach (object[] cells in MultiTable[level])
 | ||
|                 {
 | ||
|                     GridColumn column = cells[2] as GridColumn;
 | ||
|                     if (column == parent)
 | ||
|                     {
 | ||
|                         cells[1] = Convert.ToInt32(cells[1]) + plusCount;
 | ||
| 
 | ||
|                         PlusColspan(level - 1, cells[3] as GridColumn, plusCount);
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|         }
 | ||
|         #endregion
 | ||
|       
 | ||
|         /// <summary>
 | ||
|         /// 导出exccel
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnOut_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             Response.ClearContent();
 | ||
|             var excelDate = drpCompileDateMonth.Text + "年";
 | ||
|             var uName = drpUser.SelectedText;
 | ||
| 
 | ||
| 
 | ||
|             var FileName = excelDate + "施工工程师(" + uName + ")施工管理绩效数据收集";
 | ||
|             Response.AddHeader("content-disposition", "attachment; filename=" + FileName + ".xls");
 | ||
|             Response.ContentType = "application/vnd.ms-excel";
 | ||
|             Response.ContentEncoding = System.Text.Encoding.UTF8;
 | ||
|             Response.Write(GetGridTableHtml(Grid1));
 | ||
|             Response.End();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 查询绑定数据
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnBindGrid(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (drpUser.SelectedValue == BLL.Const._Null)
 | ||
|             {
 | ||
|                 ShowNotify("请选择要打分的施工工程师。", MessageBoxIcon.Warning);
 | ||
|                 return;
 | ||
|             }
 | ||
|             if (string.IsNullOrEmpty(drpCompileDateMonth.Text))
 | ||
|             {
 | ||
|                 ShowNotify("请选择年份。", MessageBoxIcon.Warning);
 | ||
|                 return;
 | ||
|             }
 | ||
| 
 | ||
|             BindGrid();
 | ||
|         }
 | ||
|     }
 | ||
| } |