protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ID"] == null) { return; } int ID = Convert.ToInt32(Request.QueryString["ID"]); News article = new News(); NewsInfo articleInfo = article.getArticle(ID); labHeadline.InnerText = articleInfo.Headline; labSummary.InnerText = articleInfo.Summary; labContent.InnerHtml = articleInfo.Content; //show the image in the gallery List <ImageInfo> articleImages = articleInfo.getImageList(); if (articleImages.Count >= 3) { imgSummary.ImageUrl = "Service/ImageHandler.ashx?ID=" + articleImages[2].ID.ToString(); } ImageInfo imageinfo; for (int i = 3; i < articleImages.Count; i++) { imageinfo = articleImages[i]; imageContent.Append("<div><a href='Service/ImageHandler.ashx?ID="); imageContent.Append(imageinfo.ID.ToString()); imageContent.Append("' title='"); imageContent.Append(imageinfo.Description); imageContent.Append("'><img src='Service/PreviewImageHandler.ashx?maxLength=199&ID="); imageContent.Append(imageinfo.ID.ToString()); imageContent.Append("'"); imageContent.Append(" /></a><p>"); imageContent.Append(imageinfo.Description); imageContent.Append("</p></div>"); } //show the attachment in the news details page List <FileInfo> articleAttachment = articleInfo.getFileList(); System.Text.StringBuilder attachmentContent = new System.Text.StringBuilder(); FileInfo fileInfo; for (int i = 0; i < articleAttachment.Count; i++) { if (i == 0) { attachmentContent.Append("<br/><p><u><b>Attachment: </b></u></p>"); } fileInfo = articleAttachment[i]; attachmentContent.Append("<a href='Service/FileService.aspx?ID="); attachmentContent.Append(fileInfo.ID); attachmentContent.Append("'>"); attachmentContent.Append(fileInfo.Description); attachmentContent.Append("</a><br/>"); } labAttachment.InnerHtml = attachmentContent.ToString(); File file = new File(); System.Text.StringBuilder newsLetters = file.getQuickLinkList(2); divNewsLetters.InnerHtml = newsLetters.ToString(); this.ControlDataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.setMaxLength(); this.ControlDataBind(); } //get latest article News article = new News(); List <NewsInfo> latestList = article.getLatestNews(5); latestNews = new System.Text.StringBuilder(); int i = 0; foreach (NewsInfo news in latestList) { i++; if (latestNews.Length == 0) { //the height light news NewsInfo articleInfo = latestList[0]; headline = articleInfo.Headline.Replace("\r\n", " "); summary = articleInfo.Summary.Replace("\r\n", " "); List <ImageInfo> imageList = articleInfo.getImageList(); summaryimage = "Service/ImageHandler.ashx?ID=" + imageList[0].ID.ToString(); summaryimage2 = "Service/ImageHandler.ashx?ID=" + imageList[1].ID.ToString(); articleLink = "ViewArticle.aspx?ID=" + articleInfo.ID.ToString(); } //append top 5 news if (news.NewIconInfo != null && DateTime.Now.Date < news.NewIconInfo.ExpiryDate) { //latestNews.Append(string.Format("<li style='word-wrap:break-word;'><a href='{1}' style='position: relative;'><span class='blueFont'>{2:" // + GlobalSetting.DateTimeFormat // + "}</span><span style='margin-right: 25px;'>   {0}   </span><img src='Resource/Image/New_icons.gif' style='position: absolute; bottom: 0.5px;'></a></li>", // news.Title, // "ViewArticle.aspx?ID=" + news.ID.ToString(), // news.EffectiveDate)); latestNews.Append(string.Format("<li class='newIcon' style='word-wrap:break-word;'><a href='{1}' style='position: relative;'><span class='blueFont'>{2:" + GlobalSetting.DateTimeFormat + "}</span>   {0} </a></li>", news.Title, "ViewArticle.aspx?ID=" + news.ID.ToString(), news.EffectiveDate)); } else { latestNews.Append(string.Format("<li style='word-wrap:break-word;'><a href='{1}' style='position: relative;'><span class='blueFont'>{2:" + GlobalSetting.DateTimeFormat + "}</span>   {0} </a></li>", news.Title, "ViewArticle.aspx?ID=" + news.ID.ToString(), news.EffectiveDate)); } } //get top 5 training Training trainingHandler = new Training(); List <TrainingInfo> latestTrainingList = trainingHandler.getLatestTrainings(5); latestTraining = new System.Text.StringBuilder(); foreach (TrainingInfo training in latestTrainingList) { if (training.NewIconInfo != null && DateTime.Now.Date < training.NewIconInfo.ExpiryDate) { latestTraining.Append(string.Format("<li class='newIcon' style='word-wrap:break-word;'><a href='{1}'><span class='blueFont'>{2:" + GlobalSetting.DateTimeFormat + "}</span>   {0} </a></li>", training.Name, "ViewTraining.aspx?ID=" + training.ID.ToString(), training.Schedule[0].StartTime)); } else { latestTraining.Append(string.Format("<li style='word-wrap:break-word;'><a href='{1}'><span class='blueFont'>{2:" + GlobalSetting.DateTimeFormat + "}</span>   {0} </a></li>", training.Name, "ViewTraining.aspx?ID=" + training.ID.ToString(), training.Schedule[0].StartTime)); } } //get top 5 Event Event eventHandler = new Event(); List <EventInfo> eventList = eventHandler.getLatestEvent(5); latestEvent = new System.Text.StringBuilder(); foreach (EventInfo eventInfo in eventList) { if (eventInfo.NewIconInfo != null && DateTime.Now.Date < eventInfo.NewIconInfo.ExpiryDate) { latestEvent.Append(string.Format("<li class='newIcon' style='word-wrap:break-word;'><a href='{1}'><span class='blueFont'>{2:" + GlobalSetting.DateTimeFormat + "}</span>   {0}</a></li>", eventInfo.Name, "ViewEvent.aspx?ID=" + eventInfo.ID.ToString(), eventInfo.StartTime)); } else { latestEvent.Append(string.Format("<li style='word-wrap:break-word;'><a href='{1}'><span class='blueFont'>{2:" + GlobalSetting.DateTimeFormat + "}</span>   {0}</a></li>", eventInfo.Name, "ViewEvent.aspx?ID=" + eventInfo.ID.ToString(), eventInfo.StartTime)); } } File file = new File(); System.Text.StringBuilder quickLinkBuilder = file.getQuickLinkList(1); divQuickLinks.InnerHtml = quickLinkBuilder.ToString(); System.Text.StringBuilder newsLetters = file.getQuickLinkList(2); divNewsLetters.InnerHtml = newsLetters.ToString(); //get top 5 other system links OtherSystemLink otherSystemLink = new OtherSystemLink(); List <OtherSystemLinkInfo> otherSystemLinkList = otherSystemLink.getSystemLinkDetailList(); otherSystems = new System.Text.StringBuilder(); foreach (OtherSystemLinkInfo item in otherSystemLinkList) { otherSystems.Append(string.Format("<li style='word-wrap:break-word;'><a href='{1}'>{0}</a></li>", item.Name, "javascript: var win = window.open(\"" + item.Link + "\");")); } //link icon linkIcon = new System.Text.StringBuilder(); List <LinkIconInfo> linkIconList = new LinkIcon().getAllActiveIconList(); isNoIcon = true; foreach (LinkIconInfo item in linkIconList) { isNoIcon = false; linkIcon.Append(string.Format("<div><a href='{0}'><img src='{1}' /><span> {2}</span></a></div>", "javascript: var win = window.open(\"" + item.Link + "\");" , "Service/ImageHandler.ashx?ID=" + item.ImageID, item.IconName)); } }