123 lines
4.9 KiB
C#
123 lines
4.9 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.JGZL
|
|
{
|
|
public partial class MeasuringInstrumentsEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
private string MeasuringInstrumentsId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["MeasuringInstrumentsId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["MeasuringInstrumentsId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目Id
|
|
/// </summary>
|
|
private string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.ProjectId = Request.Params["projectId"];
|
|
this.MeasuringInstrumentsId = Request.Params["measuringInstrumentsId"];
|
|
if (!string.IsNullOrEmpty(this.MeasuringInstrumentsId))
|
|
{
|
|
var report = BLL.MeasuringInstrumentsService.GetMeasuringInstrumentsById(this.MeasuringInstrumentsId);
|
|
if (report != null)
|
|
{
|
|
this.txtMeasuringInstrumentsName.Text = report.MeasuringInstrumentsName;
|
|
this.txtMeasuringInstrumentsCode.Text = report.MeasuringInstrumentsCode;
|
|
this.txtSpecification.Text = report.Specification;
|
|
this.txtAccuracyLevel.Text = report.AccuracyLevel;
|
|
this.txtCertificateNumber.Text =report.CertificateNumber;
|
|
this.txtVerificationDate.Text = report.VerificationDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.VerificationDate) : "";
|
|
this.txtValidityPeriod.Text = report.ValidityPeriod;
|
|
this.txtRemark.Text = report.Remark;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 提交按钮
|
|
/// <summary>
|
|
/// 提交按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_MeasuringInstrumentsMenuId, Const.BtnSave))
|
|
{
|
|
Model.JGZL_MeasuringInstruments newReport = new Model.JGZL_MeasuringInstruments();
|
|
newReport.MeasuringInstrumentsName = this.txtMeasuringInstrumentsName.Text.Trim();
|
|
newReport.MeasuringInstrumentsCode = this.txtMeasuringInstrumentsCode.Text.Trim();
|
|
newReport.Specification = this.txtSpecification.Text.Trim();
|
|
newReport.AccuracyLevel = this.txtAccuracyLevel.Text.Trim();
|
|
newReport.CertificateNumber = this.txtCertificateNumber.Text.Trim();
|
|
newReport.VerificationDate = Funs.GetNewDateTime(this.txtVerificationDate.Text.Trim());
|
|
newReport.ValidityPeriod = this.txtValidityPeriod.Text.Trim();
|
|
newReport.Remark = this.txtRemark.Text.Trim();
|
|
|
|
if (!string.IsNullOrEmpty(this.MeasuringInstrumentsId))
|
|
{
|
|
newReport.MeasuringInstrumentsId = this.MeasuringInstrumentsId;
|
|
BLL.MeasuringInstrumentsService.UpdateMeasuringInstruments(newReport);
|
|
}
|
|
else
|
|
{
|
|
newReport.ProjectId = this.ProjectId;
|
|
newReport.CompileMan = this.CurrUser.UserId;
|
|
newReport.CompileDate = DateTime.Now;
|
|
newReport.Reviewer = this.CurrUser.UserId;
|
|
newReport.RevieweDate = DateTime.Now;
|
|
newReport.MeasuringInstrumentsId = SQLHelper.GetNewID(typeof(Model.JGZL_MeasuringInstruments));
|
|
this.MeasuringInstrumentsId = newReport.MeasuringInstrumentsId;
|
|
BLL.MeasuringInstrumentsService.AddMeasuringInstruments(newReport);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |