157 lines
5.8 KiB
C#
157 lines
5.8 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Web;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.Customization.CNCCG.HSSE.Check
|
|
{
|
|
public partial class SafetyOfficerCheckEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string SafetyOfficerCheckId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["SafetyOfficerCheckId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["SafetyOfficerCheckId"] = 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();
|
|
SafetyOfficerCheckId = Request.Params["SafetyOfficerCheckId"];
|
|
//接收人
|
|
UserService.InitUserDropDownList(this.drpReceiveMan, this.CurrUser.LoginProjectId, false);
|
|
if (!string.IsNullOrEmpty(SafetyOfficerCheckId))
|
|
{
|
|
Model.Check_SafetyOfficerCheck model = Funs.DB.Check_SafetyOfficerCheck.FirstOrDefault(x => x.SafetyOfficerCheckId == SafetyOfficerCheckId);
|
|
if (model != null)
|
|
{
|
|
this.txtHandleIdea.Text = model.HandleIdea;
|
|
this.drpReceiveMan.SelectedValue = model.ReceiveMan;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 上传附件资源
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(SafetyOfficerCheckId))
|
|
{
|
|
SaveData(BLL.Const.BtnSubmit);
|
|
}
|
|
string edit = "0";
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.Check_SafetyOfficerCheckMenuId, BLL.Const.BtnAdd))
|
|
{
|
|
edit = "1";
|
|
Model.Check_SafetyOfficerCheck model = Funs.DB.Check_SafetyOfficerCheck.FirstOrDefault(x => x.SafetyOfficerCheckId == SafetyOfficerCheckId);
|
|
DateTime date = Convert.ToDateTime(model.CompileDate);
|
|
string dateStr = date.Year.ToString() + date.Month.ToString();
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Registration/" + dateStr + "&menuId={1}&edit={2}", this.SafetyOfficerCheckId, Const.Check_SafetyOfficerCheckMenuId, edit)));
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 提交
|
|
/// <summary>
|
|
/// 提交按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpReceiveMan.SelectedValue == Const._Null)
|
|
{
|
|
ShowNotify("请选择接收人!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == SafetyOfficerCheckId);
|
|
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
|
|
{
|
|
Alert.ShowInTop("请上传整改前照片!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
this.SaveData(BLL.Const.BtnSubmit);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
#endregion
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpReceiveMan.SelectedValue == Const._Null)
|
|
{
|
|
ShowNotify("请选择接收人!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
this.SaveData(BLL.Const.BtnSave);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存数据
|
|
/// </summary>
|
|
/// <param name="type"></param>
|
|
private void SaveData(string type)
|
|
{
|
|
Model.Check_SafetyOfficerCheck model = new Model.Check_SafetyOfficerCheck
|
|
{
|
|
HandleIdea = this.txtHandleIdea.Text.Trim(),
|
|
ReceiveMan=this.drpReceiveMan.SelectedValue,
|
|
CompileMan = CurrUser.UserId,
|
|
CompileDate = DateTime.Now,
|
|
};
|
|
|
|
if (type == "提交")
|
|
{
|
|
model.State = "1";
|
|
}
|
|
else
|
|
{
|
|
model.State = "0";
|
|
}
|
|
if (!string.IsNullOrEmpty(this.SafetyOfficerCheckId))
|
|
{
|
|
model.SafetyOfficerCheckId = this.SafetyOfficerCheckId;
|
|
BLL.SafetyOfficerCheckService.Update(model);
|
|
BLL.LogService.AddSys_Log(this.CurrUser,"", model.SafetyOfficerCheckId, BLL.Const.Check_SafetyOfficerCheckMenuId, BLL.Const.BtnModify);
|
|
}
|
|
else
|
|
{
|
|
this.SafetyOfficerCheckId = SQLHelper.GetNewID(typeof(Model.Check_SafetyOfficerCheck));
|
|
model.SafetyOfficerCheckId = this.SafetyOfficerCheckId;
|
|
BLL.SafetyOfficerCheckService.Add(model);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, "", model.SafetyOfficerCheckId, BLL.Const.Check_SafetyOfficerCheckMenuId, BLL.Const.BtnAdd);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |