163 lines
6.6 KiB
C#
163 lines
6.6 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace FineUIPro.Web.CQMS.Comprehensive
|
|||
|
{
|
|||
|
public partial class SpecialEquipmentEdit : PageBase
|
|||
|
{
|
|||
|
#region 定义变量
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string SpecialEquipmentId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["SpecialEquipmentId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["SpecialEquipmentId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
GetButtonPower();
|
|||
|
this.SpecialEquipmentId = Request.Params["SpecialEquipmentId"];
|
|||
|
BLL.UnitService.InitUnitDownList(this.drpUnit, this.CurrUser.LoginProjectId, true);
|
|||
|
BLL.SpecialEquipmentService.InitSpecialEquipmentDropDownList(this.drpEquipmentId, true, true);
|
|||
|
Model.Comprehensive_SpecialEquipment specialEquipment = BLL.SpecialEquipmentServices.GetEquipmentById(this.SpecialEquipmentId);
|
|||
|
if (specialEquipment != null)
|
|||
|
{
|
|||
|
this.SpecialEquipmentId = specialEquipment.SpecialEquipmentId;
|
|||
|
if (!string.IsNullOrEmpty(specialEquipment.UnitId))
|
|||
|
{
|
|||
|
this.drpUnit.SelectedValue = specialEquipment.UnitId;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(specialEquipment.EquipmentId))
|
|||
|
{
|
|||
|
this.drpEquipmentId.SelectedValue = specialEquipment.EquipmentId;
|
|||
|
}
|
|||
|
this.txtInformNumber.Text = specialEquipment.InformNumber.HasValue ? specialEquipment.InformNumber.ToString() : "";
|
|||
|
this.txtMonitoringReportNumber.Text = specialEquipment.MonitoringReportNumber.HasValue ? specialEquipment.MonitoringReportNumber.ToString() : "";
|
|||
|
this.txtSubmitDataNumber.Text = specialEquipment.SubmitDataNumber.HasValue ? specialEquipment.SubmitDataNumber.ToString() : "";
|
|||
|
this.txtSunNumber.Text = specialEquipment.SunNumber.HasValue ? specialEquipment.SunNumber.ToString() : "";
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 保存
|
|||
|
/// <summary>
|
|||
|
/// 保存
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (drpUnit.SelectedValue == BLL.Const._Null)
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择所属单位!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
Model.Comprehensive_SpecialEquipment specialEquipment = new Model.Comprehensive_SpecialEquipment();
|
|||
|
specialEquipment.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
if (!string.IsNullOrEmpty(this.txtSunNumber.Text))
|
|||
|
{
|
|||
|
specialEquipment.SunNumber = Convert.ToInt32(this.txtSunNumber.Text);
|
|||
|
}
|
|||
|
if (this.drpUnit.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
specialEquipment.UnitId = this.drpUnit.SelectedValue;
|
|||
|
}
|
|||
|
if (this.drpEquipmentId.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
specialEquipment.EquipmentId = this.drpEquipmentId.SelectedValue;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtSubmitDataNumber.Text))
|
|||
|
{
|
|||
|
specialEquipment.SubmitDataNumber = Convert.ToInt32(this.txtSubmitDataNumber.Text);
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtMonitoringReportNumber.Text))
|
|||
|
{
|
|||
|
specialEquipment.MonitoringReportNumber = Convert.ToInt32(this.txtMonitoringReportNumber.Text);
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtInformNumber.Text))
|
|||
|
{
|
|||
|
specialEquipment.InformNumber = Convert.ToInt32(this.txtInformNumber.Text);
|
|||
|
}
|
|||
|
if (string.IsNullOrEmpty(this.SpecialEquipmentId))
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
|||
|
{
|
|||
|
specialEquipment.SpecialEquipmentId = this.hdAttachUrl.Text;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
specialEquipment.SpecialEquipmentId = SQLHelper.GetNewID(typeof(Model.Comprehensive_SpecialEquipment));
|
|||
|
this.hdAttachUrl.Text = specialEquipment.SpecialEquipmentId;
|
|||
|
}
|
|||
|
specialEquipment.CompileMan = this.CurrUser.UserId;
|
|||
|
BLL.SpecialEquipmentServices.AddEquipment(specialEquipment);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
specialEquipment.SpecialEquipmentId = this.SpecialEquipmentId;
|
|||
|
BLL.SpecialEquipmentServices.UpdateEquipment(specialEquipment);
|
|||
|
}
|
|||
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 附件上传
|
|||
|
/// <summary>
|
|||
|
/// 附件上传
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnAttach_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(this.hdAttachUrl.Text)) //新增记录
|
|||
|
{
|
|||
|
this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.Comprehensive_SpecialEquipment));
|
|||
|
}
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/SpecialEquipment&menuId={1}", this.hdAttachUrl.Text, BLL.Const.SpecialEquipmentMenuId)));
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 获取按钮权限
|
|||
|
/// <summary>
|
|||
|
/// 获取按钮权限
|
|||
|
/// </summary>
|
|||
|
/// <param name="button"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private void GetButtonPower()
|
|||
|
{
|
|||
|
if (Request.Params["value"] == BLL.Const._Null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.SpecialEquipmentsMenuId);
|
|||
|
if (buttonList.Count() > 0)
|
|||
|
{
|
|||
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|||
|
{
|
|||
|
this.btnSave.Hidden = false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|