179 lines
6.4 KiB
C#
179 lines
6.4 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.SmartSite
|
|
{
|
|
public partial class SoftManageEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 安全措施主键
|
|
/// </summary>
|
|
public string EquipmentSoftId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["EquipmentSoftId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["EquipmentSoftId"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 类型
|
|
/// </summary>
|
|
public string Type
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["Type"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Type"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 菜单id
|
|
/// </summary>
|
|
public string MenuId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["MenuId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["MenuId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 安全措施编辑页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
|
|
this.EquipmentSoftId = Request.Params["EquipmentSoftId"];
|
|
this.Type = Request.Params["type"];
|
|
if (this.Type == "D")
|
|
{
|
|
this.MenuId = Const.SoftManageDMenuId;
|
|
}
|
|
else if (this.Type == "M")
|
|
{
|
|
this.MenuId = Const.SoftManageMMenuId;
|
|
}
|
|
else
|
|
{
|
|
this.MenuId = Const.SoftManageEMenuId;
|
|
}
|
|
///权限
|
|
this.GetButtonPower();
|
|
|
|
ProjectService.InitProjectDropDownList(this.drpProject, true);
|
|
EquipmentService.InitEquipmentDropDownList(this.drpEQ, this.drpProject.SelectedValue, this.Type, true);
|
|
if (!string.IsNullOrEmpty(this.EquipmentSoftId))
|
|
{
|
|
var Equipment = BLL.EquipmentSoftService.GetEquipmentSoftByEquipmentSoftId(this.EquipmentSoftId);
|
|
if (Equipment != null)
|
|
{
|
|
ProjectService.InitAllProjectDropDownList(this.drpProject, true);
|
|
this.drpProject.SelectedValue = Equipment.ProjectId;
|
|
EquipmentService.InitEquipmentDropDownList(this.drpEQ, this.drpProject.SelectedValue, this.Type, true);
|
|
this.drpEQ.SelectedValue = Equipment.EquipmentId;
|
|
this.Type = Equipment.Type;
|
|
this.txtEquipmentSoftName.Text = Equipment.EquipmentSoftName;
|
|
this.txtEquipmentSoftModel.Text = Equipment.EquipmentSoftModel;
|
|
this.txtNumber.Text = Equipment.Number.ToString();
|
|
this.txtRunningState.Text = Equipment.RunningState;
|
|
this.txtSupplier.Text = Equipment.Supplier;
|
|
this.txtSupplierMan.Text = Equipment.SupplierMan;
|
|
this.txtSupplierTel.Text = Equipment.SupplierTel;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpProject.SelectedValue == Const._Null)
|
|
{
|
|
Alert.ShowInParent("请选择项目!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
Model.SmartSite_EquipmentSoft newEquipment = new Model.SmartSite_EquipmentSoft
|
|
{
|
|
EquipmentSoftName = this.txtEquipmentSoftName.Text.Trim(),
|
|
Type = this.Type,
|
|
EquipmentSoftModel = this.txtEquipmentSoftModel.Text.Trim(),
|
|
Number = Funs.GetNewIntOrZero(this.txtNumber.Text.Trim()),
|
|
RunningState = this.txtRunningState.Text.Trim(),
|
|
Supplier = this.txtSupplier.Text.Trim(),
|
|
SupplierMan = this.txtSupplierMan.Text.Trim(),
|
|
SupplierTel = this.txtSupplierTel.Text.Trim(),
|
|
};
|
|
|
|
if (this.drpProject.SelectedValue != Const._Null)
|
|
{
|
|
newEquipment.ProjectId = this.drpProject.SelectedValue;
|
|
}
|
|
|
|
if (this.drpEQ.SelectedValue != Const._Null)
|
|
{
|
|
newEquipment.EquipmentId = this.drpEQ.SelectedValue;
|
|
}
|
|
if (string.IsNullOrEmpty(this.EquipmentSoftId))
|
|
{
|
|
newEquipment.EquipmentSoftId = SQLHelper.GetNewID();
|
|
BLL.EquipmentSoftService.AddEquipmentSoft(newEquipment);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newEquipment.EquipmentSoftName, newEquipment.EquipmentSoftId, this.MenuId, Const.BtnAdd);
|
|
}
|
|
else
|
|
{
|
|
newEquipment.EquipmentSoftId = this.EquipmentSoftId;
|
|
BLL.EquipmentSoftService.UpdateEquipmentSoft(newEquipment);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newEquipment.EquipmentSoftName, newEquipment.EquipmentSoftId, this.MenuId, Const.BtnModify);
|
|
}
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, this.MenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void drpProject_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
EquipmentService.InitEquipmentDropDownList(this.drpEQ, this.drpProject.SelectedValue, this.Type, true);
|
|
}
|
|
}
|
|
} |