119 lines
4.9 KiB
C#
119 lines
4.9 KiB
C#
|
|
using BLL;
|
|||
|
|
using Newtonsoft.Json.Linq;
|
|||
|
|
using System;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Data.SqlClient;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
using AspNet = System.Web.UI.WebControls;
|
|||
|
|
|
|||
|
|
namespace FineUIPro.Web.HSSE.Solution
|
|||
|
|
{
|
|||
|
|
public partial class TemporaryElectricityEdit : PageBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 主键
|
|||
|
|
/// </summary>
|
|||
|
|
public string TemporaryElectricityId
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (string)ViewState["TemporaryElectricityId"];
|
|||
|
|
}
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
ViewState["TemporaryElectricityId"] = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
TemporaryElectricityId = Request.Params["TemporaryElectricityId"];
|
|||
|
|
if (!string.IsNullOrEmpty(TemporaryElectricityId))
|
|||
|
|
{
|
|||
|
|
hdId.Text = this.TemporaryElectricityId;
|
|||
|
|
Model.Solution_TemporaryElectricity TemporaryElectricity = BLL.TemporaryElectricityService.GetTemporaryElectricityByTemporaryElectricityId(TemporaryElectricityId);
|
|||
|
|
this.txtCode.Text = TemporaryElectricity.Code;
|
|||
|
|
this.txtName.Text = TemporaryElectricity.Name;
|
|||
|
|
this.txtContent.Text = TemporaryElectricity.Content;
|
|||
|
|
this.txtRemark.Text = TemporaryElectricity.Remark;
|
|||
|
|
if (!string.IsNullOrEmpty(TemporaryElectricity.CompileMan))
|
|||
|
|
{
|
|||
|
|
this.txtCompileMan.Text = UserService.GetUserNameByUserId(TemporaryElectricity.CompileMan);
|
|||
|
|
}
|
|||
|
|
if (TemporaryElectricity.CompileDate != null)
|
|||
|
|
{
|
|||
|
|
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", TemporaryElectricity.CompileDate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
this.txtCompileMan.Text = this.CurrUser.UserName;
|
|||
|
|
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void imgBtnFile_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(hdId.Text))
|
|||
|
|
{
|
|||
|
|
hdId.Text = SQLHelper.GetNewID();
|
|||
|
|
}
|
|||
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=1&toKeyId={0}&path=FileUpload/TemporaryElectricity&menuId={1}", hdId.Text, BLL.Const.ProjectTemporaryElectricityListMenuId)));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
Saveinspection("save");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存
|
|||
|
|
/// </summary>
|
|||
|
|
public void Saveinspection(string saveType)
|
|||
|
|
{
|
|||
|
|
Model.Solution_TemporaryElectricity TemporaryElectricity = new Model.Solution_TemporaryElectricity();
|
|||
|
|
TemporaryElectricity.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
|
TemporaryElectricity.Code = this.txtCode.Text.Trim();
|
|||
|
|
TemporaryElectricity.Name = this.txtName.Text.Trim();
|
|||
|
|
TemporaryElectricity.Content = this.txtContent.Text.Trim();
|
|||
|
|
TemporaryElectricity.Remark = this.txtRemark.Text.Trim();
|
|||
|
|
TemporaryElectricity.CompileMan = this.CurrUser.UserId;
|
|||
|
|
TemporaryElectricity.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
|
|||
|
|
if (!string.IsNullOrEmpty(this.TemporaryElectricityId))
|
|||
|
|
{
|
|||
|
|
TemporaryElectricity.TemporaryElectricityId = this.TemporaryElectricityId;
|
|||
|
|
TemporaryElectricityService.UpdateTemporaryElectricity(TemporaryElectricity);
|
|||
|
|
LogService.AddSys_Log(CurrUser, TemporaryElectricity.Code, TemporaryElectricity.TemporaryElectricityId, Const.ProjectTemporaryElectricityListMenuId, "修改临时用电方案");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(hdId.Text))
|
|||
|
|
{
|
|||
|
|
TemporaryElectricity.TemporaryElectricityId = SQLHelper.GetNewID();
|
|||
|
|
TemporaryElectricityId = TemporaryElectricity.TemporaryElectricityId;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
TemporaryElectricity.TemporaryElectricityId = hdId.Text;
|
|||
|
|
}
|
|||
|
|
TemporaryElectricityService.AddTemporaryElectricity(TemporaryElectricity);
|
|||
|
|
LogService.AddSys_Log(CurrUser, TemporaryElectricity.Code, TemporaryElectricity.TemporaryElectricityId, Const.ProjectTemporaryElectricityListMenuId, "增加临时用电方案");
|
|||
|
|
}
|
|||
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|