推送数据
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BLL;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.ZHGL.ManagementReport
|
||||
{
|
||||
@@ -16,7 +18,40 @@ namespace FineUIPro.Web.ZHGL.ManagementReport
|
||||
{
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
|
||||
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, "按检查类型");
|
||||
// 绑定表格
|
||||
//BindGrid();
|
||||
InitTreeMenu();
|
||||
@@ -54,63 +89,7 @@ namespace FineUIPro.Web.ZHGL.ManagementReport
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#region
|
||||
private void BindGrid()
|
||||
{
|
||||
SqlParameter[] parameter = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@ProjectId", tvControlItem.SelectedNodeID),
|
||||
new SqlParameter("@StartTime", !string.IsNullOrEmpty(this.txtStartTime.Text)?this.txtStartTime.Text:null),
|
||||
new SqlParameter("@EndTime", !string.IsNullOrEmpty(this.txtEndTime.Text)?this.txtEndTime.Text:null),
|
||||
new SqlParameter("@States", !string.IsNullOrEmpty(Request.Params["projectId"])?BLL.Const.State_2:null),
|
||||
new SqlParameter("@UnitName", !string.IsNullOrEmpty(this.txtUnitName.Text)?this.txtUnitName.Text:null),
|
||||
new SqlParameter("@WorkAreaName", !string.IsNullOrEmpty(this.txtWorkAreaName.Text)?this.txtWorkAreaName.Text:null)
|
||||
};
|
||||
DataTable tb = SQLHelper.GetDataTableRunProc("SpCheckDayStatistic", parameter);
|
||||
// 2.获取当前分页数据
|
||||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||||
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
{
|
||||
string[] rowID = Grid1.Rows[i].DataKeys[0].ToString().Split(',');
|
||||
if (rowID.Count() > 0)
|
||||
{
|
||||
var checkDay = BLL.Check_CheckDayService.GetCheckDayByCheckDayId(rowID[0]);
|
||||
if (checkDay != null)
|
||||
{
|
||||
if (checkDay.States == BLL.Const.State_2)
|
||||
{
|
||||
if (rowID.Count() > 1)
|
||||
{
|
||||
Model.Check_CheckDayDetail detail = BLL.Check_CheckDayDetailService.GetCheckDayDetailByCheckDayDetailId(rowID[1]);
|
||||
if (detail != null)
|
||||
{
|
||||
if (!detail.CompletedDate.HasValue)
|
||||
{
|
||||
Grid1.Rows[i].RowCssClass = "Yellow";
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// Grid1.Rows[i].RowCssClass = "Red";
|
||||
//}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Grid1.Rows[i].RowCssClass = "Green";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 查询
|
||||
/// <summary>
|
||||
@@ -130,22 +109,9 @@ namespace FineUIPro.Web.ZHGL.ManagementReport
|
||||
/// </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 ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
@@ -179,12 +145,365 @@ namespace FineUIPro.Web.ZHGL.ManagementReport
|
||||
|
||||
private string SubStr(string str)
|
||||
{
|
||||
string reStr = string.Empty;
|
||||
string reStr = str;
|
||||
if (!string.IsNullOrEmpty(str) && str.Length > 16)
|
||||
{
|
||||
reStr = str.Substring(0, 16) + "..";
|
||||
reStr = str.Substring(0, 14) + "..";
|
||||
}
|
||||
return reStr;
|
||||
}
|
||||
|
||||
|
||||
#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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user