165 lines
6.2 KiB
C#
165 lines
6.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.common.Notice
|
|
{
|
|
public partial class NoticeFinalFile : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 培管理通知主键
|
|
/// </summary>
|
|
public string NoticeId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["NoticeId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["NoticeId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
this.drpClearUpMan.DataTextField = "UserName";
|
|
drpClearUpMan.DataValueField = "UserId";
|
|
drpClearUpMan.DataSource = (from x in Funs.DB.Sys_User where x.IsPost == true orderby x.UserName select x).ToList();
|
|
drpClearUpMan.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpClearUpMan);
|
|
NoticeId = Request.Params["NoticeId"];
|
|
Model.Common_Notice notice = BLL.Common_NoticeService.GetNoticeByNoticeId(this.NoticeId);
|
|
if (notice != null)
|
|
{
|
|
this.txtNoticeCode.Text = notice.NoticeCode;
|
|
this.txtNoticeTitle.Text = notice.NoticeTitle;
|
|
this.drpClearUpMan.SelectedValue = notice.ClearUpMan;
|
|
this.txtMainContent.Text = notice.MainContent;
|
|
this.btnSave.Hidden = true;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 提交
|
|
/// <summary>
|
|
/// 提交
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
SaveData(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 提交
|
|
/// </summary>
|
|
/// <param name="isClose"></param>
|
|
private void SaveData(bool isClose)
|
|
{
|
|
if (this.drpClearUpMan.SelectedValue == "0")
|
|
{
|
|
ShowNotify("请选择整理人!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
Model.Common_Notice oldNotice = BLL.Common_NoticeService.GetNoticeByNoticeId(NoticeId);
|
|
if (oldNotice == null)
|
|
{
|
|
Model.Common_Notice notice = new Model.Common_Notice();
|
|
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
{
|
|
notice.ProjectId = this.CurrUser.LoginProjectId;//当前项目
|
|
}
|
|
notice.SystemId = this.CurrUser.LoginSystemId; //当前系统
|
|
notice.NoticeCode = this.txtNoticeCode.Text.Trim();
|
|
notice.NoticeTitle = this.txtNoticeTitle.Text.Trim();
|
|
notice.IsRelease = false;
|
|
if (this.drpClearUpMan.SelectedValue != "0")
|
|
{
|
|
notice.ClearUpMan = this.drpClearUpMan.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
notice.ClearUpMan = null;
|
|
}
|
|
notice.MainContent = this.txtMainContent.Text.Trim();
|
|
notice.Flag = "1"; //定稿文件
|
|
notice.State = Const.Common_Notice_ApproveCompleted;
|
|
notice.AccessProjectId = this.CurrUser.LoginProjectId;
|
|
notice.AccessSystemId = this.CurrUser.LoginSystemId;
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.Common_Notice));
|
|
if (!string.IsNullOrEmpty(NoticeId))
|
|
{
|
|
notice.NoticeId = NoticeId;
|
|
Model.Common_Notice notice1 = BLL.Common_NoticeService.GetNoticeByNoticeId(NoticeId);
|
|
BLL.Common_NoticeService.UpdateNotice(notice);
|
|
BLL.Sys_LogService.AddLog(this.CurrUser.LoginSystemId, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改管理通知定稿文件");
|
|
}
|
|
else
|
|
{
|
|
notice.NoticeId = newKeyID;
|
|
NoticeId = newKeyID;
|
|
notice.CompileDate = System.DateTime.Now;
|
|
BLL.Common_NoticeService.AddNotice(notice);
|
|
BLL.Sys_LogService.AddLog(this.CurrUser.LoginSystemId, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加管理通知定稿文件");
|
|
}
|
|
}
|
|
if (isClose)
|
|
{
|
|
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 上传附件资源
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpClearUpMan.SelectedValue == "0")
|
|
{
|
|
ShowNotify("请选择整理人!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(NoticeId))
|
|
{
|
|
SaveData(false);
|
|
}
|
|
string menuId = string.Empty;
|
|
if (this.CurrUser.LoginSystemId == Const.System_1)
|
|
{
|
|
menuId = BLL.Const.Common_NoticeMenuId;
|
|
}
|
|
|
|
string edit = "0";
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, menuId, BLL.Const.BtnSave) && string.IsNullOrEmpty(Request.Params["NoticeId"]))
|
|
{
|
|
edit = "1";
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Notice&menuId={1}&edit={2}", NoticeId, menuId, edit)));
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |