Files
HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/ContactEdit.aspx.cs
T
2026-02-02 14:48:25 +08:00

142 lines
6.7 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 ContactEdit : PageBase
{
#region 定义项
/// <summary>
/// 主键
/// </summary>
private string ContactId
{
get
{
return (string)ViewState["ContactId"];
}
set
{
ViewState["ContactId"] = 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.ContactId = Request.Params["contactId"];
if (!string.IsNullOrEmpty(this.ContactId))
{
var report = BLL.ContactService.GetContactById(this.ContactId);
if (report != null)
{
this.txtContractNumber.Text = report.ContractNumber;
this.txtDeliveryUnit.Text = report.DeliveryUnit;
this.txtSubjectMatter.Text = report.SubjectMatter;
this.txtContents.Text = report.Contents;
this.txtHandler.Text = report.Handler;
this.txtHandDate.Text = report.HandDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.HandDate) : "";
this.txtReviewer.Text = report.Reviewer;
this.txtReviewDate.Text = report.ReviewDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ReviewDate) : "";
this.txtHandlingOpinion.Text = report.HandlingOpinion;
this.txtOpinionHandler.Text = report.OpinionHandler;
this.txtOpinionHandDate.Text = report.OpinionHandDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.OpinionHandDate) : "";
this.txtOpinionsReviewer.Text = report.OpinionsReviewer;
this.txtOpinionsDate.Text = report.OpinionsDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.OpinionsDate) : "";
}
}
else
{
int isoCount = (from x in Funs.DB.HJGL_PW_IsoInfo where x.ProjectId == this.ProjectId select x).Count();
int jointCount = (from x in Funs.DB.HJGL_PW_JointInfo where x.ProjectId == this.ProjectId select x).Count();
var project = BLL.Base_ProjectService.GetProjectByProjectId(this.ProjectId);
if (project != null)
{
this.txtContractNumber.Text = project.ProjectCode;
this.txtSubjectMatter.Text = project.ProjectName + ",以下问题请设计单位审核:";
this.txtContents.Text = "本次" + project.ProjectName + "于" + string.Format("{0:yyyy年MM月dd日}", project.StartDate) + "开工,到" + string.Format("{0:yyyy年MM月dd日}", project.EndDate) + "施工结束。该项目共计安装管道" + isoCount + "条,管道焊缝共计" + jointCount + "道,已按图纸要求的比例进行焊缝无损检测,检测结果均符合设计规定的合格等级。该项目配套的各类管道组成件、支撑件安装质量均满足设计文件以及标准规范要求。目前,管道系统已完成水压试验及压缩空气吹扫工序,试验压力降、管道洁净度等关键指标均符合标准规范的规定标准并已通过业主方验收。";
}
}
}
}
#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_ContactMenuId, Const.BtnSave))
{
Model.JGZL_Contact newReport = new Model.JGZL_Contact();
newReport.ContractNumber = this.txtContractNumber.Text.Trim();
newReport.DeliveryUnit = this.txtDeliveryUnit.Text.Trim();
newReport.SubjectMatter = this.txtSubjectMatter.Text.Trim();
newReport.Contents = this.txtContents.Text.Trim();
newReport.Handler = this.txtHandler.Text.Trim();
newReport.HandDate = Funs.GetNewDateTime(this.txtHandDate.Text);
newReport.Reviewer = this.txtReviewer.Text.Trim();
newReport.ReviewDate = Funs.GetNewDateTime(this.txtReviewDate.Text);
newReport.HandlingOpinion = this.txtHandlingOpinion.Text;
newReport.OpinionHandler = this.txtOpinionHandler.Text;
newReport.OpinionHandDate =Funs.GetNewDateTime(this.txtOpinionHandDate.Text);
newReport.OpinionsReviewer = this.txtOpinionsReviewer.Text;
newReport.OpinionsDate = Funs.GetNewDateTime(this.txtOpinionsDate.Text);
if (!string.IsNullOrEmpty(this.ContactId))
{
newReport.ContactId = this.ContactId;
BLL.ContactService.UpdateContact(newReport);
}
else
{
newReport.ProjectId = this.ProjectId;
newReport.CompileMan = this.CurrUser.UserId;
newReport.CompileDate = DateTime.Now;
newReport.ContactId = SQLHelper.GetNewID(typeof(Model.JGZL_Contact));
this.ContactId = newReport.ContactId;
BLL.ContactService.AddContact(newReport);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
}
}