Exemplo n.º 1
0
 /// <summary>
 /// 页面初始化
 /// </summary>
 /// <param name="id">操作ID</param>
 protected void PageInit(string id)
 {
     if (!string.IsNullOrEmpty(id))
     {
         BNotice    bllBNotice      = new BNotice();
         MGovNotice modelMGovNotice = bllBNotice.GetGovNoticeModel(id);
         if (modelMGovNotice != null)
         {
             //公告标题
             this.lblTitle.Text = modelMGovNotice.Title;
             //公告内容
             this.lblContent.Text = modelMGovNotice.Content;
             //公告发布人
             this.lblAddUser.Text = modelMGovNotice.Operator;
             //公告发布时间
             this.lblAddDate.Text = modelMGovNotice.IssueTime.ToLongDateString();
         }
         else
         {
             Response.Clear();
             Response.Write("没有该数据");
             Response.End();
         }
     }
     else
     {
         Response.Clear();
         Response.Write("缺少参数");
         Response.End();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 页面初始化
        /// </summary>
        /// <param name="id">操作ID</param>
        protected void PageInit(string id)
        {
            this.SelectSection1.ParentIframeID = Utils.GetQueryStringValue("iframeId");
            //通知公告实体类
            MGovNotice modelMGovNotice = new MGovNotice();
            //通知公告业务
            BNotice bllBNotice = new BNotice();

            modelMGovNotice = bllBNotice.GetGovNoticeModel(id);
            if (modelMGovNotice != null)
            {
                this.txtTitle.Text   = modelMGovNotice.Title;
                this.txtContent.Text = modelMGovNotice.Content;
                this.txtAddUser.Text = modelMGovNotice.Operator;
                this.txtAddDate.Text = modelMGovNotice.IssueTime.ToShortDateString();
            }
            else
            {
                this.txtAddUser.Text = SiteUserInfo.Username;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 页面初始化
        /// </summary>
        /// <param name="id">操作ID</param>
        protected void PageInit(string id)
        {
            #region 初始化用户控件
            this.SelectSection1.ParentIframeID = Utils.GetQueryStringValue("iframeId");
            this.SelectSection1.SModel         = "2";
            this.SelectSection1.SetTitle       = "指定部门";
            this.SingleFileUpload1.CompanyID   = this.SiteUserInfo.CompanyId;
            #endregion

            if (!string.IsNullOrEmpty(id))
            {
                EyouSoft.BLL.GovStructure.BNotice BLL = new EyouSoft.BLL.GovStructure.BNotice();
                MGovNotice Model = BLL.GetGovNoticeModel(id);
                if (null != Model)
                {
                    #region 普通赋值
                    //标题
                    this.txtTitle.Text     = Model.Title;
                    this.hidNotiecID.Value = Model.NoticeId;
                    //内容
                    this.txtContent.Text = Model.Content;
                    //消息内容
                    //this.msgContent.Text = Model.MsgContent;
                    //发布人
                    this.lbSender.Text = Model.Operator;
                    //发布时间
                    this.lbTime.Text = string.Format("{0:yyyy-MM-dd HH:mm}", Model.IssueTime);
                    #region 发布对象
                    IList <MGovNoticeReceiver> lst = Model.MGovNoticeReceiverList;
                    if (lst != null && lst.Count > 0)
                    {
                        string sectionID = "";
                        foreach (MGovNoticeReceiver item in lst)
                        {
                            switch (item.ItemType)
                            {
                            case EyouSoft.Model.EnumType.GovStructure.ItemType.指定部门:
                                PointDept.Checked = true;
                                sectionID        += item.ItemId.Trim() + ",";
                                break;

                            default:
                                break;
                            }
                        }
                        sectionID = sectionID.Length > 0 ? sectionID.Substring(0, sectionID.Length - 1) : "";
                        this.SelectSection1.SectionID   = sectionID;
                        this.SelectSection1.SectionName = GetDeptName(sectionID);
                    }
                    #endregion
                    #endregion

                    #region 附件处理
                    //附件
                    StringBuilder strFile = new StringBuilder();
                    IList <EyouSoft.Model.ComStructure.MComAttach> lstFile = Model.ComAttachList;
                    if (null != lstFile && lstFile.Count > 0)
                    {
                        for (int i = 0; i < lstFile.Count; i++)
                        {
                            strFile.AppendFormat("<span class='upload_filename'><a href='/CommonPage/FileDownLoad.aspx?doType=downLoad&filePath={0}&name={1}' target='_blank'>{1}</a><a href=\"javascript:void(0)\" onclick=\"PageJsData.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"hideFileInfo\" value='{1}|{0}'/></span>", lstFile[i].FilePath, lstFile[i].Name);
                        }
                    }
                    this.lbFiles.Text = strFile.ToString();//附件
                    #endregion

                    #region 权限判断
                    //权限判断
                    if (!this.SiteUserInfo.IsHandleElse && Model.OperatorId != this.SiteUserInfo.UserId)
                    {
                        this.ph_Save.Visible = false;
                    }
                    #endregion
                }
            }
            else
            {
                this.lbSender.Text = this.SiteUserInfo.Name;
                this.lbTime.Text   = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 页面保存
        /// </summary>
        protected void PageSave(string doType)
        {
            #region 表单取值
            Response.Clear();
            string msg           = "";
            bool   result        = false;
            string title         = Utils.GetFormValue(txtTitle.UniqueID);
            string id            = Utils.GetFormValue(hidNotiecID.UniqueID);
            string content       = Utils.GetFormValue(txtContent.UniqueID);
            string sectionhideid = Utils.GetFormValue(this.SelectSection1.SelectIDClient);
            string pointdept     = Utils.GetFormValue("PointDept");
            string innersection  = "公司内部";

            #endregion

            #region 表单验证
            if (string.IsNullOrEmpty(title))
            {
                msg += "-请输入公告标题!+<br/>";
            }
            if (string.IsNullOrEmpty(content))
            {
                msg += "-请输入公告内容!<br/>";
            }
            if (!string.IsNullOrEmpty(pointdept) && string.IsNullOrEmpty(sectionhideid))
            {
                msg += "-请选择指定部门!<br/>";
            }
            if (!string.IsNullOrEmpty(msg))
            {
                Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                Response.End();
                return;
            }
            #endregion

            #region 实体赋值
            EyouSoft.BLL.GovStructure.BNotice NoticeBLL = new BNotice();
            MGovNotice noticeModel = new MGovNotice();
            //消息类型 0:公告 1:学习交流
            noticeModel.NoticeType = "1";
            //公司编号
            noticeModel.CompanyId = this.SiteUserInfo.CompanyId;
            //公告标题
            noticeModel.Title    = title;
            noticeModel.NoticeId = id;
            //公告内容
            noticeModel.Content = content;
            //是否提醒
            noticeModel.IsRemind = false;
            //是否发送短信
            //noticeModel.IsMsg = ismsg == "sendMsg";
            noticeModel.IsMsg = false;
            //短信内容
            //noticeModel.MsgContent = msgcontent;
            //浏览量
            //noticeModel.Views = 0;
            //部门编号
            noticeModel.DepartId = this.SiteUserInfo.DeptId;
            //操作人编号
            noticeModel.OperatorId = this.SiteUserInfo.UserId;
            //操作时间
            noticeModel.IssueTime = DateTime.Now;
            //操作人
            noticeModel.Operator = this.SiteUserInfo.Name;// Username;
            //发布对象实体
            noticeModel.MGovNoticeReceiverList = GetList(sectionhideid, pointdept, "", "", innersection);

            noticeModel.ComAttachList = NewGetAttach();
            #endregion

            #region 提交回应
            if (doType == "update")
            {
                //如果公告编号不为空则为修改
                result = NoticeBLL.UpdateGovNotice(noticeModel);
                msg    = result ? "修改成功!" : "修改失败!";
            }
            else
            {
                //公告编号为空则新增
                result = NoticeBLL.AddGovNotice(noticeModel);
                msg    = result ? "添加成功!" : "添加失败!";
            }
            Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
            Response.End();
            #endregion
        }
Exemplo n.º 5
0
        /// <summary>
        /// 保存按钮点击事件执行方法
        /// </summary>
        protected void PageSave()
        {
            //通知公告实体类
            MGovNotice modelMGovNotice = new MGovNotice();
            //通知公告业务
            BNotice bllBNotice = new BNotice();
            //操作类型(添加  修改)
            string doType = "Add";

            //获取实体
            if (!string.IsNullOrEmpty(HidNoticeID.Value))
            {
                modelMGovNotice = bllBNotice.GetGovNoticeModel(HidNoticeID.Value);
                doType          = "Update";
            }

            #region 通知公告实体属性赋值

            #region 通知公告实体显性属性

            //标题
            string title = Utils.GetFormValue(txtTitle.UniqueID);
            //内容
            string content = Utils.GetFormValue(txtContent.UniqueID);
            //发布人
            string addUser = Utils.GetFormValue(txtAddUser.UniqueID);
            //发布时间
            string addDate = Utils.GetFormValue(txtAddDate.UniqueID);

            modelMGovNotice.Title     = title;
            modelMGovNotice.Content   = content;
            modelMGovNotice.Operator  = addUser;
            modelMGovNotice.IssueTime = Utils.GetDateTime(addDate);
            //附件实体
            modelMGovNotice.ComAttachList = null;

            #region 接收人员实体
            MGovNoticeReceiver        modelMGovNoticeReceiver = null;
            List <MGovNoticeReceiver> MGovNoticeReceiverlist  = new List <MGovNoticeReceiver>();

            #region 公司内部(选择所有部门)
            if (cbxAll.Checked)
            {
                modelMGovNoticeReceiver          = new MGovNoticeReceiver();
                modelMGovNoticeReceiver.ItemType = ItemType.公司内部;
                modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId;
                MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver);
                //释放实体资源
                modelMGovNoticeReceiver = null;
            }

            #endregion

            #region 指定部门
            if (cbxSelect.Checked)
            {
                //指定部门ids值
                string selectDepartlist = Utils.GetFormValue("SectionHideID");
                if (!string.IsNullOrEmpty(selectDepartlist))
                {
                    if (selectDepartlist.Contains(","))
                    {
                        //循环指定部门存入数据库
                        foreach (string strid in selectDepartlist.Split(','))
                        {
                            MGovNoticeReceiver modelselectReceiver = new MGovNoticeReceiver();
                            modelselectReceiver.ItemId   = strid;
                            modelselectReceiver.ItemType = ItemType.指定部门;
                            modelselectReceiver.NoticeId = modelMGovNotice.NoticeId;
                            MGovNoticeReceiverlist.Add(modelselectReceiver);
                            //释放实体资源
                            modelselectReceiver = null;
                        }
                    }
                    else
                    {
                        modelMGovNoticeReceiver.ItemId   = selectDepartlist;
                        modelMGovNoticeReceiver.ItemType = ItemType.指定部门;
                        modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId;
                        MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver);
                        //释放实体资源
                        modelMGovNoticeReceiver = null;
                    }
                }
            }
            #endregion

            #region  行社
            if (cbxPeer.Checked)
            {
                modelMGovNoticeReceiver          = new MGovNoticeReceiver();
                modelMGovNoticeReceiver.ItemType = ItemType.行社;
                modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId;
                MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver);
                //释放实体资源
                modelMGovNoticeReceiver = null;
            }

            #endregion

            #region 组团社
            if (cbxGrounp.Checked)
            {
                modelMGovNoticeReceiver          = new MGovNoticeReceiver();
                modelMGovNoticeReceiver.ItemType = ItemType.组团社;
                modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId;
                MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver);
                //释放实体资源
                modelMGovNoticeReceiver = null;
            }

            #endregion

            #endregion

            modelMGovNotice.MGovNoticeReceiverList = MGovNoticeReceiverlist;
            #endregion

            #region 通知公告实体隐形属性
            //操作人id
            modelMGovNotice.OperatorId = SiteUserInfo.UserId;
            //短信内容
            modelMGovNotice.MsgContent = "";
            //是否提醒
            modelMGovNotice.IsRemind = false;
            //是否发送短信
            modelMGovNotice.IsMsg = false;
            //公司编号
            modelMGovNotice.CompanyId = SiteUserInfo.CompanyId;

            #endregion

            #endregion

            bool result = false;
            //新增公告
            if (doType == "Add")
            {
                modelMGovNotice.NoticeId = Guid.NewGuid().ToString();
                result = bllBNotice.AddGovNotice(modelMGovNotice);
                if (result)
                {
                    EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('新增成功!');;window.location='NoticeList.aspx?sl=1';");
                }
                else
                {
                    EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('新增失败!');;window.location='NoticeList.aspx?sl=1';");
                }
            }
            else//修改公告
            {
                result = bllBNotice.UpdateGovNotice(modelMGovNotice);
                if (result)
                {
                    EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('修改成功!');;window.location='NoticeList.aspx?sl=1';");
                }
                else
                {
                    EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('修改失败!');;window.location='NoticeList.aspx?sl=1';");
                }
            }
        }