SGGL_SHJ/SGGL/FineUIPro.Web/HSSE/Check/PunishNoticeView.aspx.cs

142 lines
6.0 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
namespace FineUIPro.Web.HSSE.Check
{
public partial class PunishNoticeView : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string PunishNoticeId
{
get
{
return (string)ViewState["PunishNoticeId"];
}
set
{
ViewState["PunishNoticeId"] = value;
}
}
/// <summary>
/// 附件
/// </summary>
private string AttchUrl
{
get
{
return (string)ViewState["AttchUrl"];
}
set
{
ViewState["AttchUrl"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.PunishNoticeId = Request.Params["PunishNoticeId"];
this.txtCurrency.Text = "人民币";
if (!string.IsNullOrEmpty(this.PunishNoticeId))
{
BindGrid();
BindGrid1();
var punishNotice = BLL.PunishNoticeService.GetPunishNoticeById(this.PunishNoticeId);
if (punishNotice != null)
{
this.txtPunishNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.PunishNoticeId);
if (punishNotice.PunishNoticeDate != null)
{
this.txtPunishNoticeDate.Text = string.Format("{0:yyyy-MM-dd}", punishNotice.PunishNoticeDate);
}
this.txtUnitName.Text = UnitService.GetUnitNameByUnitId(punishNotice.UnitId);
this.txtPunishPersonId.Text = Person_PersonsService.GetPersonsNameById(punishNotice.PunishPersonId);
this.txtSignMan.Text = Person_PersonsService.GetPersonsNameById(punishNotice.SignMan);
this.txtApproveMan.Text = BLL.Person_PersonsService.GetPersonsNameById(punishNotice.ApproveMan);
if (punishNotice.PunishMoney != null)
{
this.txtPunishMoney.Text = Convert.ToString(punishNotice.PunishMoney);
this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPunishMoney.Text));//转换大写
}
this.AttchUrl = punishNotice.AttachUrl;
//this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttchUrl);
this.txtFileContents.Text = HttpUtility.HtmlDecode(punishNotice.FileContents);
if (!string.IsNullOrEmpty(punishNotice.Currency))
{
this.txtCurrency.Text = punishNotice.Currency;
}
}
};
}
}
//处罚明细
public void BindGrid1()
{
string strSql = @"select PunishNoticeItemId, PunishNoticeId, PunishContent, PunishBasicItem,PunishMoney, SortIndex
from Check_PunishNoticeItem ";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += "where PunishNoticeId= @PunishNoticeId";
listStr.Add(new SqlParameter("@PunishNoticeId", PunishNoticeId));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
//办理记录
public void BindGrid()
{
string strSql = @"select FlowOperateId, PunishNoticeId, OperateName, OperateManId, OperateTime, case when IsAgree='False' then '否' else '是' end As IsAgree, Opinion,S.PersonName from Check_PunishNoticeFlowOperate C left join Person_Persons S on C.OperateManId=s.PersonId ";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += "where PunishNoticeId= @PunishNoticeId";
listStr.Add(new SqlParameter("@PunishNoticeId", PunishNoticeId));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
var table = this.GetPagedDataTable(gvFlowOperate, tb);
gvFlowOperate.DataSource = table;
gvFlowOperate.DataBind();
}
#endregion
#region
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUploadResources_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/PunishNotice&type=-1&menuId=" + BLL.Const.ProjectPunishNoticeMenuId, this.PunishNoticeId)));
}
/// <summary>
/// 通知单上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPunishNoticeUrl_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/PunishNoticeStatistics&type=-1&menuId=" + BLL.Const.ProjectPunishNoticeStatisticsMenuId, this.PunishNoticeId)));
}
#endregion
}
}