Server IP : 103.118.17.23 / Your IP : 216.73.216.32 Web Server : Microsoft-IIS/10.0 System : Windows NT RESELLERPLESK22 10.0 build 20348 (Windows Server 2016) AMD64 User : IWAM_plesk(default) ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/vhosts/mesa.org.in/httpdocs/ |
Upload File : |
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Text; using System.IO; using System.Text.RegularExpressions; public partial class _Default : System.Web.UI.Page { cnn cn = new cnn(); DataSet ds; string x; DataRow drow; int record = 0; public void qry(string x) { try { ds = new DataSet(); cn.da = new System.Data.SqlClient.SqlDataAdapter(x, cn.cn); cn.cbd.DataAdapter = cn.da; cn.da.MissingSchemaAction = MissingSchemaAction.AddWithKey; cn.da.Fill(ds); } catch (Exception) { //toolStripStatusLabel1.Text = ex.Message.ToString(); } } protected void Page_Load(object sender, EventArgs e) { x = "select * from incr"; qry(x); DataSet cont = new DataSet(); cn.da.Fill(cont); int x1; x1 = cont.Tables[0].Rows.Count - 1; if (x1 == -1) { record = 1; } else { record = Convert.ToInt32(cont.Tables[0].Rows[x1].ItemArray[1]); record += 1; } lblincr.Text = record.ToString(); x = "insert visitor_no into incr ='" + lblincr.Text + "'"; qry(x); cn.cmd.CommandType = CommandType.Text; cn.cmd.CommandText = "update incr set visitor_no ='" + lblincr.Text + "' where id= 1"; cn.cn.Open(); cn.cmd.Connection = cn.cn; cn.cmd.ExecuteNonQuery(); cn.cn.Close(); if (!IsPostBack) { GetHMenuData(); homenews.DataSource = snewss("top 10"); homenews.DataBind(); //download.DataSource = downloads("top 5"); //download.DataBind(); spnews.DataSource = spewss("top 1000"); spnews.DataBind(); content.DataSource = hcontent("top 1"); content.DataBind(); videoa.DataSource = videos("top 3"); videoa.DataBind(); } } private DataSet videos(string top) { string conString = ConfigurationManager.ConnectionStrings["mesaConnectionString"].ConnectionString; string query = "SELECT " + top + " * FROM videos where home_enable='Yes' ORDER by sequence Asc"; SqlCommand cmd = new SqlCommand(query); using (SqlConnection cn = new SqlConnection(conString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = cn; sda.SelectCommand = cmd; using (DataSet ds = new DataSet()) { sda.Fill(ds); return ds; } } } } private DataSet hcontent(string top) { string conString = ConfigurationManager.ConnectionStrings["mesaConnectionString"].ConnectionString; string query = "SELECT " + top + " * FROM home_contents ORDER by ID Desc"; SqlCommand cmd = new SqlCommand(query); using (SqlConnection cn = new SqlConnection(conString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = cn; sda.SelectCommand = cmd; using (DataSet ds = new DataSet()) { sda.Fill(ds); return ds; } } } } private DataSet spewss(string top) { string conString = ConfigurationManager.ConnectionStrings["mesaConnectionString"].ConnectionString; string query = "SELECT " + top + " * FROM special_news where enable = 'Yes' ORDER by ID Desc"; SqlCommand cmd = new SqlCommand(query); using (SqlConnection cn = new SqlConnection(conString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = cn; sda.SelectCommand = cmd; using (DataSet ds = new DataSet()) { sda.Fill(ds); return ds; } } } } private DataSet downloads(string top) { string conString = ConfigurationManager.ConnectionStrings["mesaConnectionString"].ConnectionString; string query = "SELECT " + top + " * FROM download where enable = 'Yes' ORDER by ID Desc"; SqlCommand cmd = new SqlCommand(query); using (SqlConnection cn = new SqlConnection(conString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = cn; sda.SelectCommand = cmd; using (DataSet ds = new DataSet()) { sda.Fill(ds); return ds; } } } } private DataSet snewss(string top) { string conString = ConfigurationManager.ConnectionStrings["mesaConnectionString"].ConnectionString; string query = "SELECT " + top + " * FROM news where enable = 'Yes' ORDER by ID Desc"; SqlCommand cmd = new SqlCommand(query); using (SqlConnection cn = new SqlConnection(conString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = cn; sda.SelectCommand = cmd; using (DataSet ds = new DataSet()) { sda.Fill(ds); return ds; } } } } private void GetHMenuData() { DataTable table = new DataTable(); x = "select id, menu, parent_id, url from Hmenudetails ORDER by Sequence ASC"; qry(x); cn.da.Fill(table); DataView view = new DataView(table); view.RowFilter = "parent_id is NULL"; foreach (DataRowView row in view) { MenuItem menuItem = new MenuItem(row["menu"].ToString(), row["id"].ToString()); menuItem.NavigateUrl = row["url"].ToString(); MenuBar.Items.Add(menuItem); AddChildItems1(table, menuItem); } } private void AddChildItems1(DataTable table, MenuItem menuItem) { DataView viewItem = new DataView(table); viewItem.RowFilter = "parent_id=" + menuItem.Value; foreach (DataRowView childView in viewItem) { MenuItem childItem = new MenuItem(childView["menu"].ToString(), childView["id"].ToString()); childItem.NavigateUrl = childView["url"].ToString(); menuItem.ChildItems.Add(childItem); AddChildItems1(table, childItem); } } protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter hWriter = new HtmlTextWriter(sw); base.Render(hWriter); string html = sb.ToString(); html = Regex.Replace(html, "<input[^>]*id=\"(__VIEWSTATE)\"[^>]*>", string.Empty, RegexOptions.IgnoreCase); writer.Write(html); } }