HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/ConDrawingVerificationEidt....

133 lines
5.6 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 ConDrawingVerificationEidt : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string ConDrawingVerificationId
{
get
{
return (string)ViewState["ConDrawingVerificationId"];
}
set
{
ViewState["ConDrawingVerificationId"] = 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.ConDrawingVerificationId = Request.Params["conDrawingVerificationId"];
if (!string.IsNullOrEmpty(this.ConDrawingVerificationId))
{
var report = BLL.ConDrawingVerificationService.GetConDrawingVerificationById(this.ConDrawingVerificationId);
if (report != null)
{
this.txtDesignUnit.Text = report.DesignUnit;
this.txtProfessional.Text = report.Professional;
this.txtHost.Text = report.Host;
this.txtVerificationDate.Text = report.VerificationDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.VerificationDate) : "";
this.txtConDrawingCode.Text = report.ConDrawingCode;
this.txtPersonnel.Text = report.Personnel;
this.txtContents.Text= report.Contents;
this.txtProblems.Text = report.Problems;
this.txtRecorder.Text = report.Recorder;
this.txtRecordDate.Text = report.RecordDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.RecordDate) : "";
this.txtReviewer.Text = report.Reviewer;
this.txtReviewDate.Text = report.ReviewDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ReviewDate) : "";
}
}
else
{
this.txtVerificationDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtConDrawingCode.Text = BLL.Base_ProjectService.GetProjectCode(this.ProjectId);
}
}
}
#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_ConDrawingVerificationMenuId, Const.BtnSave))
{
Model.JGZL_ConDrawingVerification newReport = new Model.JGZL_ConDrawingVerification();
newReport.DesignUnit = this.txtDesignUnit.Text.Trim();
newReport.Professional=this.txtProfessional.Text.Trim();
newReport.Host = this.txtHost.Text.Trim();
newReport.VerificationDate = Funs.GetNewDateTime(this.txtVerificationDate.Text);
newReport.ConDrawingCode = txtConDrawingCode.Text.Trim();
newReport.Personnel = this.txtPersonnel.Text;
newReport.Contents = this.txtContents.Text;
newReport.Problems = this.txtProblems.Text;
newReport.Recorder = this.txtRecorder.Text.Trim();
newReport.RecordDate = Funs.GetNewDateTime(this.txtRecordDate.Text.Trim());
newReport.Reviewer=this.txtReviewer.Text.Trim();
newReport.ReviewDate = Funs.GetNewDateTime(this.txtReviewDate.Text.Trim());
if (!string.IsNullOrEmpty(this.ConDrawingVerificationId))
{
newReport.ConDrawingVerificationId = this.ConDrawingVerificationId;
BLL.ConDrawingVerificationService.UpdateConDrawingVerification(newReport);
}
else
{
newReport.ProjectId = this.ProjectId;
newReport.CompileMan = this.CurrUser.UserId;
newReport.CompileDate = DateTime.Now;
newReport.ConDrawingVerificationId = SQLHelper.GetNewID(typeof(Model.JGZL_ConDrawingVerification));
this.ConDrawingVerificationId = newReport.ConDrawingVerificationId;
BLL.ConDrawingVerificationService.AddConDrawingVerification(newReport);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
}
}