private void DoSelect() { if (msg.State == "2") { msg.ReadCount = msg.ReadCount == null ? 1 : msg.ReadCount.Value + 1; msg.Save(); } if (msg.PostTime != null && msg.PostTime.HasValue) { msg.CreateName = ((DateTime)msg.PostTime).ToString("yyyy-MM-dd HH:mm"); } CollectionToUser[] cts = CollectionToUser.FindAllByProperties("MsgId", msg.Id, "UserId", UserInfo.UserID); PageState.Add("collection", cts.Length > 0 ? "on" : "off"); SetFormData(msg); PageState.Add("ReadStatus", (msg.ReadState + "").IndexOf(UserInfo.UserID)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string Id = Request.QueryString["id"]; ImgNews news = ImgNews.TryFind(Id); if (news == null) { return; } if (news.State == "2") { news.Ext1 = news.Ext1 == null ? "1" : (Convert.ToInt32(news.Ext1) + 1) + ""; news.DoUpdate(); } if (news != null) { this.lbltitle.InnerText = news.Title; this.lblPostDeptName.InnerText = news.PostDeptName; this.lblAuthorName.InnerText = news.CreateName; this.lblPostTime.InnerText = news.PostTime != null?news.PostTime.ToString() : ""; this.lblReadCount.InnerText = news.Ext1; if ((news.Ext2 + "").Contains(UserInfo.UserID)) { lblreadstate.Attributes.Add("style", "display:none"); } ImgNewDetail[] imgdetails = ImgNewDetail.FindAllByProperty("PId", news.Id); int index = 0; foreach (ImgNewDetail ent in imgdetails) { litimg.Text += "<img src='/Document/" + ent.ImgPath + "' width='780' height='570'/>"; litcontent.Text += "<p id='p" + index + "' style='margin-top:20px;'>" + ent.Content + "</p>"; litimgs.Text += "<li><img src='/Document/" + ent.ImgPath + "'/><tt></tt></li>"; index++; } CollectionToUser[] cts = CollectionToUser.FindAllByProperties("MsgId", news.Id, "UserId", UserInfo.UserID); hidcollection.Value = cts.Length > 0 ? "on" : "off"; } } }
private void Page_Load(object sender, System.EventArgs e) { if (this.Request["Id"] != null) { if (this.Request["Id"].Length == 8) { var _link = Aim.Common.ConfigurationHosting.SystemConfiguration.AppSettings["GoodwayPortalUrl"].Replace("/portal/Portal.aspx", ""); _link += "/officeauto/PubInfo/InformView.aspx?FuncType=View&Id=" + this.Request["Id"] + "&PassCode=" + Session["PassCode"]; Response.Redirect(_link); } News msg = News.Find(this.Request["Id"]); if (msg.State == "2") { msg.ReadCount = msg.ReadCount == null ? 1 : msg.ReadCount.Value + 1; msg.Save(); } if (msg.PostTime != null && msg.PostTime.HasValue) { msg.CreateName = ((DateTime)msg.PostTime).ToString("yyyy-MM-dd HH:mm"); } CollectionToUser[] cts = CollectionToUser.FindAllByProperties("MsgId", msg.Id, "UserId", UserInfo.UserID); PageState.Add("collection", cts.Length > 0 ? "on" : "off"); this.SetFormData(msg); } if (RequestActionString == "batchcollection") { //收藏 try { //object[] pram = { new SqlParameter("MsgId", RequestData["Id"]), new SqlParameter("UserId", UserInfo.UserID) }; CollectionToUser[] Ctus = CollectionToUser.FindAll("from CollectionToUser where MsgId='" + RequestData["Id"] + "' and UserId='" + UserInfo.UserID + "'"); if (Ctus.Length == 0) { CollectionToUser Ctu = new CollectionToUser(); Ctu.MsgId = RequestData["Id"] + ""; Ctu.UserId = UserInfo.UserID; Ctu.CreateId = UserInfo.UserID + ""; Ctu.CreateName = UserInfo.Name + ""; Ctu.DoSave(); this.PageState.Add("result", "已收藏"); } else { CollectionToUser.DoBatchDelete(Ctus[0].Id); this.PageState.Add("result", "已取消收藏"); } } catch (Exception ex) { this.PageState.Add("result", ex.Message); } } else if (RequestActionString == "readstate") { News msg = News.Find(this.RequestData["Id"]); //添加阅读状态 msg.ReadState = (msg.ReadState + "").Contains(UserInfo.UserID) ? msg.ReadState : msg.ReadState + UserInfo.UserID + ","; msg.DoUpdate(); } }
protected void Page_Load(object sender, System.EventArgs e) { if (this.Request["Id"] != null) { VideoNews msg = VideoNews.Find(this.Request["Id"]); if (msg != null) { if (msg.State == "2") { msg.Ext1 = msg.Ext1 == null ? "1" : (Convert.ToInt32(msg.Ext1) + 1) + ""; msg.Save(); } if (msg.PostTime != null && msg.PostTime.HasValue) { msg.CreateName = ((DateTime)msg.PostTime).ToString("yyyy-MM-dd HH:mm"); } CollectionToUser[] cts = CollectionToUser.FindAllByProperties("MsgId", msg.Id, "UserId", UserInfo.UserID); PageState.Add("collection", cts.Length > 0 ? "on" : "off"); this.SetFormData(msg); VideoNewDetail[] imgdetails = VideoNewDetail.FindAllByProperty("PId", msg.Id); if (imgdetails.Length > 0) { Url = imgdetails[0].ImgPath.TrimEnd(','); for (int i = 0; i < imgdetails.Length; i++) { litcontent.Text += "<p id='p" + i + "' style='margin-top: 20px;' tag='" + imgdetails[i].ImgPath + "'>" + imgdetails[i].Content + "</p>"; litimgs.Text += "<li><img src='" + imgdetails[i].Ext1 + "' /><tt></tt></li>"; } } } } if (RequestActionString == "batchcollection") { //收藏 try { //object[] pram = { new SqlParameter("MsgId", RequestData["Id"]), new SqlParameter("UserId", UserInfo.UserID) }; CollectionToUser[] Ctus = CollectionToUser.FindAll("from CollectionToUser where MsgId='" + RequestData["Id"] + "' and UserId='" + UserInfo.UserID + "'"); if (Ctus.Length == 0) { CollectionToUser Ctu = new CollectionToUser(); Ctu.MsgId = RequestData["Id"] + ""; Ctu.UserId = UserInfo.UserID; Ctu.CreateId = UserInfo.UserID + ""; Ctu.CreateName = UserInfo.Name + ""; Ctu.DoSave(); this.PageState.Add("result", "已收藏"); } else { CollectionToUser.DoBatchDelete(Ctus[0].Id); this.PageState.Add("result", "已取消收藏"); } } catch (Exception ex) { this.PageState.Add("result", ex.Message); } } else if (RequestActionString == "readstate") { VideoNews msg = VideoNews.Find(this.RequestData["Id"]); //添加阅读状态 msg.Ext2 = (msg.Ext2 + "").Contains(UserInfo.UserID) ? msg.Ext2 : msg.Ext2 + UserInfo.UserID + ","; msg.DoUpdate(); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Request["Id"] != null) { News msg = News.Find(this.Request["Id"]); if (msg.State == "2") { msg.ReadCount = msg.ReadCount == null ? 1 : msg.ReadCount.Value + 1; msg.Save(); } if (msg.PostTime != null && msg.PostTime.HasValue) { msg.CreateName = ((DateTime)msg.PostTime).ToString("yyyy-MM-dd HH:mm"); } CollectionToUser[] cts = CollectionToUser.FindAllByProperties("MsgId", msg.Id, "UserId", UserInfo.UserID); PageState.Add("collection", cts.Length > 0 ? "on" : "off"); this.SetFormData(msg); } if (RequestActionString == "batchcollection") { //收藏 try { //object[] pram = { new SqlParameter("MsgId", RequestData["Id"]), new SqlParameter("UserId", UserInfo.UserID) }; CollectionToUser[] Ctus = CollectionToUser.FindAll("from CollectionToUser where MsgId='" + RequestData["Id"] + "' and UserId='" + UserInfo.UserID + "'"); if (Ctus.Length == 0) { CollectionToUser Ctu = new CollectionToUser(); Ctu.MsgId = RequestData["Id"] + ""; Ctu.UserId = UserInfo.UserID; Ctu.CreateId = UserInfo.UserID + ""; Ctu.CreateName = UserInfo.Name + ""; Ctu.DoSave(); this.PageState.Add("result", "已收藏"); } else { CollectionToUser.DoBatchDelete(Ctus[0].Id); this.PageState.Add("result", "已取消收藏"); } } catch (Exception ex) { this.PageState.Add("result", ex.Message); } } else if (RequestActionString == "readstate") { News msg = News.Find(this.RequestData["Id"]); //添加阅读状态 msg.ReadState = (msg.ReadState + "").Contains(UserInfo.UserID) ? msg.ReadState : msg.ReadState + UserInfo.UserID + ","; msg.Save(); } //在线预览 if (RequestActionString == "View") { string fileName = RequestData["fileName"] + ""; string type = RequestData["type"] + ""; string path = "/Document/" + fileName; this.PageState.Add("filepath", path); this.PageState.Add("type", type); } }