protected void btnLogin_Click(object sender, EventArgs e) { DBMater dbm = new DBMater(); SqlCommand adcmd = new SqlCommand("Select Count(1) from FBAdmin where UserName = @UserName and Password = @Password"); adcmd.CommandType = System.Data.CommandType.Text; adcmd.Connection = dbm.GetConnection(); adcmd.Parameters.AddWithValue("@UserName", inputUser.Text.Trim()); adcmd.Parameters.AddWithValue("@Password", inputPassword.Text.Trim()); int count = Convert.ToInt32(adcmd.ExecuteScalar()); if (count == 1) { Session["UserName"] = inputUser.Text.Trim(); Response.Redirect("Admin.aspx"); } else { lblErrorMessage.Visible = true; } dbm.closeConnection(); }
protected void Page_Load(object sender, EventArgs e) { DBMater dbm = new DBMater(); Label1.Text = Request.QueryString["testxxid"].ToString(); int TNews = int.Parse(Label1.Text); SqlDataReader Newsrdr = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = " + TNews + ""); //SqlDataReader Newsrdr = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = 2"); while (Newsrdr.Read()) { byte[] imagedata = (byte[])Newsrdr["Data"]; string img = Convert.ToBase64String(imagedata, 0, imagedata.Length); Image1.ImageUrl = "data:image/png;base64," + img; Test00.Append("<a>" + Newsrdr[1] + "</a><br/><br/>"); Test00.Append("<a>" + Newsrdr[2] + "</a><br/><br/>"); Test00.Append("<a>" + Newsrdr[3] + "</a><br/><br/>"); } Label1.Controls.Add(new Literal { Text = Test00.ToString() }); Newsrdr.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DBMater dbm = new DBMater(); SqlDataReader NewsCardsrdr = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews ORDER BY IDNews DESC;"); NewsCards(NewsCardsrdr); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DBMater dbm = new DBMater(); #region TableLaliga SqlDataReader LFPrdr = dbm.GetReader("SELECT * FROM FBClub where LeagueID = 504 ORDER BY Points DESC;"); Laligatable.Append("<table class='table'>"); Laligatable.Append("<thead class='thead-dark'>"); Laligatable.Append("<tr><th scope ='col'> Position</th><th scope = 'col'> Club</th><th scope = 'col'> Played</th><th scope = 'col'> Won</th><th scope = 'col'> Drawn</th>"); Laligatable.Append("<th scope ='col'> Lost</th><th scope = 'col'> GF</th><th scope = 'col'> GA</th><th scope = 'col'> GD</th><th scope = 'col'> Points</th>"); Laligatable.Append("</tr>"); Laligatable.Append("</thead>"); if (LFPrdr.HasRows) { int i = 1; while (LFPrdr.Read()) { Laligatable.Append("<tbody>"); Laligatable.Append("<tr>"); Laligatable.Append("<td><a style='color:#f7560c'> " + i++ + "</a></td>"); Laligatable.Append("<td>" + LFPrdr[1] + "</td>"); Laligatable.Append("<td>" + LFPrdr[2] + "</td>"); Laligatable.Append("<td>" + LFPrdr[3] + "</td>"); Laligatable.Append("<td>" + LFPrdr[4] + "</td>"); Laligatable.Append("<td>" + LFPrdr[5] + "</td>"); Laligatable.Append("<td>" + LFPrdr[6] + "</td>"); Laligatable.Append("<td>" + LFPrdr[7] + "</td>"); Laligatable.Append("<td>" + LFPrdr[8] + "</td>"); Laligatable.Append("<td>" + LFPrdr[9] + "</td>"); Laligatable.Append("</tr>"); Laligatable.Append("</tbody>"); } } Laligatable.Append("</table>"); LFPPlaceHolder.Controls.Add(new Literal { Text = Laligatable.ToString() }); LFPrdr.Close(); #endregion #region PlayerLaliga SqlDataReader Plrdr = dbm.GetReader("select PlayerName, FBPlayer.Position, Nationality, ClubName from FBPlayer inner join FBClub on FBPlayer.ClubID = FBClub.ClubID where FBClub.LeagueID = 504"); Laligaplayer.Append("<table class='table'>"); Laligaplayer.Append("<thead class='thead-dark'>"); Laligaplayer.Append("<tr><th scope ='col'> Position</th><th scope = 'col'> PlayerName</th><th scope = 'col'> Position</th><th scope = 'col'> Nationality</th><th scope = 'col'> Club</th>"); Laligaplayer.Append("</tr>"); Laligaplayer.Append("</thead>"); if (Plrdr.HasRows) { int i = 1; while (Plrdr.Read()) { Laligaplayer.Append("<tbody>"); Laligaplayer.Append("<tr>"); Laligaplayer.Append("<td><a style='color:#f7560c'> " + i++ + "</a></td>"); Laligaplayer.Append("<td>" + Plrdr[0] + "</td>"); Laligaplayer.Append("<td>" + Plrdr[1] + "</td>"); Laligaplayer.Append("<td>" + Plrdr[2] + "</td>"); Laligaplayer.Append("<td>" + Plrdr[3] + "</td>"); Laligaplayer.Append("</tr>"); Laligaplayer.Append("</tbody>"); } } Laligaplayer.Append("</table>"); phPlayerLFP.Controls.Add(new Literal { Text = Laligaplayer.ToString() }); Plrdr.Close(); #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DBMater dbm = new DBMater(); #region TablePremierleague SqlDataReader EPLrdr = dbm.GetReader("SELECT ClubName, Played, GD, Points FROM FBClub where LeagueID = 505 ORDER BY Points DESC;"); EPLtable.Append("<table class='table'>"); EPLtable.Append("<thead>"); EPLtable.Append("<tr><th scope ='col'> Pos</th><th scope = 'col'> Club</th><th scope = 'col'> Pl</th><th scope = 'col'> GD</th><th scope = 'col'> Pts</th></tr>"); EPLtable.Append("</tr>"); EPLtable.Append("</thead>"); if (EPLrdr.HasRows) { int i = 1; while (EPLrdr.Read()) { EPLtable.Append("<tbody>"); EPLtable.Append("<tr>"); EPLtable.Append("<td>" + i++ + "</td>"); EPLtable.Append("<td>" + EPLrdr[0] + "</td>"); EPLtable.Append("<td>" + EPLrdr[1] + "</td>"); EPLtable.Append("<td>" + EPLrdr[2] + "</td>"); EPLtable.Append("<td>" + EPLrdr[3] + "</td>"); EPLtable.Append("</tr>"); EPLtable.Append("</tbody>"); } } EPLtable.Append("</table>"); EPLPlaceHolder.Controls.Add(new Literal { Text = EPLtable.ToString() }); EPLrdr.Close(); #endregion #region TableFBLaLiga SqlDataReader LFPrdr = dbm.GetReader("SELECT ClubName, Played, GD, Points FROM FBClub where LeagueID = 504 ORDER BY Points DESC;"); LFPtable.Append("<table class='table'>"); LFPtable.Append("<thead>"); LFPtable.Append("<tr><th scope ='col'> Pos</th><th scope = 'col'> Club</th><th scope = 'col'> Pl</th><th scope = 'col'> GD</th><th scope = 'col'> Pts</th></tr>"); LFPtable.Append("</tr>"); LFPtable.Append("</thead>"); if (LFPrdr.HasRows) { int i = 1; while (LFPrdr.Read()) { LFPtable.Append("<tbody>"); LFPtable.Append("<tr>"); LFPtable.Append("<td>" + i++ + "</td>"); LFPtable.Append("<td>" + LFPrdr[0] + "</td>"); LFPtable.Append("<td>" + LFPrdr[1] + "</td>"); LFPtable.Append("<td>" + LFPrdr[2] + "</td>"); LFPtable.Append("<td>" + LFPrdr[3] + "</td>"); LFPtable.Append("</tr>"); LFPtable.Append("</tbody>"); } } LFPtable.Append("</table>"); LFPPlaceHolder.Controls.Add(new Literal { Text = LFPtable.ToString() }); LFPrdr.Close(); #endregion #region TableFBBL SqlDataReader BLrdr = dbm.GetReader("SELECT ClubName, Played, GD, Points FROM FBClub where LeagueID = 501 ORDER BY Points DESC;"); BLtable.Append("<table class='table'>"); BLtable.Append("<thead>"); BLtable.Append("<tr><th scope ='col'> Pos</th><th scope = 'col'> Club</th><th scope = 'col'> Pl</th><th scope = 'col'> GD</th><th scope = 'col'> Pts</th></tr>"); BLtable.Append("</tr>"); BLtable.Append("</thead>"); if (BLrdr.HasRows) { int i = 1; while (BLrdr.Read()) { BLtable.Append("<tbody>"); BLtable.Append("<tr>"); BLtable.Append("<td>" + i++ + "</td>"); BLtable.Append("<td>" + BLrdr[0] + "</td>"); BLtable.Append("<td>" + BLrdr[1] + "</td>"); BLtable.Append("<td>" + BLrdr[2] + "</td>"); BLtable.Append("<td>" + BLrdr[3] + "</td>"); BLtable.Append("</tr>"); BLtable.Append("</tbody>"); } } BLtable.Append("</table>"); BLPlaceHolder.Controls.Add(new Literal { Text = BLtable.ToString() }); BLrdr.Close(); #endregion #region TableFBSA SqlDataReader SArdr = dbm.GetReader("SELECT ClubName, Played, GD, Points FROM FBClub where LeagueID = 502 ORDER BY Points DESC;"); SAtable.Append("<table class='table'>"); SAtable.Append("<thead>"); SAtable.Append("<tr><th scope ='col'> Pos</th><th scope = 'col'> Club</th><th scope = 'col'> Pl</th><th scope = 'col'> GD</th><th scope = 'col'> Pts</th></tr>"); SAtable.Append("</tr>"); SAtable.Append("</thead>"); if (SArdr.HasRows) { int i = 1; while (SArdr.Read()) { SAtable.Append("<tbody>"); SAtable.Append("<tr>"); SAtable.Append("<td>" + i++ + "</td>"); SAtable.Append("<td>" + SArdr[0] + "</td>"); SAtable.Append("<td>" + SArdr[1] + "</td>"); SAtable.Append("<td>" + SArdr[2] + "</td>"); SAtable.Append("<td>" + SArdr[3] + "</td>"); SAtable.Append("</tr>"); SAtable.Append("</tbody>"); } } SAtable.Append("</table>"); SAPlaceHolder.Controls.Add(new Literal { Text = SAtable.ToString() }); SArdr.Close(); #endregion #region TableFBL1 SqlDataReader L1rdr = dbm.GetReader("SELECT ClubName, Played, GD, Points FROM FBClub where LeagueID = 503 ORDER BY Points DESC;"); L1table.Append("<table class='table'>"); L1table.Append("<thead>"); L1table.Append("<tr><th scope ='col'> Pos</th><th scope = 'col'> Club</th><th scope = 'col'> Pl</th><th scope = 'col'> GD</th><th scope = 'col'> Pts</th></tr>"); L1table.Append("</tr>"); L1table.Append("</thead>"); if (L1rdr.HasRows) { int i = 1; while (L1rdr.Read()) { L1table.Append("<tbody>"); L1table.Append("<tr>"); L1table.Append("<td>" + i++ + "</td>"); L1table.Append("<td>" + L1rdr[0] + "</td>"); L1table.Append("<td>" + L1rdr[1] + "</td>"); L1table.Append("<td>" + L1rdr[2] + "</td>"); L1table.Append("<td>" + L1rdr[3] + "</td>"); L1table.Append("</tr>"); L1table.Append("</tbody>"); } } L1table.Append("</table>"); L1PlaceHolder.Controls.Add(new Literal { Text = L1table.ToString() }); L1rdr.Close(); #endregion #region News1 SqlDataReader Newsrdr1 = dbm.GetReader("select FBImage.IDNews, TitleNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) from FBNews)"); while (Newsrdr1.Read()) { byte[] imagedata = (byte[])Newsrdr1["Data"]; string img = Convert.ToBase64String(imagedata, 0, imagedata.Length); Image1.ImageUrl = "data:image/png;base64," + img; News1 = Newsrdr1[1].ToString(); } TtNews1.DataBind(); Newsrdr1.Close(); #endregion #region News2 SqlDataReader Newsrdr2 = dbm.GetReader("select FBImage.IDNews, TitleNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) - 1 from FBNews)"); while (Newsrdr2.Read()) { byte[] imagedata = (byte[])Newsrdr2["Data"]; string img = Convert.ToBase64String(imagedata, 0, imagedata.Length); Image2.ImageUrl = "data:image/png;base64," + img; News1 = Newsrdr2[1].ToString(); } TtNews2.DataBind(); Newsrdr2.Close(); #endregion #region News3 SqlDataReader Newsrdr3 = dbm.GetReader("select FBImage.IDNews, TitleNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) - 2 from FBNews)"); while (Newsrdr3.Read()) { byte[] imagedata = (byte[])Newsrdr3["Data"]; string img = Convert.ToBase64String(imagedata, 0, imagedata.Length); Image3.ImageUrl = "data:image/png;base64," + img; News1 = Newsrdr3[1].ToString(); } TtNews3.DataBind(); Newsrdr3.Close(); #endregion #region NewsCardsrdr SqlDataReader NewsCardsrdr = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) from FBNews)"); SqlDataReader NewsCardsrdr2 = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) - 1 from FBNews)"); SqlDataReader NewsCardsrdr3 = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) - 2 from FBNews)"); SqlDataReader NewsCardsrdr4 = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) - 3 from FBNews)"); SqlDataReader NewsCardsrdr5 = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) - 4 from FBNews)"); SqlDataReader NewsCardsrdr6 = dbm.GetReader("select FBImage.IDNews, TitleNews, LeadNews, ContentNews, IName, Data from FBNews inner join FBImage on FBNews.IDNews = FBImage.IDNews where FBNews.IDNews = (select MAx(FBNews.IDNews) - 5 from FBNews)"); NewsCards(NewsCardsrdr); NewsCards(NewsCardsrdr2); NewsCards(NewsCardsrdr3); NewsCards(NewsCardsrdr4); NewsCards(NewsCardsrdr5); NewsCards(NewsCardsrdr6); #endregion dbm.closeConnection(); } }