315 lines
12 KiB
C#
315 lines
12 KiB
C#
using BLL;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Linq;
|
||
using Newtonsoft.Json.Linq;
|
||
|
||
namespace FineUIPro.Web.HSSE.Meeting
|
||
{
|
||
public partial class MeetingManage : PageBase
|
||
{
|
||
#region 项目主键
|
||
/// <summary>
|
||
/// 项目主键
|
||
/// </summary>
|
||
public string ProjectId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["ProjectId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["ProjectId"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载页面
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
Funs.DropDownPageSize(this.ddlPageSize);
|
||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||
//BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
||
this.Panel1.Title = "安全会议(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")";
|
||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
||
{
|
||
this.ProjectId = Request.Params["projectId"];
|
||
}
|
||
|
||
this.ucTree.UnitId = this.CurrUser.UnitId;
|
||
this.ucTree.ProjectId = this.ProjectId;
|
||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||
{
|
||
this.panelLeftRegion.Hidden = true;
|
||
//////权限按钮方法
|
||
//this.GetButtonPower();
|
||
}
|
||
OutputSummaryData();
|
||
// 绑定表格
|
||
BindGrid();
|
||
}
|
||
}
|
||
private void OutputSummaryData()
|
||
{
|
||
if (string.IsNullOrEmpty(this.ProjectId))
|
||
{
|
||
return;
|
||
}
|
||
List<Model.MeetingOutput> model = new List<Model.MeetingOutput>();
|
||
if (this.rbCom.SelectedValue == "0")
|
||
{
|
||
model = HSSEData_HSSEService.GetProjectClassMeeting(this.ProjectId);
|
||
}
|
||
else if (this.rbCom.SelectedValue == "1")
|
||
{
|
||
model = HSSEData_HSSEService.GetProjectSpecialMeeting(this.ProjectId);
|
||
}
|
||
else if (this.rbCom.SelectedValue == "2")
|
||
{
|
||
model = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeeting(this.ProjectId);
|
||
}
|
||
else if (this.rbCom.SelectedValue == "3")
|
||
{
|
||
model = HSSEData_HSSEService.GetProjectSafetyMeeting(this.ProjectId);
|
||
}
|
||
|
||
JObject summary = new JObject();
|
||
summary.Add("ProjectName", "合计:");
|
||
summary.Add("AttentPersonNum", model.Sum(x=>x.AttentPersonNum));
|
||
|
||
Grid1.SummaryData = summary;
|
||
|
||
}
|
||
protected void changeTree(object sender, EventArgs e)
|
||
{
|
||
this.ProjectId = this.ucTree.ProjectId;
|
||
this.BindGrid();
|
||
|
||
//this.GetButtonPower();
|
||
//if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||
//{
|
||
// btnNew.Hidden = true;
|
||
//}
|
||
}
|
||
|
||
private void BindGrid()
|
||
{
|
||
if (string.IsNullOrEmpty(this.ProjectId))
|
||
{
|
||
return;
|
||
}
|
||
if (this.rbCom.SelectedValue == "0")
|
||
{//班前会
|
||
var model = HSSEData_HSSEService.GetProjectClassMeeting(this.ProjectId);
|
||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate > this.txtStartTime.SelectedDate).ToList();
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate < this.txtEndTime.SelectedDate).ToList();
|
||
}
|
||
model = model.Where(x => x.ProjectId == this.ProjectId).ToList();
|
||
Grid1.RecordCount = model.Count;
|
||
Grid1.DataSource = this.GetPagedDataTable(Grid1, Funs.LINQToDataTable(model));
|
||
Grid1.DataBind();
|
||
}
|
||
else if (this.rbCom.SelectedValue == "1")
|
||
{//HSE专题会
|
||
var model = HSSEData_HSSEService.GetProjectSpecialMeeting(this.ProjectId);
|
||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate > this.txtStartTime.SelectedDate).ToList();
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate < this.txtEndTime.SelectedDate).ToList();
|
||
}
|
||
model = model.Where(x => x.ProjectId == this.ProjectId).ToList();
|
||
Grid1.RecordCount = model.Count;
|
||
Grid1.DataSource = this.GetPagedDataTable(Grid1, Funs.LINQToDataTable(model));
|
||
Grid1.DataBind();
|
||
}
|
||
else if (this.rbCom.SelectedValue == "2")
|
||
{//项目安全领导小组
|
||
var model = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeeting(this.ProjectId);
|
||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate > this.txtStartTime.SelectedDate).ToList();
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate < this.txtEndTime.SelectedDate).ToList();
|
||
}
|
||
model = model.Where(x => x.ProjectId == this.ProjectId).ToList();
|
||
Grid1.RecordCount = model.Count;
|
||
Grid1.DataSource = this.GetPagedDataTable(Grid1, Funs.LINQToDataTable(model));
|
||
Grid1.DataBind();
|
||
}
|
||
else if (this.rbCom.SelectedValue == "3")
|
||
{//项目安全例会
|
||
var model = HSSEData_HSSEService.GetProjectSafetyMeeting(this.ProjectId);
|
||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate > this.txtStartTime.SelectedDate).ToList();
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||
{
|
||
model = model.Where(x => x.MeetingDate < this.txtEndTime.SelectedDate).ToList();
|
||
}
|
||
model = model.Where(x => x.ProjectId == this.ProjectId).ToList();
|
||
Grid1.RecordCount = model.Count;
|
||
Grid1.DataSource = this.GetPagedDataTable(Grid1, Funs.LINQToDataTable(model));
|
||
Grid1.DataBind();
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 查询
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||
{
|
||
//if (this.rbCom.SelectedValue == "2" || this.rbCom.SelectedValue == "3")
|
||
//{
|
||
// this.drpProject.Hidden = false;
|
||
//}
|
||
//else
|
||
//{
|
||
// this.drpProject.Hidden = true;
|
||
//}
|
||
this.BindGrid();
|
||
this.OutputSummaryData();
|
||
}
|
||
#endregion
|
||
|
||
#region 表排序、分页、关闭窗口
|
||
/// <summary>
|
||
/// 分页
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 排序
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||
{
|
||
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>
|
||
/// 关闭弹出窗
|
||
/// </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)
|
||
{
|
||
EditData();
|
||
}
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
private void EditData()
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (this.rbCom.SelectedValue == "0")
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/HSSE/Meeting/ClassMeetingView.aspx?ClassMeetingId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||
}
|
||
else if (this.rbCom.SelectedValue == "1")
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/HSSE/Meeting/SpecialMeetingView.aspx?SpecialMeetingId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||
}
|
||
else if (this.rbCom.SelectedValue == "2")
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~./HSSE/Meeting/SafetyLeaderGroupMeetingView.aspx?SafetyLeaderGroupMeetingId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||
}
|
||
else if (this.rbCom.SelectedValue == "3")
|
||
{
|
||
var getMeet = BLL.WeekMeetingService.GetWeekMeetingById(Grid1.SelectedRowID);
|
||
if (getMeet != null)
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~./HSSE/Meeting/WeekMeetingView.aspx?WeekMeetingId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||
}
|
||
else
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/HSSE/Meeting/MonthMeetingView.aspx?MonthMeetingId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnView_Click(object sender, EventArgs e)
|
||
{
|
||
EditData();
|
||
}
|
||
|
||
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 = this.Grid1.RecordCount;
|
||
this.BindGrid();
|
||
Response.Write(GetGridTableHtml(Grid1));
|
||
Response.End();
|
||
}
|
||
}
|
||
} |