升级
This commit is contained in:
@@ -0,0 +1,250 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
{
|
||||
public partial class MeetingEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string MeetingId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["MeetingId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["MeetingId"] = 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.MeetingId = Request.Params["MeetingId"];
|
||||
if (!string.IsNullOrEmpty(this.MeetingId))
|
||||
{
|
||||
Model.CQMS_Meeting meeting = BLL.MeetingService.GetMeetingById(this.MeetingId);
|
||||
if (meeting != null)
|
||||
{
|
||||
this.ProjectId = meeting.ProjectId;
|
||||
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.InitDropDownList();
|
||||
}
|
||||
///读取编号
|
||||
this.txtMeetingCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.MeetingId);
|
||||
this.txtMeetingName.Text = meeting.MeetingName;
|
||||
this.txtMeetingDate.Text = string.Format("{0:yyyy-MM-dd}", meeting.MeetingDate);
|
||||
if (meeting.AttentPersonNum != null)
|
||||
{
|
||||
this.txtAttentPersonNum.Text = meeting.AttentPersonNum.ToString();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(meeting.CompileMan))
|
||||
{
|
||||
this.drpCompileMan.SelectedValue = meeting.CompileMan;
|
||||
}
|
||||
this.txtMeetingContents.Text = HttpUtility.HtmlDecode(meeting.MeetingContents);
|
||||
this.txtMeetingHours.Text = Convert.ToString(meeting.MeetingHours);
|
||||
var hostMan = BLL.UserService.GetUserByUserId(meeting.MeetingHostMan);
|
||||
if (hostMan != null)
|
||||
{
|
||||
this.txtMeetingHostMan.Text = hostMan.UserName;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtMeetingHostMan.Text = meeting.MeetingHostMan;
|
||||
}
|
||||
this.txtAttentPerson.Text = meeting.AttentPerson;
|
||||
this.drpUnit.SelectedValue = meeting.UnitId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
||||
this.drpUnit.SelectedValue = this.CurrUser.UnitId ?? CommonService.GetThisUnitId();
|
||||
this.txtMeetingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
var codeTemplateRule = BLL.SysConstSetService.GetCodeTemplateRuleByMenuId(BLL.Const.CQMS_MeetingMenuId);
|
||||
if (codeTemplateRule != null)
|
||||
{
|
||||
this.txtMeetingContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template);
|
||||
}
|
||||
////自动生成编码
|
||||
this.txtMeetingCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.CQMS_MeetingMenuId, this.ProjectId, this.CurrUser.UnitId);
|
||||
this.txtMeetingName.Text = this.SimpleForm1.Title;
|
||||
this.txtMeetingHours.Text = "1";
|
||||
this.txtMeetingHostMan.Text = this.CurrUser.UserName;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 初始化下拉框
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
BLL.UnitService.InitProjectUnitDropDownList(this.drpUnit, this.ProjectId, false);
|
||||
BLL.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);
|
||||
var porject = BLL.ProjectService.GetProjectByProjectId(this.ProjectId);
|
||||
if (!string.IsNullOrWhiteSpace(porject.SubjectUnit) && !string.IsNullOrWhiteSpace(porject.SubjectProject))
|
||||
{//项目关联了总包单位项目,保存成功后自动推送至总包单位
|
||||
APICqmsMeetingSyncService.PushCqmsMeetingLists(this.ProjectId, this.MeetingId);
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
private void SaveData(string type)
|
||||
{
|
||||
Model.CQMS_Meeting meeting = new Model.CQMS_Meeting
|
||||
{
|
||||
ProjectId = this.ProjectId,
|
||||
MeetingCode = this.txtMeetingCode.Text.Trim(),
|
||||
MeetingName = this.txtMeetingName.Text.Trim(),
|
||||
MeetingDate = Funs.GetNewDateTime(this.txtMeetingDate.Text.Trim()),
|
||||
AttentPersonNum = Funs.GetNewIntOrZero(this.txtAttentPersonNum.Text.Trim()),
|
||||
MeetingContents = HttpUtility.HtmlEncode(this.txtMeetingContents.Text),
|
||||
CompileDate = DateTime.Now,
|
||||
MeetingHours = Funs.GetNewIntOrZero(this.txtMeetingHours.Text.Trim()),
|
||||
MeetingHostMan = this.txtMeetingHostMan.Text.Trim(),
|
||||
AttentPerson = this.txtAttentPerson.Text.Trim(),
|
||||
States = BLL.Const.State_2,
|
||||
};
|
||||
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
meeting.CompileMan = this.drpCompileMan.SelectedValue;
|
||||
}
|
||||
if (this.drpUnit.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
meeting.UnitId = this.drpUnit.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.MeetingId))
|
||||
{
|
||||
meeting.MeetingId = this.MeetingId;
|
||||
BLL.MeetingService.UpdateMeeting(meeting);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser,meeting.MeetingCode, meeting.MeetingId, BLL.Const.CQMS_MeetingMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.MeetingId = SQLHelper.GetNewID();
|
||||
meeting.MeetingId = this.MeetingId;
|
||||
BLL.MeetingService.AddMeeting(meeting);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, meeting.MeetingCode, meeting.MeetingId, BLL.Const.CQMS_MeetingMenuId, 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.MeetingId))
|
||||
{
|
||||
SaveData(BLL.Const.BtnSave);
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/MeetingAttachUrl&menuId={1}", MeetingId, BLL.Const.CQMS_MeetingMenuId)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnAttachUrl1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.MeetingId))
|
||||
{
|
||||
SaveData(Const.BtnSave);
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ClassMeetingAttachUrl&menuId={1}&strParam=1", this.MeetingId, Const.CQMS_MeetingMenuId)));
|
||||
}
|
||||
|
||||
protected void btnAttachUrl2_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.MeetingId))
|
||||
{
|
||||
SaveData(Const.BtnSave);
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ClassMeetingAttachUrl&menuId={1}&strParam=2", this.MeetingId, Const.CQMS_MeetingMenuId)));
|
||||
}
|
||||
|
||||
/// <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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user