124 lines
3.5 KiB
C#
124 lines
3.5 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 VaccinAdd : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 工程暂停令主键
|
|
/// </summary>
|
|
public string VaccinId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["VaccinId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["VaccinId"] = 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.VaccinId = Request.Params["VaccinId"];
|
|
this.PersonId = Request.Params["PersonId"];
|
|
|
|
if (!string.IsNullOrEmpty(VaccinId))
|
|
{
|
|
|
|
Model.Epidemic_Vaccin vaccin = Funs.DB.Epidemic_Vaccin.FirstOrDefault(x => x.VaccinId == VaccinId);
|
|
if (vaccin != null)
|
|
{
|
|
if (vaccin.Times.HasValue)
|
|
{
|
|
this.txtTimes.Text = vaccin.Times.Value.ToString();
|
|
}
|
|
if (!string.IsNullOrEmpty(vaccin.VaccinAddress))
|
|
{
|
|
this.txtVaccinAddress.Text = vaccin.VaccinAddress;
|
|
}
|
|
if (vaccin.VaccinDate.HasValue)
|
|
{
|
|
this.dpVaccinDate.Text = vaccin.VaccinDate.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_Vaccin vaccin = new Model.Epidemic_Vaccin
|
|
{
|
|
|
|
CreateDate = DateTime.Now,
|
|
CreateMan = this.CurrUser.UserId
|
|
};
|
|
if (!string.IsNullOrEmpty(VaccinId))
|
|
{
|
|
vaccin = Funs.DB.Epidemic_Vaccin.FirstOrDefault(x => x.VaccinId == VaccinId);
|
|
}
|
|
|
|
vaccin.VaccinAddress = this.txtVaccinAddress.Text;
|
|
vaccin.VaccinDate = this.dpVaccinDate.SelectedDate;
|
|
vaccin.Times = int.Parse(txtTimes.Text);
|
|
vaccin.PersonId = this.PersonId;
|
|
if (!string.IsNullOrEmpty(VaccinId))
|
|
{
|
|
vaccin.VaccinId = VaccinId;
|
|
}
|
|
else
|
|
{
|
|
vaccin.VaccinId = SQLHelper.GetNewID(typeof(Model.Epidemic_Vaccin));
|
|
Funs.DB.Epidemic_Vaccin.InsertOnSubmit(vaccin);
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
} |