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.common.BaseInfo { public partial class TestEngineering : PageBase { /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string projectId = Request.Params["projectId"]; string years = DateTime.Now.Year.ToString().Substring(2, 2); string pfx = "YA" + years + "-GD"; if (!string.IsNullOrEmpty(projectId)) { var project = BLL.Base_ProjectService.GetProjectByProjectId(projectId); if (project != null) { if (!string.IsNullOrEmpty(project.TestEngineeringCode)) { this.txtTestEngineeringCode.Text = project.TestEngineeringCode; } else//检测编号按后3位自动生成流水号 { if (project.CheckUnitId == "26645a1f-3256-4962-9b27-d33d7dea087e") { this.txtTestEngineeringCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode3", "dbo.Base_Project", "TestEngineeringCode", pfx); } } } } } } /// /// 提交按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { string projectId = Request.Params["projectId"]; if (!string.IsNullOrEmpty(projectId)) { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.ProjectMenuId, Const.BtnEditTestEngineering)) { var otherProject = (from x in Funs.DB.Base_Project where x.TestEngineeringCode == this.txtTestEngineeringCode.Text.Trim() && x.ProjectId != projectId select x).FirstOrDefault(); if (otherProject != null) { ShowNotify("该检测工程编号已存在,请重新输入!", MessageBoxIcon.Warning); return; } var project = BLL.Base_ProjectService.GetProjectByProjectId(projectId); if (project != null) { project.TestEngineeringCode = this.txtTestEngineeringCode.Text.Trim(); BLL.Base_ProjectService.UpdateProject(project); ShowNotify("提交成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } else { ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } } } }