コード例 #1
0
        private void UpdateAnnounceInfo_Click(object sender, EventArgs e)
        {
            #region 更新公告相关信息

            if (this.CheckCookie())
            {
                AnnouncementInfo announcementInfo = new AnnouncementInfo();
                announcementInfo.Id = DNTRequest.GetInt("id",0);
                announcementInfo.Poster = poster.Text.Trim();
                announcementInfo.Title = title.Text.Trim();
                announcementInfo.Displayorder = TypeConverter.StrToInt(displayorder.Text);
                announcementInfo.Starttime = Convert.ToDateTime(starttime.Text);
                announcementInfo.Endtime = Convert.ToDateTime(endtime.Text);
                announcementInfo.Message = DNTRequest.GetString("announcemessage_hidden").Trim();
                Announcements.UpdateAnnouncement(announcementInfo);
                //移除公告缓存
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncementList");
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/SimplifiedAnnouncementList");

                //记录日志
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "更新公告", "更新公告,标题为:" + title.Text);
                base.RegisterStartupScript( "PAGE", "window.location.href='global_announcegrid.aspx';");
            }
            #endregion
        }
コード例 #2
0
ファイル: GlobalManage.cs プロジェクト: hanshion/DiscuzNt
 public int CreateAnnouncement(AnnouncementInfo announcementInfo)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@poster", (DbType)SqlDbType.NVarChar, 20, announcementInfo.Poster),
                                 DbHelper.MakeInParam("@posterid", (DbType)SqlDbType.Int, 4, announcementInfo.Posterid),
                                 DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 250, announcementInfo.Title),
                                 DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, announcementInfo.Displayorder),
                                 DbHelper.MakeInParam("@starttime", (DbType)SqlDbType.DateTime, 8, announcementInfo.Starttime),
                                 DbHelper.MakeInParam("@endtime", (DbType)SqlDbType.DateTime, 8, announcementInfo.Endtime),
                                 DbHelper.MakeInParam("@message", (DbType)SqlDbType.NText, 0, announcementInfo.Message)
                             };
     string commandText = string.Format("INSERT INTO [{0}announcements] ([poster],[posterid],[title],[displayorder],[starttime],[endtime],[message]) VALUES(@poster, @posterid, @title, @displayorder, @starttime, @endtime, @message)", BaseConfigs.GetTablePrefix);
     return DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
コード例 #3
0
ファイル: Announcements.cs プロジェクト: khaliyo/DiscuzNT
 /// <summary>
 /// 更新公告
 /// </summary>
 /// <param name="announcementInfo">公告对象</param>
 public static void UpdateAnnouncement(AnnouncementInfo announcementInfo)
 {
     DatabaseProvider.GetInstance().UpdateAnnouncement(announcementInfo);
 }
コード例 #4
0
ファイル: GlobalManage.cs プロジェクト: hanshion/DiscuzNt
 public int UpdateAnnouncement(AnnouncementInfo announcementInfo)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@id", (DbType)SqlDbType.Int, 4, announcementInfo.Id),
                                 DbHelper.MakeInParam("@poster", (DbType)SqlDbType.NVarChar, 20, announcementInfo.Poster),
                                 DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 250, announcementInfo.Title),
                                 DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, announcementInfo.Displayorder),
                                 DbHelper.MakeInParam("@starttime", (DbType)SqlDbType.DateTime, 8, announcementInfo.Starttime),
                                 DbHelper.MakeInParam("@endtime", (DbType)SqlDbType.DateTime, 8, announcementInfo.Endtime),
                                 DbHelper.MakeInParam("@message", (DbType)SqlDbType.NText, 0, announcementInfo.Message)
                             };
     string commandText = string.Format("UPDATE [{0}announcements] SET [displayorder]=@displayorder,[title]=@title, [poster]=@poster,[starttime]=@starttime,[endtime]=@endtime,[message]=@message WHERE [id]=@id",
                                         BaseConfigs.GetTablePrefix);
     return DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
コード例 #5
0
ファイル: Announcements.cs プロジェクト: khaliyo/DiscuzNT
 /// <summary>
 /// 装载实体对象
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 private static AnnouncementInfo LoadSingleAnnouncementInfo(IDataReader reader)
 {
     AnnouncementInfo announcementInfo = new AnnouncementInfo();
     announcementInfo.Id = TypeConverter.ObjectToInt(reader["id"]);
     announcementInfo.Poster = reader["poster"].ToString();
     announcementInfo.Posterid = TypeConverter.ObjectToInt(reader["posterid"]);
     announcementInfo.Title = reader["title"].ToString();
     announcementInfo.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"]);
     announcementInfo.Starttime = Convert.ToDateTime(reader["starttime"].ToString());
     announcementInfo.Endtime = Convert.ToDateTime(reader["endtime"].ToString());
     announcementInfo.Message = reader["message"].ToString();
     return announcementInfo;
 }
コード例 #6
0
ファイル: modcp.aspx.cs プロジェクト: khaliyo/DiscuzNT
 private bool UpdateAnnouncementOperation(int id)
 {
     string subject = DNTRequest.GetString("subject").Trim();
     string message = DNTRequest.GetString("message").Trim();
     if (Utils.StrIsNullOrEmpty(subject) || Utils.StrIsNullOrEmpty(message))
     {
         AddErrLine("主题或内容不能为空");
         return false;
     }
     DateTime startTime;
     DateTime endTime;
     DateTime.TryParse(DNTRequest.GetString("starttime"), out startTime);
     DateTime.TryParse(DNTRequest.GetString("endtime"), out endTime);
     if (startTime >= endTime)
     {
         AddErrLine("开始日期或结束日期非法,或者是开始日期与结束日期倒置");
         return false;
     }
     AnnouncementInfo announcementInfo = new AnnouncementInfo();
     announcementInfo.Id = id;
     announcementInfo.Poster = this.username;
     announcementInfo.Title = subject;
     announcementInfo.Displayorder = TypeConverter.StrToInt(DNTRequest.GetString("displayorder"));
     announcementInfo.Starttime = startTime;
     announcementInfo.Endtime = endTime;
     announcementInfo.Message = message;
     Announcements.UpdateAnnouncement(announcementInfo);
     AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, GetGroupTile(), DNTRequest.GetIP(), "更新公告", "更新公告,标题为:" + DNTRequest.GetString("title"));
     return true;
 }
コード例 #7
0
ファイル: modcp.aspx.cs プロジェクト: khaliyo/DiscuzNT
 private void GetOneAnnouncement(AnnouncementInfo announcementInfo)
 {
     subject = announcementInfo.Title;
     displayorder = announcementInfo.Displayorder.ToString();
     starttime = announcementInfo.Starttime.ToString();
     endtime = announcementInfo.Endtime.ToString();
     message = announcementInfo.Message;
 }
コード例 #8
0
ファイル: Announcements.cs プロジェクト: wenysky/dnt31-lite
 /// <summary>
 /// 更新公告
 /// </summary>
 /// <param name="aId">公告id</param>
 /// <param name="username">用户名</param>
 /// <param name="subject">公告主题</param>
 /// <param name="displayOrder">排序序号</param>
 /// <param name="startDateTime">起始时间</param>
 /// <param name="endDateTime">结束时间</param>
 /// <param name="message">公告内容</param>
 public static void UpdateAnnouncement(AnnouncementInfo announcementInfo)
 {
     if(announcementInfo.Id > 0)
         Data.Announcements.UpdateAnnouncement(announcementInfo);
 }
コード例 #9
0
ファイル: Announcements.cs プロジェクト: wenysky/dnt31-lite
        /// <summary>
        /// 添加公告
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="userId">用户id</param>
        /// <param name="subject">公告主题</param>
        /// <param name="displayOrder">排序序号</param>
        /// <param name="startDateTime">起始时间</param>
        /// <param name="endDateTime">结束时间</param>
        /// <param name="message">公告内容</param>
        public static void CreateAnnouncement(string username, int userid, string subject, int displayorder, string starttime, string endtime, string message)
        {
            AnnouncementInfo announcementInfo = new AnnouncementInfo();
            announcementInfo.Title = subject;
            announcementInfo.Poster = username;
            announcementInfo.Posterid = userid;
            announcementInfo.Displayorder = displayorder;
            DateTime dt;
            DateTime.TryParse(starttime, out dt);
            announcementInfo.Starttime = dt;
            DateTime.TryParse(endtime, out dt);
            announcementInfo.Endtime = dt;
            announcementInfo.Message = message;

            Data.Announcements.CreateAnnouncement(announcementInfo);
        }