protected void Page_Load(object sender, EventArgs e) { Log log = MainMasterPage.InitPage(this); int id = RequestUtils.GetGalleryImageId(this); this.SqlDataSource1.SelectParameters["GalleryImageId"].DefaultValue = id.ToString(); try { if (id != 0) { string name = null; using (GmConnection conn = Global.CreateConnection()) { name = conn.ExecuteScalar("select Name from GalleryImages where Id=" + id) as string; } if (name != null) { (this.Master as MainMasterPage).PageInfo.AddInfo(name); } } } catch (Exception ex) { log.Exception(ex); } }
protected void Page_Load(object sender, EventArgs e) { Log log = MainMasterPage.InitPage(this); // ucArticles.InitControl(ArticleType.Article, 3, false); try { ucPositions.InitControl("Positions", 8, false); Article article = null; using (var conn = Global.CreateConnection()) { article = Article.GetArticle(conn, "Default"); if (article != null) { ArticleParam.GetArticleParams(conn, article.Id, sd); } } // ucDigests.InitControl(ArticleType.Digest, 2, false); } catch (Exception ex) { log.Exception(ex); } }
protected void Page_Load(object sender, EventArgs e) { log = MainMasterPage.InitPage(this); int forumTopicId = RequestUtils.GetForumTopicId(this); this.SqlDataSource1.SelectParameters["ForumTopicId"].DefaultValue = forumTopicId.ToString(); try { string cmdText = "SELECT Forums.Id AS ForumId, Forums.Name AS ForumName, ForumTopics.Name AS ForumTopicName FROM Forums INNER JOIN ForumTopics ON Forums.Id = ForumTopics.ForumId WHERE (ForumTopics.Id = @ForumTopicId)"; using (GmConnection conn = Global.CreateConnection()) { GmCommand cmd = conn.CreateCommand(cmdText); cmd.AddInt("ForumTopicId", forumTopicId); using (GmDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { forumId = dr.GetInt(); forumName = dr.GetString(); forumTopicName = dr.GetString(); } else { return; } } } } catch (Exception ex) { log.Exception(ex); } }
protected void Page_Load(object sender, EventArgs e) { log = MainMasterPage.InitPage(this); try { log = new Log(this); if (!IsPostBack) { using (GmConnection conn = Global.CreateConnection()) { conn.Fill(dataTable, "select PollAnswers.* from PollAnswers where PollAnswers.Status>0 order by PollId desc, Count desc"); conn.Fill(pollQuestions, "select Id, Question from Polls"); } DataColumn dcId = dataTable.Columns["Id"]; DataColumn dcPollId = dataTable.Columns["PollId"]; DataColumn dcCount = dataTable.Columns["Count"]; DataColumn dcPercent = dataTable.Columns.Add("CountPercent", typeof(int)); foreach (DataRow dr in dataTable.Rows) { int id = (int)dr[dcId]; int pollId = (int)dr[dcPollId]; int count = (int)dr[dcCount]; if (pollCounts.ContainsKey(pollId)) { pollCounts[pollId] += count; } else { pollCounts[pollId] = count; } if (!firstIds.ContainsKey(pollId)) { firstIds[pollId] = id; } lastIds[pollId] = id; } foreach (DataRow dr in dataTable.Rows) { int pollId = (int)dr[dcPollId]; int count = (int)dr[dcCount]; int pollCount = pollCounts[pollId]; int countPercent = pollCount > 0?100 * count / pollCount:0; dr[dcPercent] = countPercent; } Repeater1.DataSource = dataTable; Repeater1.DataBind(); } } catch (Exception ex) { log.Exception(ex); } finally { } }
protected void Page_Load(object sender, EventArgs e) { log = MainMasterPage.InitPage(this); try { if (!IsPostBack) { ucCandidate.LoadData(); } } catch (Exception ex) { log.Exception(ex); lblResult.ForeColor = System.Drawing.Color.Red; lblResult.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { Log log = MainMasterPage.InitPage(this); try { int articleId = Utils.GetArticleId(this); if (articleId != 0) { Article article = null; // string articleTitle=null; string parentTag = null; using (GmConnection conn = Global.CreateConnection()) { article = Article.GetArticle(conn, articleId); if (article != null) { parentTag = article.GetParentTag(conn); } } if (article != null) { ucArticle.InitControl(article); (this.Master as MainMasterPage).PageInfo.AddInfo(article.title, "", article.header); if (article.isGroup) { ucArticles.InitControl(article.Id, 10, true); } else { ucArticles.Visible = false; } ucArticleControls.InitControl(parentTag, articleId); } } } catch (Exception ex) { log.Exception(ex); } }
protected void Page_Load(object sender, EventArgs e) { log = MainMasterPage.InitPage(this); int forumId = RequestUtils.GetForumId(this); this.SqlDataSource1.SelectParameters["ForumId"].DefaultValue = forumId.ToString(); try { Forum forum = null; using (GmConnection conn = Global.CreateConnection()) { forum = Forum.GetForum(conn, forumId); } if (forum != null) { forumName = forum.name; } } catch (Exception ex) { log.Exception(ex); } }
protected void Page_Load(object sender, EventArgs e) { MainMasterPage.InitPage(this); }