235 lines
11 KiB
C#
235 lines
11 KiB
C#
using BLL;
|
||
using System;
|
||
using System.Web;
|
||
|
||
namespace FineUIPro.Web.HSSE.Meeting
|
||
{
|
||
public partial class SafetyLeaderGroupMeetingEdit : PageBase
|
||
{
|
||
#region 定义项
|
||
/// <summary>
|
||
/// 主键
|
||
/// </summary>
|
||
public string SafetyLeaderGroupMeetingId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["SafetyLeaderGroupMeetingId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["SafetyLeaderGroupMeetingId"] = 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.SafetyLeaderGroupMeetingId = Request.Params["SafetyLeaderGroupMeetingId"];
|
||
if (!string.IsNullOrEmpty(this.SafetyLeaderGroupMeetingId))
|
||
{
|
||
Model.Meeting_SafetyLeaderGroupMeeting SafetyLeaderGroupMeeting = BLL.SafetyLeaderGroupMeetingService.GetSafetyLeaderGroupMeetingById(this.SafetyLeaderGroupMeetingId);
|
||
if (SafetyLeaderGroupMeeting != null)
|
||
{
|
||
this.ProjectId = SafetyLeaderGroupMeeting.ProjectId;
|
||
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
||
{
|
||
this.InitDropDownList();
|
||
}
|
||
this.txtSafetyLeaderGroupMeetingCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.SafetyLeaderGroupMeetingId);
|
||
this.txtSafetyLeaderGroupMeetingName.Text = SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingName;
|
||
this.txtSafetyLeaderGroupMeetingDate.Text = string.Format("{0:yyyy-MM-dd}", SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingDate);
|
||
if (!string.IsNullOrEmpty(SafetyLeaderGroupMeeting.CompileMan))
|
||
{
|
||
this.drpCompileMan.SelectedValue = SafetyLeaderGroupMeeting.CompileMan;
|
||
}
|
||
if (SafetyLeaderGroupMeeting.AttentPersonNum != null)
|
||
{
|
||
this.txtAttentPersonNum.Text = SafetyLeaderGroupMeeting.AttentPersonNum.ToString();
|
||
}
|
||
this.txtSafetyLeaderGroupMeetingContents.Text = HttpUtility.HtmlDecode(SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingContents);
|
||
this.txtMeetingHours.Text = Convert.ToString(SafetyLeaderGroupMeeting.MeetingHours);
|
||
this.txtMeetingHostMan.Text = SafetyLeaderGroupMeeting.MeetingHostMan;
|
||
this.txtAttentPerson.Text = SafetyLeaderGroupMeeting.AttentPerson;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
||
this.txtSafetyLeaderGroupMeetingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||
var codeTemplateRule = BLL.SysConstSetService.GetCodeTemplateRuleByMenuId(BLL.Const.ProjectWeekMeetingMenuId);
|
||
if (codeTemplateRule != null)
|
||
{
|
||
this.txtSafetyLeaderGroupMeetingContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template);
|
||
}
|
||
////自动生成编码
|
||
this.txtSafetyLeaderGroupMeetingCode.Text = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectSafetyLeaderGroupMeetingMenuId, this.ProjectId, this.CurrUser.UnitId);
|
||
this.txtSafetyLeaderGroupMeetingName.Text = this.SimpleForm1.Title;
|
||
this.txtMeetingHours.Text = "1";
|
||
this.txtMeetingHostMan.Text = this.CurrUser.UserName;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 初始化下拉框
|
||
/// </summary>
|
||
private void InitDropDownList()
|
||
{
|
||
UserService.InitUserDropDownList(this.drpCompileMan, 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="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||
{
|
||
this.SaveData(BLL.Const.BtnSubmit);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存数据
|
||
/// </summary>
|
||
/// <param name="type"></param>
|
||
private void SaveData(string type)
|
||
{
|
||
Model.Meeting_SafetyLeaderGroupMeeting SafetyLeaderGroupMeeting = new Model.Meeting_SafetyLeaderGroupMeeting
|
||
{
|
||
ProjectId = this.ProjectId,
|
||
SafetyLeaderGroupMeetingCode = this.txtSafetyLeaderGroupMeetingCode.Text.Trim(),
|
||
SafetyLeaderGroupMeetingName = this.txtSafetyLeaderGroupMeetingName.Text.Trim(),
|
||
SafetyLeaderGroupMeetingDate = Funs.GetNewDateTime(this.txtSafetyLeaderGroupMeetingDate.Text.Trim())
|
||
};
|
||
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
|
||
{
|
||
SafetyLeaderGroupMeeting.CompileMan = this.drpCompileMan.SelectedValue;
|
||
}
|
||
SafetyLeaderGroupMeeting.AttentPersonNum = Funs.GetNewIntOrZero(this.txtAttentPersonNum.Text.Trim());
|
||
SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingContents = HttpUtility.HtmlEncode(this.txtSafetyLeaderGroupMeetingContents.Text);
|
||
SafetyLeaderGroupMeeting.CompileDate = DateTime.Now;
|
||
SafetyLeaderGroupMeeting.States = BLL.Const.State_0;
|
||
SafetyLeaderGroupMeeting.MeetingHours = Funs.GetNewInt(this.txtMeetingHours.Text.Trim());
|
||
SafetyLeaderGroupMeeting.MeetingHostMan = this.txtMeetingHostMan.Text.Trim();
|
||
SafetyLeaderGroupMeeting.AttentPerson = this.txtAttentPerson.Text.Trim();
|
||
if (!string.IsNullOrEmpty(this.SafetyLeaderGroupMeetingId))
|
||
{
|
||
SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingId = this.SafetyLeaderGroupMeetingId;
|
||
BLL.SafetyLeaderGroupMeetingService.UpdateSafetyLeaderGroupMeeting(SafetyLeaderGroupMeeting);
|
||
BLL.LogService.AddSys_Log(this.CurrUser, SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingCode, SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingId, BLL.Const.ProjectSafetyLeaderGroupMeetingMenuId, BLL.Const.BtnModify);
|
||
}
|
||
else
|
||
{
|
||
this.SafetyLeaderGroupMeetingId = SQLHelper.GetNewID(typeof(Model.Meeting_SafetyLeaderGroupMeeting));
|
||
SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingId = this.SafetyLeaderGroupMeetingId;
|
||
BLL.SafetyLeaderGroupMeetingService.AddSafetyLeaderGroupMeeting(SafetyLeaderGroupMeeting);
|
||
BLL.LogService.AddSys_Log(this.CurrUser, SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingCode, SafetyLeaderGroupMeeting.SafetyLeaderGroupMeetingId, BLL.Const.ProjectSafetyLeaderGroupMeetingMenuId, BLL.Const.BtnAdd);
|
||
}
|
||
Project_HSSEData_HSSEService.StatisticalData(this.CurrUser.LoginProjectId, Project_HSSEData_HSSEService.HSSEDateType.SafetyMeeting);
|
||
}
|
||
#endregion
|
||
|
||
#region 附件上传
|
||
/// <summary>
|
||
/// 上传附件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(this.SafetyLeaderGroupMeetingId))
|
||
{
|
||
SaveData(BLL.Const.BtnSave);
|
||
}
|
||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/SafetyLeaderGroupMeetingAttachUrl&menuId={1}", this.SafetyLeaderGroupMeetingId, BLL.Const.ProjectSafetyLeaderGroupMeetingMenuId)));
|
||
}
|
||
#endregion
|
||
|
||
protected void btnAttachUrl1_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(this.SafetyLeaderGroupMeetingId))
|
||
{
|
||
SaveData(Const.BtnSave);
|
||
}
|
||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ClassMeetingAttachUrl&menuId={1}&strParam=1", this.SafetyLeaderGroupMeetingId, Const.ProjectSafetyLeaderGroupMeetingMenuId)));
|
||
}
|
||
|
||
protected void btnAttachUrl2_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(this.SafetyLeaderGroupMeetingId))
|
||
{
|
||
SaveData(Const.BtnSave);
|
||
}
|
||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ClassMeetingAttachUrl&menuId={1}&strParam=2", this.SafetyLeaderGroupMeetingId, Const.ProjectSafetyLeaderGroupMeetingMenuId)));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 计算参会人数
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void txtAttentPerson_Blur(object sender, EventArgs e)
|
||
{
|
||
string str = this.txtAttentPerson.Text.Trim();
|
||
if (!string.IsNullOrEmpty(str))
|
||
{
|
||
if (str.Contains(","))
|
||
{
|
||
this.txtAttentPersonNum.Text = str.Split(',').Length.ToString();
|
||
}
|
||
else if (str.Contains(","))
|
||
{
|
||
this.txtAttentPersonNum.Text = str.Split(',').Length.ToString();
|
||
}
|
||
else if (str.Contains(";"))
|
||
{
|
||
this.txtAttentPersonNum.Text = str.Split(';').Length.ToString();
|
||
}
|
||
else if (str.Contains(";"))
|
||
{
|
||
this.txtAttentPersonNum.Text = str.Split(';').Length.ToString();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |