134 lines
3.7 KiB
C#
134 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 TripAdd : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 工程暂停令主键
|
|
/// </summary>
|
|
public string TripId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["TripId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["TripId"] = 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.TripId = Request.Params["TripId"];
|
|
this.PersonId = Request.Params["PersonId"];
|
|
|
|
if (!string.IsNullOrEmpty(TripId))
|
|
{
|
|
|
|
Model.Epidemic_Trip trip = Funs.DB.Epidemic_Trip.FirstOrDefault(x => x.TripId == TripId);
|
|
if (trip != null)
|
|
{ if (trip.TripDate.HasValue)
|
|
{
|
|
this.dpTripDate.Text = trip.TripDate.Value.ToString("yyyy-MM-dd");
|
|
}
|
|
if (!string.IsNullOrEmpty(trip.TripAddress))
|
|
{
|
|
this.txtTripAddress.Text = trip.TripAddress;
|
|
}
|
|
if (!string.IsNullOrEmpty(trip.ResidenceTime)) {
|
|
this.txtResidenceTime.Text = trip.ResidenceTime ;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(trip.Level))
|
|
{
|
|
this.txtLevel.Text = trip.Level;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存按钮
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
Model.Epidemic_Trip trip = new Model.Epidemic_Trip
|
|
{
|
|
|
|
CreateDate = DateTime.Now,
|
|
CreateMan = this.CurrUser.UserId
|
|
};
|
|
if (!string.IsNullOrEmpty(TripId))
|
|
{
|
|
trip = Funs.DB.Epidemic_Trip.FirstOrDefault(x => x.TripId == TripId);
|
|
}
|
|
|
|
trip.TripAddress = this.txtTripAddress.Text;
|
|
trip.TripDate = this.dpTripDate.SelectedDate;
|
|
trip.ResidenceTime = txtResidenceTime.Text;
|
|
trip.Level = txtLevel.Text;
|
|
trip.PersonId = this.PersonId;
|
|
if (!string.IsNullOrEmpty(TripId))
|
|
{
|
|
trip.TripId = TripId;
|
|
}
|
|
else
|
|
{
|
|
trip.TripId = SQLHelper.GetNewID(typeof(Model.Epidemic_Trip));
|
|
Funs.DB.Epidemic_Trip.InsertOnSubmit(trip);
|
|
|
|
}
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
} |