105 lines
3.4 KiB
C#
105 lines
3.4 KiB
C#
|
using BLL;
|
|||
|
using Model;
|
|||
|
using System;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HJGL.Epidemic
|
|||
|
{
|
|||
|
public partial class MaterialEdit : PageBase
|
|||
|
{
|
|||
|
#region 定义项
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string MaterialId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["MaterialId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["MaterialId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
|
|||
|
this.MaterialId = Request.Params["MaterialId"];
|
|||
|
if (!string.IsNullOrEmpty(this.MaterialId))
|
|||
|
{
|
|||
|
Model.Epidemic_Material Material = Funs.DB.Epidemic_Material.FirstOrDefault(x=>x.MaterialId == this.MaterialId);
|
|||
|
if (Material != null)
|
|||
|
{
|
|||
|
this.txtMaterialName.Text = Material.MaterialName;
|
|||
|
this.txtType.Text = Material.Unit;
|
|||
|
this.txtUnit.Text = Material.Remark;
|
|||
|
this.txtAmount.Text = Material.Amount;
|
|||
|
this.txtRemark.Text = Material.Remark;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region 保存
|
|||
|
/// <summary>
|
|||
|
/// 保存按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Model.Epidemic_Material newMaterial = new Model.Epidemic_Material
|
|||
|
{
|
|||
|
MaterialName = this.txtMaterialName.Text.Trim(),
|
|||
|
Type = this.txtType.Text.Trim(),
|
|||
|
Unit = this.txtUnit.Text.Trim(),
|
|||
|
Amount = this.txtAmount.Text.Trim(),
|
|||
|
Remark = this.txtRemark.Text.Trim(),
|
|||
|
//MetalType=this.txtMetalType.Text.Trim()
|
|||
|
};
|
|||
|
newMaterial.CreateDate = DateTime.Now;
|
|||
|
newMaterial.CreateMan = this.CurrUser.UserId;
|
|||
|
newMaterial.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(this.MaterialId))
|
|||
|
{
|
|||
|
newMaterial.MaterialId = this.MaterialId;
|
|||
|
BLL.Epidemic_MaterialService.UpdateMaterial(newMaterial);
|
|||
|
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_MaterialMenuId, Const.BtnModify, this.MaterialId);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.MaterialId = SQLHelper.GetNewID(typeof(Model.Base_Material));
|
|||
|
newMaterial.MaterialId = this.MaterialId;
|
|||
|
BLL.Epidemic_MaterialService.AddMaterial(newMaterial);
|
|||
|
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_MaterialMenuId, Const.BtnAdd, this.MaterialId);
|
|||
|
}
|
|||
|
|
|||
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|