protected override void ShowPage() { announceinfo = Announcements.GetAnnouncement(announceid); if (announceinfo == null) { AddErrLine("无该公告信息!"); return; } pagetitle = announceinfo.Title; UpdateMetaInfo(announceinfo.Title, config.Seodescription + Utils.CutString(Utils.RemoveHtml(announceinfo.Message), 0, 60), ""); AddLinkCss(rooturl + "templates/" + templatepath + "/css/channels.css"); string loadscript = "\r\n " + "jQuery(document).ready(function() {"; if (templateid == 1) { loadscript += "\r\n " + "jQuery(\"input[type=text],textarea\").each(function(){"; loadscript += "\r\n " + " jQuery(this).blur(function(){jQuery(this).attr(\"class\",\"input5_soout\");});"; loadscript += "\r\n " + " jQuery(this).focus(function(){jQuery(this).attr(\"class\",\"input5_soon\");});"; loadscript += "\r\n " + "});"; } loadscript += "\r\n " + "});\r\n"; AddfootScript(loadscript); activelist = Activities.GetActivityByIds(announceinfo.Relateactive); if (activelist.Length > 0) { curactiveid = TypeConverter.ObjectToInt(activelist[0]["id"], 0); curactivetitle = activelist[0]["atitle"].ToString(); } }
private void UpdateAnnounceInfo_Click(object sender, EventArgs e) { #region 更新公告相关信息 if (this.CheckCookie()) { AnnouncementInfo announcementInfo = new AnnouncementInfo(); announcementInfo.Id = SASRequest.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 = message.Text.Trim(); announcementInfo.Relateactive = SASRequest.GetString("TargetFID"); Announcements.UpdateAnnouncement(announcementInfo); //移除公告缓存 SAS.Cache.SASCache.GetCacheService().RemoveObject("/SAS/AnnouncementList"); SAS.Cache.SASCache.GetCacheService().RemoveObject("/SAS/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 }
/// <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> /// <param name="relateactive">相关活动</param> public static void CreateAnnouncement(string username, int userid, string subject, int displayorder, string starttime, string endtime, string message, string relateactive) { 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; announcementInfo.Relateactive = relateactive; Data.DataProvider.Announcements.CreateAnnouncement(announcementInfo); }
/// <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.DataProvider.Announcements.UpdateAnnouncement(announcementInfo); }
/// <summary> /// 添加公告 /// </summary> /// <param name="announcementInfo">公告对象</param> 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), DbHelper.MakeInParam("@relateactive",(DbType)SqlDbType.VarChar,2000,announcementInfo.Relateactive) }; string commandText = string.Format("INSERT INTO [{0}announcements] ([poster],[posterid],[title],[displayorder],[starttime],[endtime],[message],[relateactive]) VALUES(@poster, @posterid, @title, @displayorder, @starttime, @endtime, @message,@relateactive)", BaseConfigs.GetTablePrefix); return DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 更新通告 /// </summary> 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), DbHelper.MakeInParam("@relateactive",(DbType)SqlDbType.VarChar,2000,announcementInfo.Relateactive) }; string commandText = string.Format("UPDATE [{0}announcements] SET [displayorder]=@displayorder,[title]=@title, [poster]=@poster,[starttime]=@starttime,[endtime]=@endtime,[message]=@message,[relateactive]=@relateactive WHERE [id]=@id", BaseConfigs.GetTablePrefix); return DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 添加公告 /// </summary> /// <param name="announcementInfo">公告对象</param> public static void CreateAnnouncement(AnnouncementInfo announcementInfo) { DatabaseProvider.GetInstance().CreateAnnouncement(announcementInfo); }
/// <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(); announcementInfo.Relateactive = reader["relateactive"].ToString(); return announcementInfo; }