CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/HSSE/License/ElectricityView.aspx.cs

242 lines
10 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.HSSE.License
{
public partial class ElectricityView : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string ElectricityId
{
get
{
return (string)ViewState["ElectricityId"];
}
set
{
ViewState["ElectricityId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.SimpleForm1.Title = UnitService.GetUnitNameByUnitId(Const.UnitId_CWCEC) + this.Title;
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.ElectricityId = Request.Params["ElectricityId"];
if (!string.IsNullOrEmpty(this.ElectricityId))
{
var getElectricity = LicensePublicService.GetElectricityById(this.ElectricityId);
if (getElectricity != null)
{
this.lbLicenseCode.Text = getElectricity.LicenseCode;
this.txtApplyUnit.Text = UnitService.GetUnitNameByUnitId(getElectricity.ApplyUnitId);
this.txtApplyManName.Text = UserService.GetUserNameByUserId(getElectricity.ApplyManId);
this.txtWorkPalce.Text = getElectricity.WorkPalce;
this.txtReason.Text = getElectricity.Reason;
if (getElectricity.ValidityStartTime.HasValue)
{
this.txtWorkDate.Text = getElectricity.ValidityStartTime.Value.ToString("f") + " 至 ";
if (getElectricity.ValidityEndTime.HasValue)
{
this.txtWorkDate.Text += getElectricity.ValidityEndTime.Value.ToString("f");
}
}
this.txtWorkMeasures.Text = getElectricity.WorkMeasures;
if (!string.IsNullOrEmpty(getElectricity.CancelManId))
{
this.txtCance.Text = UserService.GetUserNameByUserId(getElectricity.CancelManId) + ";取消时间:"
+ string.Format("{0:yyyy-MM-dd HH:mm}", getElectricity.CancelTime) + ";原因:" + getElectricity.CancelReasons + "。";
}
if (!string.IsNullOrEmpty(getElectricity.CloseManId))
{
if (!string.IsNullOrEmpty(getElectricity.CloseReasons))
{
this.txtClose.Text = getElectricity.CloseReasons + " 关闭时间:"
+ string.Format("{0:yyyy-MM-dd HH:mm}", getElectricity.CloseTime) + "。";
}
else
{
this.txtClose.Text = UserService.GetUserNameByUserId(getElectricity.CloseManId) + ";关闭时间:"
+ string.Format("{0:yyyy-MM-dd HH:mm}", getElectricity.CloseTime) + "。";
}
}
}
}
// 绑定表格
this.BindGrid();
this.SetFlow();
}
}
#endregion
#region
/// <summary>
///
/// </summary>
private void SetFlow()
{
var getFlows = LicensePublicService.GetFlowOperateListByDataId(this.ElectricityId);
if (getFlows.Count() > 0)
{
var getF1 = getFlows.FirstOrDefault(x => x.SortIndex == 1);
if (getF1 != null)
{
this.txtForm1.Title = getF1.AuditFlowName + "";
if (getF1.OperaterTime.HasValue)
{
if (getF1.IsAgree == true)
{
this.txtOpinion1.Text = "同意。";
}
else
{
this.txtOpinion1.Text = getF1.Opinion;
}
this.txtName1.Text = UserService.GetUserNameByUserId(getF1.OperaterId);
this.txtTime1.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF1.OperaterTime);
}
}
var getF2 = getFlows.FirstOrDefault(x => x.SortIndex == 2);
if (getF2 != null)
{
this.txtForm2.Title = getF2.AuditFlowName + "";
if (getF2.OperaterTime.HasValue)
{
if (getF2.IsAgree == true)
{
this.txtOpinion2.Text = "同意。";
}
else
{
this.txtOpinion2.Text = getF2.Opinion;
}
this.txtName2.Text = UserService.GetUserNameByUserId(getF2.OperaterId);
this.txtTime2.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF2.OperaterTime);
}
}
var getF3 = getFlows.FirstOrDefault(x => x.SortIndex == 3);
if (getF3 != null)
{
this.txtForm3.Title = getF3.AuditFlowName + "";
if (getF3.OperaterTime.HasValue)
{
if (getF3.IsAgree == true)
{
this.txtOpinion3.Text = "同意。";
}
else
{
this.txtOpinion3.Text = getF3.Opinion;
}
this.txtName3.Text = UserService.GetUserNameByUserId(getF3.OperaterId);
this.txtTime3.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF3.OperaterTime);
}
}
var getF4 = getFlows.FirstOrDefault(x => x.SortIndex == 4);
if (getF4 != null)
{
this.txtForm4.Title = getF4.AuditFlowName + "";
if (getF4.OperaterTime.HasValue)
{
if (getF4.IsAgree == true)
{
this.txtOpinion4.Text = "同意。";
}
else
{
this.txtOpinion4.Text = getF4.Opinion;
}
this.txtName4.Text = UserService.GetUserNameByUserId(getF4.OperaterId);
this.txtTime4.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF4.OperaterTime);
}
}
var getF5 = getFlows.FirstOrDefault(x => x.SortIndex == 5);
if (getF5 != null)
{
this.txtForm5.Title = getF5.AuditFlowName + "";
if (getF5.OperaterTime.HasValue)
{
if (getF5.IsAgree == true)
{
this.txtOpinion5.Text = "同意。";
}
else
{
this.txtOpinion5.Text = getF5.Opinion;
}
this.txtName5.Text = UserService.GetUserNameByUserId(getF5.OperaterId);
this.txtTime5.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF5.OperaterTime);
}
}
var getF6 = getFlows.FirstOrDefault(x => x.SortIndex == 6);
if (getF6 != null)
{
this.txtForm6.Title = getF6.AuditFlowName + "";
if (getF6.OperaterTime.HasValue)
{
if (getF6.IsAgree == true)
{
this.txtOpinion6.Text = "同意。";
}
else
{
this.txtOpinion6.Text = getF6.Opinion;
}
this.txtName6.Text = UserService.GetUserNameByUserId(getF6.OperaterId);
this.txtTime6.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF6.OperaterTime);
}
}
}
}
#endregion
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT LicenseItemId,DataId,SortIndex,SafetyMeasures,(CASE WHEN IsUsed = 1 THEN '适用' ELSE '不适用' END) AS NoUsedName,ConfirmManId,U.UserName AS ConfirmManName"
+ @" FROM License_LicenseItem AS L "
+ @" LEFT JOIN Sys_User AS U ON L.ConfirmManId =U.UserId"
+ @" WHERE L.DataId ='" + this.ElectricityId + "'";
List<SqlParameter> listStr = new List<SqlParameter>();
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 btnAttachUrl_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.ElectricityId))
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&menuId={1}&type=-1", this.ElectricityId, Const.ProjectElectricityMenuId)));
}
}
#endregion
}
}