1
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.SHIYE.Work
|
||||
{
|
||||
public partial class BlindPlateWorkEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string LicenseId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["LicenseId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["LicenseId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.InitDropDownList();
|
||||
this.LicenseId = Request.Params["LicenseId"];
|
||||
if (!string.IsNullOrEmpty(this.LicenseId))
|
||||
{
|
||||
Model.SY_License_BlindlWork License = BLL.SYLicensePublicService.GetBlindPlateByIds(this.LicenseId);
|
||||
|
||||
if (License != null)
|
||||
{
|
||||
this.ProjectId = License.ProjectId;
|
||||
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.InitDropDownList();
|
||||
}
|
||||
this.txtLicenseCode.Text = License.LicenseCode;
|
||||
if (!string.IsNullOrEmpty(License.ApplyUnitId))
|
||||
{
|
||||
this.drpUnitId.SelectedValue = License.ApplyUnitId;
|
||||
}
|
||||
this.txtWorkPlace.Text = License.WorkPalce;
|
||||
this.txtApplicantMan.Text =License.ApplyManId;
|
||||
this.txtApplyDate.Text = string.Format("{0:yyyy-MM-dd}", License.ApplyDate);
|
||||
this.txtWorkMeasures.Text = HttpUtility.HtmlDecode(License.WorkMeasures);
|
||||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", License.ValidityStartTime);
|
||||
this.txtWatchManContact.Text =License.WatchManContact;
|
||||
this.drpStates.SelectedValue = License.States;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtApplicantMan.Text = this.CurrUser.UserName;
|
||||
this.drpUnitId.SelectedValue = this.CurrUser.UnitId;
|
||||
this.txtApplyDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
////自动生成编码
|
||||
this.txtLicenseCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectLicenseManagerMenuId, this.ProjectId, this.CurrUser.UnitId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 初始化下拉框
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
UnitService.InitUnitDropDownList(this.drpUnitId, this.ProjectId, true);
|
||||
}
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.SaveData(BLL.Const.BtnSave);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
private void SaveData(string type)
|
||||
{
|
||||
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择申请单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.SY_License_BlindlWork License = new Model.SY_License_BlindlWork
|
||||
{
|
||||
ProjectId = this.ProjectId,
|
||||
LicenseCode = this.txtLicenseCode.Text.Trim()
|
||||
};
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
License.ApplyUnitId = this.drpUnitId.SelectedValue;
|
||||
}
|
||||
License.ApplyManId = this.CurrUser.UserId;
|
||||
License.WorkPalce = this.txtWorkPlace.Text;
|
||||
License.ValidityStartTime = Funs.GetNewDateTime(this.txtStartDate.Text);
|
||||
License.ApplyDate = Funs.GetNewDateTime(this.txtApplyDate.Text.Trim());
|
||||
License.WorkMeasures = HttpUtility.HtmlEncode(this.txtWorkMeasures.Text);
|
||||
License.WatchManContact = this.txtWatchManContact.Text;
|
||||
License.States = BLL.Const.State_0;
|
||||
if (!string.IsNullOrEmpty(this.drpStates.SelectedValue))
|
||||
{
|
||||
License.States = this.drpStates.SelectedValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
License.States =null;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.LicenseId))
|
||||
{
|
||||
License.BlindWorkId = this.LicenseId;
|
||||
BLL.SYLicensePublicService.UpdateBlindPlate(License);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, License.LicenseCode, License.BlindWorkId, BLL.Const.ProjectLicenseManagerMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
else
|
||||
{
|
||||
License.ApplyManId = this.CurrUser.UserName;
|
||||
this.LicenseId = SQLHelper.GetNewID(typeof(Model.SY_License_BlindlWork));
|
||||
License.BlindWorkId = this.LicenseId;
|
||||
BLL.SYLicensePublicService.AddBlindPlate(License);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, License.LicenseCode, License.BlindWorkId, BLL.Const.ProjectLicenseManagerMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 附件上传
|
||||
/// <summary>
|
||||
/// 上传附件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.LicenseId))
|
||||
{
|
||||
this.SaveData(BLL.Const.BtnSave);
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/LicenseAttachUrl&menuId={1}", LicenseId, BLL.Const.ProjectLicenseManagerMenuId)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user