127 lines
5.6 KiB
C#
127 lines
5.6 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.common.ProjectSet
|
|
{
|
|
public partial class ProjectTestStandardEdit : PageBase
|
|
{
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
|
|
|
|
string projectTestStandardId = Request.Params["projectTestStandardId"];
|
|
string projectId = Request.Params["projectId"];
|
|
BLL.Base_TestStandardService.InitTestStandardDropDownList(drpTestStandard, false, Resources.Lan.PleaseSelect);
|
|
BLL.Base_DetectionTypeService.InitDetectionTypeDropDownList(drpDetectionType, Resources.Lan.PleaseSelect, true, null);
|
|
|
|
var pro = BLL.Base_ProjectService.GetProjectByProjectId(projectId);
|
|
this.txtProject.Text = pro.ProjectName;
|
|
if (!string.IsNullOrEmpty(projectTestStandardId))
|
|
{
|
|
Model.Project_TestStandard getprojectTestStandard = BLL.Project_TestStandardService.GetProjectTestStandardById(projectTestStandardId);
|
|
if (getprojectTestStandard != null)
|
|
{
|
|
if (getprojectTestStandard.TestStandardIds.Length > 0)
|
|
{
|
|
string[] ids = getprojectTestStandard.TestStandardIds.Split(',');
|
|
drpTestStandard.SelectedValueArray = ids;
|
|
}
|
|
|
|
this.txtTestStandardNames.Text = getprojectTestStandard.TestStandardNames;
|
|
this.drpDetectionType.SelectedValue = getprojectTestStandard.DetectionTypeId;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
protected void drpTestStandard_OnSelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string[] ids = drpTestStandard.SelectedValueArray;
|
|
|
|
string testStandardIds = string.Empty;
|
|
string testStandardNames = string.Empty;
|
|
foreach (string id in ids)
|
|
{
|
|
var t = BLL.Base_TestStandardService.GetTestStandardById(id);
|
|
testStandardIds = testStandardIds + id + ",";
|
|
testStandardNames = testStandardNames + t.TestStandardName + ",";
|
|
}
|
|
if (testStandardIds.Length > 0)
|
|
{
|
|
txtTestStandardIds.Text = testStandardIds.Substring(0, testStandardIds.Length - 1);
|
|
txtTestStandardNames.Text = testStandardNames.Substring(0, testStandardNames.Length - 1);
|
|
}
|
|
}
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
string projectId = Request.Params["projectId"];
|
|
string projectTestStandardId = Request.Params["projectTestStandardId"];
|
|
var q = Funs.DB.Project_TestStandard.FirstOrDefault(x => x.DetectionTypeId == drpDetectionType.SelectedValue
|
|
&& x.ProjectId == projectId
|
|
&& (x.ProjectTestStandardId != projectTestStandardId || (projectTestStandardId == null && x.ProjectTestStandardId != null)));
|
|
if (q != null)
|
|
{
|
|
Alert.ShowInTop("该探伤类型已设置检测标准", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (drpDetectionType.SelectedValue == Const._Null || string.IsNullOrEmpty(drpDetectionType.SelectedValue))
|
|
{
|
|
Alert.ShowInTop("请选择探伤类型", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (drpTestStandard.SelectedValue == Const._Null || string.IsNullOrEmpty(drpTestStandard.SelectedValue))
|
|
{
|
|
Alert.ShowInTop("请选择检测标准", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
|
|
Model.Project_TestStandard newDate = new Model.Project_TestStandard
|
|
{
|
|
ProjectId = projectId,
|
|
DetectionTypeId = drpDetectionType.SelectedValue.Trim(),
|
|
TestStandardIds = this.txtTestStandardIds.Text.Trim(),
|
|
TestStandardNames = this.txtTestStandardNames.Text.Trim()
|
|
|
|
};
|
|
|
|
if (!string.IsNullOrEmpty(projectTestStandardId))
|
|
{
|
|
newDate.ProjectTestStandardId = projectTestStandardId;
|
|
BLL.Project_TestStandardService.UpdateProjectTestStandard(newDate);
|
|
BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_ProjectTestStandardMenuId, Const.BtnModify, projectTestStandardId);
|
|
}
|
|
else
|
|
{
|
|
newDate.ProjectTestStandardId = SQLHelper.GetNewID(typeof(Model.Project_TestStandard));
|
|
BLL.Project_TestStandardService.AddProjectTestStandard(newDate);
|
|
BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_ProjectTestStandardMenuId, Const.BtnAdd, newDate.ProjectTestStandardId);
|
|
}
|
|
|
|
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
}
|
|
} |