180 lines
7.4 KiB
C#
180 lines
7.4 KiB
C#
|
|
using BLL;
|
|||
|
|
using System;
|
|||
|
|
using System.Linq;
|
|||
|
|
|
|||
|
|
namespace FineUIPro.Web.CQMS.Comprehensive
|
|||
|
|
{
|
|||
|
|
public partial class SiteVisaManagementEdit : PageBase
|
|||
|
|
{
|
|||
|
|
#region 定义变量
|
|||
|
|
/// <summary>
|
|||
|
|
/// 主键
|
|||
|
|
/// </summary>
|
|||
|
|
public string VisaId
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (string)ViewState["VisaId"];
|
|||
|
|
}
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
ViewState["VisaId"] = value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 加载
|
|||
|
|
/// <summary>
|
|||
|
|
/// 加载页面
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
GetButtonPower();
|
|||
|
|
BLL.UnitService.InitUnitDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
|
|||
|
|
BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);
|
|||
|
|
BLL.UnitWorkService.InitUnitWorkDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
|
|||
|
|
this.VisaId = Request.Params["VisaId"];
|
|||
|
|
Model.Comprehensive_SiteVisaManagement siteVisaManagement = BLL.SiteVisaManagementService.GetSiteVisaManagementById(this.VisaId);
|
|||
|
|
if (siteVisaManagement != null)
|
|||
|
|
{
|
|||
|
|
this.hdAttachUrl.Text = siteVisaManagement.VisaId;
|
|||
|
|
this.VisaId = siteVisaManagement.VisaId;
|
|||
|
|
if (!string.IsNullOrEmpty(siteVisaManagement.UnitId))
|
|||
|
|
{
|
|||
|
|
this.drpUnitId.SelectedValue = siteVisaManagement.UnitId;
|
|||
|
|
}
|
|||
|
|
this.txtVisaCode.Text = siteVisaManagement.VisaCode;
|
|||
|
|
this.txtVisaContent.Text = siteVisaManagement.VisaContent;
|
|||
|
|
if (!string.IsNullOrEmpty(siteVisaManagement.ProcessingState))
|
|||
|
|
{
|
|||
|
|
this.drpProcessingState.SelectedValue = siteVisaManagement.ProcessingState;
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(siteVisaManagement.UnitWorkId))
|
|||
|
|
{
|
|||
|
|
this.drpUnitWorkId.SelectedValue = siteVisaManagement.UnitWorkId;
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(siteVisaManagement.CNProfessionalId))
|
|||
|
|
{
|
|||
|
|
this.drpCNProfessionalId.SelectedValue = siteVisaManagement.CNProfessionalId;
|
|||
|
|
}
|
|||
|
|
if (siteVisaManagement.VisaDate != null)
|
|||
|
|
{
|
|||
|
|
this.txtVisaDate.Text = string.Format("{0:yyyy-MM-dd}", siteVisaManagement.VisaDate);
|
|||
|
|
}
|
|||
|
|
this.txtSignMan.Text = siteVisaManagement.SignMan;
|
|||
|
|
this.txtAuditMan.Text = siteVisaManagement.AuditMan;
|
|||
|
|
this.txtRemark.Text = siteVisaManagement.Remark;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
this.txtVisaDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 保存
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存按钮
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (drpCNProfessionalId.SelectedValue == BLL.Const._Null)
|
|||
|
|
{
|
|||
|
|
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
Model.Comprehensive_SiteVisaManagement siteVisaManagement = new Model.Comprehensive_SiteVisaManagement();
|
|||
|
|
siteVisaManagement.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
|
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
|||
|
|
{
|
|||
|
|
siteVisaManagement.UnitId = this.drpUnitId.SelectedValue;
|
|||
|
|
}
|
|||
|
|
siteVisaManagement.VisaCode = this.txtVisaCode.Text.Trim();
|
|||
|
|
siteVisaManagement.VisaContent = this.txtVisaContent.Text.Trim();
|
|||
|
|
siteVisaManagement.ProcessingState = this.drpProcessingState.SelectedValue.Trim();
|
|||
|
|
if (this.drpUnitWorkId.SelectedValue != BLL.Const._Null)
|
|||
|
|
{
|
|||
|
|
siteVisaManagement.UnitWorkId = this.drpUnitWorkId.SelectedValue;
|
|||
|
|
}
|
|||
|
|
if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
|||
|
|
{
|
|||
|
|
siteVisaManagement.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(this.txtVisaDate.Text))
|
|||
|
|
{
|
|||
|
|
siteVisaManagement.VisaDate = Convert.ToDateTime(this.txtVisaDate.Text);
|
|||
|
|
}
|
|||
|
|
siteVisaManagement.SignMan = this.txtSignMan.Text.Trim();
|
|||
|
|
siteVisaManagement.AuditMan = this.txtAuditMan.Text.Trim();
|
|||
|
|
siteVisaManagement.Remark = this.txtRemark.Text.Trim();
|
|||
|
|
if (string.IsNullOrEmpty(this.VisaId))
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
|||
|
|
{
|
|||
|
|
siteVisaManagement.VisaId = this.hdAttachUrl.Text;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
siteVisaManagement.VisaId = SQLHelper.GetNewID(typeof(Model.Comprehensive_SiteVisaManagement));
|
|||
|
|
this.hdAttachUrl.Text = siteVisaManagement.VisaId;
|
|||
|
|
}
|
|||
|
|
siteVisaManagement.CompileMan = this.CurrUser.UserId;
|
|||
|
|
BLL.SiteVisaManagementService.AddSiteVisaManagement(siteVisaManagement);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
siteVisaManagement.VisaId = this.VisaId;
|
|||
|
|
BLL.SiteVisaManagementService.UpdateSiteVisaManagement(siteVisaManagement);
|
|||
|
|
}
|
|||
|
|
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_SiteVisaManagement));
|
|||
|
|
}
|
|||
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/SiteVisaManagement&menuId={1}", this.hdAttachUrl.Text, BLL.Const.SiteVisaManagementMenuId)));
|
|||
|
|
}
|
|||
|
|
#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.SiteVisaManagementMenuId);
|
|||
|
|
if (buttonList.Count() > 0)
|
|||
|
|
{
|
|||
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|||
|
|
{
|
|||
|
|
this.btnSave.Hidden = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|