コード例 #1
0
        /// <summary>
        /// 修改一个业务通告
        /// </summary>
        /// <param name="loggingSession">当前登录的信息</param>
        /// <param name="announce">要修改的业务通告</param>
        /// <returns></returns>
        public bool ModifyAnnounce(LoggingSessionInfo loggingSession, AnnounceInfo announce)
        {
            if (announce.AnnounceUnits == null || announce.AnnounceUnits.Count == 0)
            {
                throw new ArgumentNullException("announce.AnnounceUnits");
            }

            announce.ModifyUserID   = loggingSession.CurrentUser.User_Id;
            announce.ModifyUserName = loggingSession.CurrentUser.User_Name;
            //保存
            ISqlMapper sqlMap = cSqlMapper.Instance(loggingSession.CurrentLoggingManager);

            try
            {
                sqlMap.BeginTransaction();
                //修改通告信息
                sqlMap.Update("Exchange.Announce.Update", announce);
                //删除通告与单位的关系
                sqlMap.Delete("Exchange.AnnounceUnit.DeleteByAnnounceID", announce.ID);
                //插入通告与单位的关系
                foreach (AnnounceUnitInfo au in announce.AnnounceUnits)
                {
                    au.Announce = announce;
                    sqlMap.Insert("Exchange.AnnounceUnit.InsertAnnounceUnit", au);
                }
                sqlMap.CommitTransaction();
            }
            catch (Exception ex)
            {
                sqlMap.RollBackTransaction();
                throw ex;
            }

            return(true);
        }
コード例 #2
0
 private void _Announce(string name, string messeage, int stamp_id)
 {
     if (isOpen || announceQueue.Count > 0)
     {
         AnnounceInfo announceInfo = null;
         if (announceStock.Count > 0)
         {
             announceInfo = announceStock[0];
             announceStock.RemoveAt(0);
         }
         else
         {
             announceInfo = new AnnounceInfo();
         }
         announceInfo.name     = name;
         announceInfo.messeage = messeage;
         announceInfo.stampId  = stamp_id;
         announceQueue.Add(announceInfo);
     }
     else
     {
         if (stamp_id != 0)
         {
             _AnnounceStamp(name, stamp_id);
         }
         else
         {
             _AnnounceMesseage(name, messeage);
         }
         panelChange.UnLock();
     }
 }
コード例 #3
0
 /// <summary>
 /// 打开公告详情界面
 /// </summary>
 /// <param name="info"></param>
 /// <param name="mail"></param>
 public void OpenMsgDialog(AnnounceInfo info, MailInfo mail)
 {
     MsgDialog.SetActive(true);
     MsgTitleImage01.SetActive(info != null);
     MsgTitleImage02.SetActive(mail != null);
     MsgTitleText.text = info == null ? mail.Title : info.Title;
     MsgTxt.text       = info == null ? mail.Content : info.Content;
 }
コード例 #4
0
 /// <summary>
 /// 设置界面数据
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="data"></param>
 public void SetRecordItemData(Transform parent, AnnounceInfo data, MailInfo mail, GameNoticeCpt cpt)
 {
     this.GameObject.transform.SetParent(parent);
     this.GameObject.transform.localPosition = Vector3.zero;
     this.GameObject.transform.localScale    = Vector3.one;
     _MailInfo      = mail;
     _AnnounceInfo  = data;
     _GameNoticeCpt = cpt;
     TitleText.text = data == null ? mail.Title : data.Title;
     TimeText.text  = data == null ? mail.Timestamp : data.Timestamp;
 }
コード例 #5
0
        /// <summary>
        /// 创建Item  type=1 公告,type=2 邮件
        /// </summary>
        /// <param name="info"></param>
        private void CreateRecordListsItem(AnnounceInfo info, MailInfo mail, int type)
        {
            var view = ComponentFactory.CreateWithParent <UINoticeListItem>(this);

            view.InitData();
            if (type == 1)
            {
                view.SetRecordItemData(Content.transform, info, null, this);
            }
            else
            {
                view.SetRecordItemData(Content.transform, null, mail, this);
            }
            _RecordLists.Add(view);
        }
