xinjiang/SGGL/FineUIPro.Web/HSSE/Epidemic/HeSuanAdd.aspx.cs

120 lines
3.2 KiB
C#
Raw Normal View History

2024-11-19 09:45:27 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.Epidemic
{
public partial class HeSuanAdd : PageBase
{
#region
/// <summary>
/// 工程暂停令主键
/// </summary>
public string HeSuanId
{
get
{
return (string)ViewState["HeSuanId"];
}
set
{
ViewState["HeSuanId"] = value;
}
}
public string PersonId
{
get
{
return (string)ViewState["PersonId"];
}
set
{
ViewState["PersonId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.HeSuanId = Request.Params["HeSuanId"];
this.PersonId = Request.Params["PersonId"];
if (!string.IsNullOrEmpty(HeSuanId))
{
Model.Epidemic_HeSuan vaccin = Funs.DB.Epidemic_HeSuan.FirstOrDefault(x => x.HeSuanId == HeSuanId);
if (vaccin != null)
{
if (!string.IsNullOrEmpty(vaccin.Address))
{
this.txtAddress.Text = vaccin.Address;
}
if (vaccin.Date.HasValue)
{
this.dpDate.Text = vaccin.Date.Value.ToString("yyyy-MM-dd");
}
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.Epidemic_HeSuan vaccin = new Model.Epidemic_HeSuan
{
CreateDate = DateTime.Now,
CreateMan = this.CurrUser.UserId
};
if (!string.IsNullOrEmpty(HeSuanId))
{
vaccin = Funs.DB.Epidemic_HeSuan.FirstOrDefault(x => x.HeSuanId == HeSuanId);
}
vaccin.Address = this.txtAddress.Text;
vaccin.Date = this.dpDate.SelectedDate;
vaccin.PersonId = this.PersonId;
if (!string.IsNullOrEmpty(HeSuanId))
{
vaccin.HeSuanId = HeSuanId;
}
else
{
vaccin.HeSuanId = SQLHelper.GetNewID(typeof(Model.Epidemic_HeSuan));
Funs.DB.Epidemic_HeSuan.InsertOnSubmit(vaccin);
}
Funs.DB.SubmitChanges();
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
#endregion
}
}