using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; using Model; using System.IO; namespace FineUIPro.Web.common.Notice { public partial class NoticeSign : PageBase { #region 定义项 public string NoticeId { get { return (string)ViewState["NoticeId"]; } set { ViewState["NoticeId"] = value; } } /// /// 办理类型 /// public string State { get { return (string)ViewState["State"]; } set { ViewState["State"] = value; } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadData(); this.drpSignMan.DataTextField = "UserName"; drpSignMan.DataValueField = "UserId"; drpSignMan.DataSource = (from x in Funs.DB.Sys_User where x.IsPost == true orderby x.UserName select x).ToList(); drpSignMan.DataBind(); Funs.FineUIPleaseSelect(this.drpSignMan); var systems = Funs.DB.Sys_System.FirstOrDefault(x => x.SystemId == this.CurrUser.LoginSystemId); if (systems != null) { if (systems.SystemType == Const.SystemType_0 || (systems.SystemType == Const.SystemType_1 && systems.IsMoreProject == false)) { this.trProjects.Hidden = false; this.trSystems.Hidden = false; } else { this.trProjects.Hidden = true; this.trSystems.Hidden = true; } } this.NoticeId = Request.QueryString["noticeId"]; State = BLL.Common_NoticeService.GetNoticeByNoticeId(NoticeId).State; if (!String.IsNullOrEmpty(State)) { this.drpSignStep.DataTextField = "Name"; drpSignStep.DataValueField = "Id"; this.drpSignStep.DataSource = BLL.Common_NoticeService.GetNetSignStepByState(State); this.drpSignStep.DataBind(); this.drpSignStep.SelectedIndex = 1; if (State == Const.Common_Notice_Sign) { this.drpSignMan.Enabled = false; } } Model.Common_Notice notice = BLL.Common_NoticeService.GetNoticeByNoticeId(NoticeId); if (notice != null) { this.txtNoticeCode.Text = notice.NoticeCode; this.txtNoticeTitle.Text = notice.NoticeTitle; if (notice.ClearUpMan != null) { Model.Sys_User clearUpMan = BLL.Sys_UserService.GetUsersByUserId(notice.ClearUpMan); if (clearUpMan != null) { this.txtClearUpMan.Text = clearUpMan.UserName; } } this.txtMainContent.Text = notice.MainContent; HyperLink hlAttachUrl = new HyperLink(); this.txtProjects.Text = notice.AccessProjectText; this.txtSystems.Text = notice.AccessSystemText; this.Grid1.DataSource = from x in Funs.DB.View_Common_NoticeSign where x.NoticeId == NoticeId && x.SinaDate != null select x; this.Grid1.DataBind(); } } } private void LoadData() { btnClose.OnClientClick = ActiveWindow.GetHideReference(); } #endregion #region 提交 /// /// 提交按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (this.GetRolePowerBySystemMenuId(BLL.Const.BtnSave)) { SaveData(true); } } /// /// 提交数据 /// private void SaveData(bool isClose) { if (isClose) { if (State != Const.Common_Notice_Sign) { if (this.drpSignMan.SelectedValue == BLL.Const._Null) { ShowNotify("请选择办理人员!", MessageBoxIcon.Warning); return; } } } if (State == Const.Common_Notice_Sign && this.rblIsAgree.SelectedValue == "True") { } else { if (this.drpSignMan.SelectedValue != BLL.Const._Null) { Model.Common_NoticeSign noticeSign = BLL.Common_NoticeSignService.GetNoticeSignByNoticeId(NoticeId); noticeSign.SinaDate = DateTime.Now; noticeSign.SignIdea = this.txtSignIdea.Text.Trim(); noticeSign.IsAgree = Convert.ToBoolean(this.rblIsAgree.SelectedValue); BLL.Common_NoticeSignService.UpdateNoticeSign(noticeSign); Model.Common_NoticeSign noticeSign1 = new Model.Common_NoticeSign(); noticeSign1.NoticeId = NoticeId; noticeSign1.SignMan = this.drpSignMan.SelectedValue; noticeSign1.SignStep = this.drpSignStep.SelectedValue; BLL.Common_NoticeSignService.AddNoticeSign(noticeSign1); } } Model.Common_Notice notice = new Model.Common_Notice(); notice.NoticeCode = this.txtNoticeCode.Text.Trim(); notice.NoticeTitle = this.txtNoticeTitle.Text.Trim(); if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) { notice.ProjectId = this.CurrUser.LoginProjectId; } notice.SystemId = this.CurrUser.LoginSystemId; notice.MainContent = this.txtMainContent.Text.Trim(); if (!string.IsNullOrEmpty(NoticeId)) { notice.NoticeId = NoticeId; Model.Common_Notice notice1 = BLL.Common_NoticeService.GetNoticeByNoticeId(NoticeId); //notice.AttachUrl = this.FullFilePath; notice.ClearUpMan = notice1.ClearUpMan; notice.IsRelease = notice1.IsRelease; notice.State = this.drpSignStep.SelectedValue; notice.AccessProjectId = notice1.AccessProjectId; notice.AccessSystemId = notice1.AccessSystemId; notice.AccessProjectText = notice1.AccessProjectText; notice.AccessSystemText = notice1.AccessSystemText; BLL.Common_NoticeService.UpdateNotice(notice); BLL.Sys_LogService.AddLog(this.CurrUser.LoginSystemId, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改通知"); } BLL.Sys_LogService.AddLog(this.CurrUser.LoginSystemId, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "编制通知"); if (isClose) { PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } #endregion #region 选择是否同意 /// /// 选择是否同意 /// /// /// protected void rblIsAgree_SelectedIndexChanged(object sender, EventArgs e) { this.drpSignMan.Enabled = true; if (this.rblIsAgree.SelectedValue == "True") { if (State == Const.Common_Notice_Sign) { this.drpSignMan.Enabled = false; } this.drpSignStep.SelectedIndex = 1; } else { this.drpSignStep.SelectedIndex = 0; } } #endregion #region 上传附件资源 /// /// 上传附件资源 /// /// /// protected void btnAttachUrl_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.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)) { edit = "1"; } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Notice&menuId={1}&edit={2}", NoticeId, menuId, edit))); } #endregion #region 根据不同的系统id得到该菜单的权限 /// /// 根据不同的系统id得到该菜单的权限 /// /// 按钮类型 /// private bool GetRolePowerBySystemMenuId(string btnType) { bool isRole = false; if (this.CurrUser.LoginSystemId == Const.System_1) { isRole = BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.Common_NoticeMenuId, btnType); } return isRole; } #endregion } }