113 lines
4.3 KiB
C#
113 lines
4.3 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.HSSE.Material
|
|
{
|
|
public partial class MaterPhyQuantityEdit: PageBase
|
|
{
|
|
#region
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string MaterPhyQuantityId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["MaterPhyQuantityId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["MaterPhyQuantityId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
////权限按钮方法
|
|
this.GetButtonPower();
|
|
this.MaterPhyQuantityId = Request.Params["MaterPhyQuantityId"];
|
|
|
|
BLL.ConstValue.InitConstValueDropDownList(this.drpMaterPhyQuantityType, BLL.ConstValue.Group_MaterPhyQuantityType, true);
|
|
if (!string.IsNullOrEmpty(this.MaterPhyQuantityId))
|
|
{
|
|
Model.HSSE_MaterPhyQuantity model = BLL.HSSE_MaterPhyQuantityService.GetHSSE_MaterPhyQuantityById(this.MaterPhyQuantityId);
|
|
if (model != null)
|
|
{
|
|
this.drpMaterPhyQuantityType.SelectedValue = model.MaterPhyQuantityType;
|
|
this.txtUnitOfMeasurement.Text = model.UnitOfMeasurement;
|
|
this.txtTotal.Text = model.Total?.ToString() ;
|
|
this.txtPlanCompletedNum.Text = model.PlanCompletedNum?.ToString();
|
|
this.txtActCompletedNum.Text = model.ActCompletedNum?.ToString();
|
|
if (model.ReportDate != null)
|
|
{
|
|
this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", model.ReportDate);
|
|
}
|
|
this.txtRemark.Text = model.Remark;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
Model.HSSE_MaterPhyQuantity table = new Model.HSSE_MaterPhyQuantity();
|
|
table.ProjectId = this.CurrUser.LoginProjectId;
|
|
table.MaterPhyQuantityType = this.drpMaterPhyQuantityType.SelectedValue;
|
|
table.UnitOfMeasurement = this.txtUnitOfMeasurement.Text;
|
|
table.Total = Funs.GetNewDecimalOrZero(this.txtTotal.Text) ;
|
|
table.PlanCompletedNum = Funs.GetNewDecimalOrZero(this.txtPlanCompletedNum.Text);
|
|
table.ActCompletedNum = Funs.GetNewDecimalOrZero(this.txtActCompletedNum.Text);
|
|
table.ReportDate = this.txtReportDate.SelectedDate;
|
|
table.Remark = this.txtRemark.Text;
|
|
table.CreateMan = this.CurrUser.UserId;
|
|
table.CompleteDate = DateTime.Now;
|
|
if (string.IsNullOrEmpty(this.MaterPhyQuantityId))
|
|
{
|
|
table.MaterPhyQuantityId = SQLHelper.GetNewID(typeof(Model.HSSE_MaterPhyQuantity));
|
|
BLL.HSSE_MaterPhyQuantityService.AddHSSE_MaterPhyQuantity(table);
|
|
|
|
}
|
|
else
|
|
{
|
|
table.MaterPhyQuantityId = this.MaterPhyQuantityId;
|
|
BLL.HSSE_MaterPhyQuantityService.UpdateHSSE_MaterPhyQuantity(table);
|
|
}
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HSSE_MaterPhyQuantityMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
} |