Beispiel #1
0
        /// <summary>
        /// 获取接收人员列表
        /// </summary>
        /// <param name="SectionHideID">隐藏域知</param>
        /// <param name="PointDept">指定部门</param>
        /// <param name="fenxiao">分销商</param>
        /// <param name="gongying">供应商</param>
        /// <param name="innerSection">公司内部</param>
        /// <returns></returns>
        protected IList <MGovNoticeReceiver> GetList(string SectionHideID, string PointDept, string fenxiao, string gongying, string innerSection)
        {
            IList <MGovNoticeReceiver> List  = new List <MGovNoticeReceiver>();
            MGovNoticeReceiver         model = null;

            if (!string.IsNullOrEmpty(PointDept) && !string.IsNullOrEmpty(SectionHideID))
            {
                string[] deptId = SectionHideID.Split(',');
                for (int i = 0; i < deptId.Length; i++)
                {
                    model          = new MGovNoticeReceiver();
                    model.ItemId   = deptId[i];
                    model.ItemType = EyouSoft.Model.EnumType.GovStructure.ItemType.指定部门;
                    List.Add(model);
                }
            }
            if (!string.IsNullOrEmpty(fenxiao))
            {
                model          = new MGovNoticeReceiver();
                model.ItemType = EyouSoft.Model.EnumType.GovStructure.ItemType.分销商;
                List.Add(model);
            }
            if (!string.IsNullOrEmpty(gongying))
            {
                model          = new MGovNoticeReceiver();
                model.ItemType = EyouSoft.Model.EnumType.GovStructure.ItemType.供应商;
                List.Add(model);
            }
            if (!string.IsNullOrEmpty(innerSection))
            {
                model          = new MGovNoticeReceiver();
                model.ItemType = EyouSoft.Model.EnumType.GovStructure.ItemType.公司内部;
                List.Add(model);
            }
            return(List);
        }
Beispiel #2
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';");
                }
            }
        }