2023-01-30 14:14:20 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
2022-12-20 09:32:32 +08:00
|
|
|
|
using System.Collections.Generic;
|
2023-01-30 14:14:20 +08:00
|
|
|
|
using System.Configuration;
|
2022-12-20 09:32:32 +08:00
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2023-01-30 14:14:20 +08:00
|
|
|
|
using AspNet = System.Web.UI.WebControls;
|
2022-12-20 09:32:32 +08:00
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.ZHGL.ManagementReport
|
|
|
|
|
{
|
|
|
|
|
public partial class CheckDaily : PageBase
|
|
|
|
|
{
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
////权限按钮方法
|
|
|
|
|
this.GetButtonPower();
|
2023-01-30 14:14:20 +08:00
|
|
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
|
|
|
GetButtonPower();
|
|
|
|
|
this.ItemSelectedList = new List<string>();
|
|
|
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
|
|
|
this.drpStates.DataValueField = "Id";
|
|
|
|
|
this.drpStates.DataTextField = "Name";
|
|
|
|
|
List<Model.HandleStep> handleSteps = new List<Model.HandleStep>();
|
|
|
|
|
Model.HandleStep handleStep1 = new Model.HandleStep();
|
|
|
|
|
handleStep1.Id = "1";
|
|
|
|
|
handleStep1.Name = "待整改";
|
|
|
|
|
handleSteps.Add(handleStep1);
|
|
|
|
|
Model.HandleStep handleStep2 = new Model.HandleStep();
|
|
|
|
|
handleStep2.Id = "2";
|
|
|
|
|
handleStep2.Name = "已整改-待复查验收";
|
|
|
|
|
handleSteps.Add(handleStep2);
|
|
|
|
|
Model.HandleStep handleStep3 = new Model.HandleStep();
|
|
|
|
|
handleStep3.Id = "3";
|
|
|
|
|
handleStep3.Name = "已闭环";
|
|
|
|
|
handleSteps.Add(handleStep3);
|
|
|
|
|
//Model.HandleStep handleStep4 = new Model.HandleStep();
|
|
|
|
|
//handleStep4.Id = "4";
|
|
|
|
|
//handleStep4.Name = "已作废";
|
|
|
|
|
//handleSteps.Add(handleStep4);
|
|
|
|
|
this.drpStates.DataSource = handleSteps; ;
|
|
|
|
|
this.drpStates.DataBind();
|
|
|
|
|
Funs.FineUIPleaseSelect(this.drpStates, "按状态");
|
|
|
|
|
ListItem[] ProblemTypes = new ListItem[2];
|
|
|
|
|
ProblemTypes[0] = new ListItem("日常巡检", "1");
|
|
|
|
|
ProblemTypes[1] = new ListItem("专项巡检", "2");
|
|
|
|
|
this.drpProblemTypes.DataValueField = "Value";
|
|
|
|
|
this.drpProblemTypes.DataTextField = "Text";
|
|
|
|
|
this.drpProblemTypes.DataSource = ProblemTypes;
|
|
|
|
|
this.drpProblemTypes.DataBind();
|
|
|
|
|
Funs.FineUIPleaseSelect(this.drpProblemTypes, "按检查类型");
|
2022-12-20 09:32:32 +08:00
|
|
|
|
// 绑定表格
|
|
|
|
|
//BindGrid();
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InitTreeMenu()
|
|
|
|
|
{
|
|
|
|
|
this.tvControlItem.Nodes.Clear();
|
|
|
|
|
TreeNode rootNode = new TreeNode();
|
|
|
|
|
rootNode.Text = "项目";
|
|
|
|
|
rootNode.NodeID = "0";
|
|
|
|
|
rootNode.Expanded = true;
|
|
|
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
|
|
|
|
|
|
|
|
var project = (from x in Funs.DB.Base_Project
|
|
|
|
|
select new { x.ProjectId, x.ProjectName }).Distinct();
|
|
|
|
|
if (project.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var pro in project)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tnProject = new TreeNode();//年节点
|
|
|
|
|
tnProject.Text = SubStr(pro.ProjectName);
|
|
|
|
|
tnProject.NodeID = pro.ProjectId;
|
|
|
|
|
tnProject.ToolTip = pro.ProjectName;
|
|
|
|
|
tnProject.EnableClickEvent = true;
|
|
|
|
|
rootNode.Nodes.Add(tnProject);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-30 14:14:20 +08:00
|
|
|
|
|
2022-12-20 09:32:32 +08:00
|
|
|
|
|
|
|
|
|
#region 查询
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 分页、关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
2023-01-30 14:14:20 +08:00
|
|
|
|
|
2022-12-20 09:32:32 +08:00
|
|
|
|
|
2023-01-30 14:14:20 +08:00
|
|
|
|
|
2022-12-20 09:32:32 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 排序
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private string SubStr(string str)
|
|
|
|
|
{
|
2023-01-30 14:14:20 +08:00
|
|
|
|
string reStr = str;
|
2022-12-20 09:32:32 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(str) && str.Length > 16)
|
|
|
|
|
{
|
2023-01-30 14:14:20 +08:00
|
|
|
|
reStr = str.Substring(0, 14) + "..";
|
2022-12-20 09:32:32 +08:00
|
|
|
|
}
|
|
|
|
|
return reStr;
|
|
|
|
|
}
|
2023-01-30 14:14:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 定义项
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// GV被选择项列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> ItemSelectedList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (List<string>)ViewState["ItemSelectedList"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["ItemSelectedList"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
|
|
|
|
string strSql = "SELECT * FROM View_Hazard_HazardRegister WHERE ProblemTypes ='1' "; //ProblemTypes in ('1' ,'2')
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND ProjectId = @ProjectId";
|
|
|
|
|
listStr.Add(new SqlParameter("@ProjectId", tvControlItem.SelectedNodeID));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtCheckMan.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND CheckManName LIKE @CheckMan";
|
|
|
|
|
listStr.Add(new SqlParameter("@CheckMan", "%" + this.txtCheckMan.Text.Trim() + "%"));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtType.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND RegisterTypesName LIKE @Type";
|
|
|
|
|
listStr.Add(new SqlParameter("@Type", "%" + this.txtType.Text.Trim() + "%"));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtWorkAreaName.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND WorkAreaName LIKE @WorkAreaName";
|
|
|
|
|
listStr.Add(new SqlParameter("@WorkAreaName", "%" + this.txtWorkAreaName.Text.Trim() + "%"));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.dpRiskLevel.SelectedValue.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Risk_Level = @Risk_Level";
|
|
|
|
|
listStr.Add(new SqlParameter("@Risk_Level", this.dpRiskLevel.SelectedText));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.drpType.SelectedValue.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND CheckCycle=@CheckCycle";
|
|
|
|
|
listStr.Add(new SqlParameter("@CheckCycle", this.drpType.SelectedValue));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtResponsibilityUnitName.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND ResponsibilityUnitName LIKE @ResponsibilityUnitName";
|
|
|
|
|
listStr.Add(new SqlParameter("@ResponsibilityUnitName", "%" + this.txtResponsibilityUnitName.Text.Trim() + "%"));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND CheckTime >= @StartTime";
|
|
|
|
|
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND CheckTime <= @EndTime";
|
|
|
|
|
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(txtStartRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND RectificationTime >= @StartRectificationTime";
|
|
|
|
|
listStr.Add(new SqlParameter("@StartRectificationTime", this.txtStartRectificationTime.Text.Trim()));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND RectificationTime <= @EndRectificationTime";
|
|
|
|
|
listStr.Add(new SqlParameter("@EndRectificationTime", this.txtEndRectificationTime.Text.Trim()));
|
|
|
|
|
}
|
|
|
|
|
if (this.drpProblemTypes.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " and ProblemTypes ='" + this.drpProblemTypes.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (this.drpStates.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND States LIKE @States";
|
|
|
|
|
listStr.Add(new SqlParameter("@States", "%" + this.drpStates.SelectedValue + "%"));
|
|
|
|
|
}
|
|
|
|
|
if (!CommonService.IsMainUnitOrAdmin(this.CurrUser.UserId))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND (ResponsibleUnit =@ResponsibleUnit OR SendUnitId=@SendUnitId)";
|
|
|
|
|
listStr.Add(new SqlParameter("@ResponsibleUnit", this.CurrUser.UnitId));
|
|
|
|
|
listStr.Add(new SqlParameter("@SendUnitId", this.CurrUser.UnitId));
|
|
|
|
|
}
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 表排序、分页、关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭弹出窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Grid双击事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Grid行双击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
btnMenuSee_Click(null, null);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查看
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查看按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuSee_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string RegistrationId = Grid1.SelectedRowID;
|
|
|
|
|
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(RegistrationId);
|
|
|
|
|
if (registration != null)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HiddenRectificationView.aspx?HazardRegisterId={0}", RegistrationId, "查看 - ")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 格式化字符串
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取整改前图片
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="registrationId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected string ConvertImageUrl(object registrationId)
|
|
|
|
|
{
|
|
|
|
|
string url = string.Empty;
|
|
|
|
|
if (registrationId != null)
|
|
|
|
|
{
|
|
|
|
|
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
|
|
|
|
if (registration != null)
|
|
|
|
|
{
|
|
|
|
|
url = BLL.UploadAttachmentService.ShowAttachment("../../", registration.ImageUrl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
protected string ConvertProblemTypes(object registrationId)
|
|
|
|
|
{
|
|
|
|
|
string url = string.Empty;
|
|
|
|
|
if (registrationId != null)
|
|
|
|
|
{
|
|
|
|
|
if (registrationId.ToString() == "1")
|
|
|
|
|
{
|
|
|
|
|
return "日常巡检";
|
|
|
|
|
}
|
|
|
|
|
else if (registrationId.ToString() == "2")
|
|
|
|
|
{
|
|
|
|
|
return "专项检查";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取整改前图片(放于Img中)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="registrationId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected string ConvertImageUrlByImage(object registrationId)
|
|
|
|
|
{
|
|
|
|
|
string url = string.Empty;
|
|
|
|
|
if (registrationId != null)
|
|
|
|
|
{
|
|
|
|
|
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
|
|
|
|
if (registration != null)
|
|
|
|
|
{
|
|
|
|
|
url = BLL.UploadAttachmentService.ShowImage(ConfigurationManager.AppSettings["SGGLUrl"], registration.ImageUrl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取整改后图片
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="registrationId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected string ConvertImgUrl(object registrationId)
|
|
|
|
|
{
|
|
|
|
|
string url = string.Empty;
|
|
|
|
|
if (registrationId != null)
|
|
|
|
|
{
|
|
|
|
|
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
|
|
|
|
if (registration != null)
|
|
|
|
|
{
|
|
|
|
|
url = BLL.UploadAttachmentService.ShowAttachment(ConfigurationManager.AppSettings["SGGLUrl"], registration.RectificationImageUrl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取整改后图片(放于Img中)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="registrationId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected string ConvertImgUrlByImage(object registrationId)
|
|
|
|
|
{
|
|
|
|
|
string url = string.Empty;
|
|
|
|
|
if (registrationId != null)
|
|
|
|
|
{
|
|
|
|
|
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
|
|
|
|
if (registration != null)
|
|
|
|
|
{
|
|
|
|
|
url = BLL.UploadAttachmentService.ShowImage("../../", registration.RectificationImageUrl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 导出按钮
|
|
|
|
|
/// 导出按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Response.ClearContent();
|
|
|
|
|
string filename = Funs.GetNewFileName();
|
|
|
|
|
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("日常巡检" + filename, System.Text.Encoding.UTF8) + ".xls");
|
|
|
|
|
Response.ContentType = "application/excel";
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
|
|
|
this.Grid1.PageSize = 100000;
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
Response.Write(GetGridTableHtml(Grid1));
|
|
|
|
|
Response.End();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 导出方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="grid"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private string GetGridTableHtml(Grid grid)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
|
|
|
|
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
{
|
|
|
|
|
if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "tfImageUrl1" && column.ColumnID != "tfImageUrl2" && column.ColumnID != "Punish" && column.ColumnID != "Del")
|
|
|
|
|
{
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
foreach (GridRow row in grid.Rows)
|
|
|
|
|
{
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
{
|
|
|
|
|
if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "tfImageUrl1" && column.ColumnID != "tfImageUrl2" && column.ColumnID != "Punish" && column.ColumnID != "Del")
|
|
|
|
|
{
|
|
|
|
|
string html = row.Values[column.ColumnIndex].ToString();
|
|
|
|
|
if (column.ColumnID == "tfPageIndex")
|
|
|
|
|
{
|
|
|
|
|
html = (row.FindControl("lblPageIndex") as AspNet.Label).Text;
|
|
|
|
|
}
|
|
|
|
|
if (column.ColumnID == "tfImageUrl")
|
|
|
|
|
{
|
|
|
|
|
html = (row.FindControl("lbtnImageUrl") as AspNet.LinkButton).Text;
|
|
|
|
|
}
|
|
|
|
|
if (column.ColumnID == "tfRectificationImageUrl")
|
|
|
|
|
{
|
|
|
|
|
html = (row.FindControl("lbtnRectificationImageUrl") as AspNet.LinkButton).Text;
|
|
|
|
|
}
|
|
|
|
|
if (column.ColumnID == "ProblemTypes")
|
|
|
|
|
{
|
|
|
|
|
html = (row.FindControl("lbProblemTypes") as AspNet.Label).Text;
|
|
|
|
|
}
|
|
|
|
|
//if (column.ColumnID == "tfCutPayment")
|
|
|
|
|
//{
|
|
|
|
|
// html = (row.FindControl("lbtnCutPayment") as AspNet.LinkButton).Text;
|
|
|
|
|
//}
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
}
|
|
|
|
|
sb.Append("</table>");
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-20 09:32:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|