130 lines
3.7 KiB
C#
130 lines
3.7 KiB
C#
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 HCodeAdd : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 工程暂停令主键
|
|
/// </summary>
|
|
public string HCodeId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["HCodeId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["HCodeId"] = 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.HCodeId = Request.Params["HCodeId"];
|
|
this.PersonId = Request.Params["PersonId"];
|
|
|
|
if (!string.IsNullOrEmpty(HCodeId))
|
|
{
|
|
this.hdHCodeId.Text = HCodeId;
|
|
|
|
Model.Epidemic_HCode hcode = Funs.DB.Epidemic_HCode.FirstOrDefault(x => x.HCodeId == HCodeId);
|
|
if (hcode != null)
|
|
{
|
|
if (hcode.Date.HasValue)
|
|
{
|
|
this.dpDate.Text = hcode.Date.Value.ToString("yyyy-MM-dd");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected void btnAttach_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(this.hdHCodeId.Text)) //新增记录
|
|
{
|
|
this.hdHCodeId.Text = SQLHelper.GetNewID(typeof(Model.Epidemic_HCode));
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Design&menuId={2}", "0", this.hdHCodeId.Text, BLL.Const.EpidemicPersonMenuId)));
|
|
}
|
|
|
|
|
|
#region 保存按钮
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
Model.Epidemic_HCode vaccin = new Model.Epidemic_HCode
|
|
{
|
|
|
|
CreateDate = DateTime.Now,
|
|
CreateMan = this.CurrUser.UserId
|
|
};
|
|
if (!string.IsNullOrEmpty(HCodeId))
|
|
{
|
|
vaccin = Funs.DB.Epidemic_HCode.FirstOrDefault(x => x.HCodeId == HCodeId);
|
|
}
|
|
|
|
vaccin.Date = this.dpDate.SelectedDate;
|
|
vaccin.PersonId = this.PersonId;
|
|
if (!string.IsNullOrEmpty(HCodeId))
|
|
{
|
|
vaccin.HCodeId = HCodeId;
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(hdHCodeId.Text))
|
|
{
|
|
vaccin.HCodeId = hdHCodeId.Text;
|
|
}
|
|
else
|
|
{
|
|
vaccin.HCodeId = SQLHelper.GetNewID(typeof(Model.Epidemic_HCode));
|
|
}
|
|
|
|
Funs.DB.Epidemic_HCode.InsertOnSubmit(vaccin);
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
} |