91 lines
3.6 KiB
C#
91 lines
3.6 KiB
C#
using BLL;
|
|
using Model;
|
|
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.ProjectSet
|
|
{
|
|
public partial class InstallationSave : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
string projectId = Request.Params["projectId"];
|
|
if (projectId.Contains("?"))
|
|
{
|
|
projectId = projectId.Substring(0, projectId.LastIndexOf("?"));
|
|
}
|
|
|
|
string installationId = Request.Params["installationId"];
|
|
|
|
if (!string.IsNullOrEmpty(installationId))
|
|
{
|
|
var ins = BLL.Project_InstallationService.GetInstallationByInstallationId(installationId);
|
|
if (ins != null)
|
|
{
|
|
this.txtInstallationCode.Text = ins.InstallationCode;
|
|
this.txtInstallationName.Text = ins.InstallationName;
|
|
this.txtRemark.Text = ins.Def;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void LoadData()
|
|
{
|
|
//btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
}
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
string projectId = Request.Params["projectId"];
|
|
string installationId = Request.Params["installationId"];
|
|
if (BLL.Project_InstallationService.IsExistInstallation(installationId, this.txtInstallationName.Text.Trim(), this.txtInstallationCode.Text.Trim(), projectId))
|
|
{
|
|
Alert.ShowInParent("装置编号或名称已存在!");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
Model.Project_Installation installation = new Project_Installation();
|
|
|
|
installation.InstallationCode = txtInstallationCode.Text.Trim();
|
|
installation.InstallationName = txtInstallationName.Text.Trim();
|
|
installation.ProjectId = projectId;
|
|
installation.Def = txtRemark.Text.Trim();
|
|
if (string.IsNullOrEmpty(installationId))
|
|
{
|
|
installation.InstallationId = SQLHelper.GetNewID(typeof(Model.Project_Installation));
|
|
BLL.Project_InstallationService.AddInstallation(installation);
|
|
BLL.Sys_LogService.AddLog(Const.System_1, projectId, this.CurrUser.UserId, "添加装置信息");
|
|
}
|
|
else
|
|
{
|
|
installation.InstallationId = installationId;
|
|
BLL.Project_InstallationService.UpdateInstallation(installation);
|
|
BLL.Sys_LogService.AddLog(Const.System_1, projectId, this.CurrUser.UserId, "修改装置信息");
|
|
}
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProgressBar.aspx?InstallationId={0}", installation.InstallationId)));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭弹出窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
Alert.ShowInParent("提交成功!");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
}
|
|
} |