CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.cs

99 lines
3.4 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.JDGL.Check
{
public partial class QuantityCompletionEdit : PageBase
{
/// <summary>
/// id
/// </summary>
public string QuantityCompletionId
{
get
{
return (string)ViewState["QuantityCompletionId"];
}
set
{
ViewState["QuantityCompletionId"] = value;
}
}
/// <summary>
/// 项目id
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
QuantityCompletionId = Request.Params["QuantityCompletionId"];
if (!string.IsNullOrEmpty(QuantityCompletionId))
{
Model.JDGL_QuantityCompletion QuantityCompletion = BLL.QuantityCompletionService.GetQuantityCompletionById(QuantityCompletionId);
if (QuantityCompletion != null)
{
this.ProjectId = QuantityCompletion.ProjectId;
if (QuantityCompletion.PlanNum != null)
{
this.txtPlanNum.Text = QuantityCompletion.PlanNum.ToString();
}
if (QuantityCompletion.RealNum != null)
{
this.txtRealNum.Text = QuantityCompletion.RealNum.ToString();
}
}
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData(true);
}
private void SaveData(bool bl)
{
string QuantityCompletionId = Request.Params["QuantityCompletionId"];
Model.JDGL_QuantityCompletion QuantityCompletion = new Model.JDGL_QuantityCompletion();
if (!string.IsNullOrEmpty(this.txtPlanNum.Text.Trim()))
{
QuantityCompletion.PlanNum = Convert.ToDecimal(this.txtPlanNum.Text.Trim());
}
if (!string.IsNullOrEmpty(this.txtRealNum.Text.Trim()))
{
QuantityCompletion.RealNum = Convert.ToDecimal(this.txtRealNum.Text.Trim());
}
if (!string.IsNullOrEmpty(QuantityCompletionId))
{
QuantityCompletion.QuantityCompletionId = QuantityCompletionId;
BLL.QuantityCompletionService.UpdateQuantityCompletion(QuantityCompletion);
}
else
{
QuantityCompletion.QuantityCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityCompletion));
BLL.QuantityCompletionService.AddQuantityCompletion(QuantityCompletion);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
}