コード例 #6
0
        /// <summary>
        /// 添加一个业务通告
        /// </summary>
        /// <param name="loggingSession">当前登录的信息</param>
        /// <param name="announce">要添加的业务通告</param>
        /// <returns></returns>
        public bool InsertAnnounce(LoggingSessionInfo loggingSession, AnnounceInfo announce)
        {
            if (announce == null)
            {
                throw new ArgumentNullException("announce");
            }
            if (announce.AnnounceUnits == null || announce.AnnounceUnits.Count == 0)
            {
                throw new ArgumentNullException("announce.AnnounceUnits");
            }

            if (string.IsNullOrEmpty(announce.ID))
            {
                announce.ID = this.NewGuid();
            }
            announce.CreateUserID   = loggingSession.CurrentUser.User_Id;
            announce.CreateUserName = loggingSession.CurrentUser.User_Name;
            //保存
            ISqlMapper sqlMap = cSqlMapper.Instance(loggingSession.CurrentLoggingManager);

            try
            {
                sqlMap.BeginTransaction();
                //插入通告信息
                sqlMap.Insert("Exchange.Announce.Insert", announce);
                //插入通告与单位的关系
                foreach (AnnounceUnitInfo au in announce.AnnounceUnits)
                {
                    au.Announce = announce;
                    sqlMap.Insert("Exchange.AnnounceUnit.InsertAnnounceUnit", au);
                }
                sqlMap.CommitTransaction();
            }
            catch (Exception ex)
            {
                sqlMap.RollBackTransaction();
                throw ex;
            }

            return(true);
        }
コード例 #7
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        var announce = new AnnounceInfo();

        announce.Title     = this.tbTitle.Text.Trim();
        announce.Content   = this.tbContent.Text.Trim();
        announce.Publisher = this.tbPublisher.Text.Trim();
        announce.BeginDate = this.tbBeginDate.Value;
        announce.EndDate   = this.tbEndDate.Value;
        //announce.ModifyTime = Convert.ToDateTime(this.tbEditTime.Text);
        foreach (var item in this.tvUnit.SelectValues)
        {
            AnnounceUnitInfo info = new AnnounceUnitInfo(new UnitInfo {
                Id = item
            });
            announce.AnnounceUnits.Add(info);
        }
        //announce.AnnounceUnits
        var opertype = this.Request.QueryString["strDo"];

        if (opertype == "2")
        {
            try
            {
                announce.SystemModifyStamp = DateTime.Now;
                announce.AllowDownload     = 0;
                announce.CreateTime        = DateTime.Now;
                announce.CreateUserID      = loggingSessionInfo.CurrentUser.User_Id;
                if (exchangeService.InsertAnnounce(loggingSessionInfo, announce))
                {
                    this.Redirect("新建通告成功", InfoType.Info, this.Request.QueryString["from"] ?? "announce_query.aspx");
                }
                else
                {
                    this.InfoBox.ShowPopError("新建通告失败");
                }
            }
            catch (Exception ex)
            {
                PageLog.Current.Write(ex);
                this.InfoBox.ShowPopError("新建通告失败!");
            }
        }
        else
        {
            try
            {
                string announce_id = this.Request.QueryString["announce_id"];
                announce.ModifyTime = DateTime.Now;
                if (this.cbAllowDownload.Text == "否")
                {
                    announce.AllowDownload = 0;
                }
                else
                {
                    announce.AllowDownload = 1;
                }
                announce.ID = announce_id;
                announce.No = Convert.ToInt32(this.tbNo.Text);
                //announce.CreateTime = Convert.ToDateTime(this.tbCreateTime.Text);
                announce.CreateUserID = loggingSessionInfo.CurrentUser.User_Id;
                if (exchangeService.ModifyAnnounce(loggingSessionInfo, announce))
                {
                    this.Redirect("保存成功", InfoType.Info, this.Request.QueryString["from"] ?? "announce_query.aspx");
                }
                else
                {
                    this.InfoBox.ShowPopError("保存失败");
                }
            }
            catch (Exception ex)
            {
                PageLog.Current.Write(ex);
                this.InfoBox.ShowPopError("保存失败!");
            }
        }
    }