protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); if (Session["cord"] != null) { if (!this.IsPostBack) { //Populating a DataTable from database. dt = db.verifys("select Group_name,ID as TeamLeader,Id1 as TeamMember1,Id2 as TeamMember2,Id3 as TeamMember3,Id4 as TeamMember4,Id5 as TeamMember5,EVENT_NAME from event_reg inner join competition on event_reg.e_no=competition.E_NO");// where competition.branch='" + Session["cord"] + "'"); //Building an HTML string. StringBuilder html = new StringBuilder(); foreach (DataRow row in dt.Rows) { html.Append("<tr>"); foreach (DataColumn column in dt.Columns) { html.Append("<td>"); html.Append("<a href='http://www.fgiet.ac.in'>"); html.Append(row[column.ColumnName]); html.Append("</a>"); html.Append("</td>"); } html.Append("</tr>"); } //Table end. html.Append("</table>"); //Append the HTML string to Placeholder. PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() }); } Label1.Text = Session["cord1"].ToString(); dt = db.verifys("select * from register17 where id='" + Session["cord1"].ToString() + "'"); Label6.Text = dt.Rows[0][1].ToString(); Label4.Text = dt.Rows[0][2].ToString(); Label5.Text = dt.Rows[0][4].ToString(); Label3.Text = dt.Rows[0][3].ToString(); } else { Response.Redirect("Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); if (Session["name"] != null) { //if (!this.IsPostBack) //{ // //Populating a DataTable from database. dt = db.verifys("select Group_name,Event_Name,ID,Id1,Id2,Id3,Id4 from event_reg inner join competition on event_reg.e_no=competition.E_NO where id='" + Session["name"].ToString() + "' or id1='" + Session["name"].ToString() + "' or id2='" + Session["name"].ToString() + "' or id3='" + Session["name"].ToString() + "' or id4='" + Session["name"].ToString() + "'"); //Building an HTML string. StringBuilder html = new StringBuilder(); foreach (DataRow row in dt.Rows) { html.Append("<tr>"); foreach (DataColumn column in dt.Columns) { html.Append("<td>"); html.Append(row[column.ColumnName]); html.Append("</td>"); } html.Append("</tr>"); } //Table end. html.Append("</table>"); //Append the HTML string to Placeholder. PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() }); //} Label1.Text = Session["name"].ToString(); dt = db.verifys("select * from register17 where id='" + Session["name"] + "'"); Label6.Text = "WELCOME " + dt.Rows[0][1].ToString(); Label4.Text = dt.Rows[0][2].ToString(); Label5.Text = dt.Rows[0][4].ToString(); Label3.Text = dt.Rows[0][3].ToString(); } else { Response.Redirect("Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["name"] == null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "testScript", " $(document).ready(function() { $('#prof').show();});", true); prof.Style.Add("display", "none"); } else { prof.Style.Add("display", "block"); } Databs db = new Databs(); DataTable dt = new DataTable(); string qu = "select count(id) from register17"; dt = db.verifys(qu); int p = Convert.ToInt32(dt.Rows[0][0]); p = p + 250; part.InnerText = p.ToString(); }
protected void Log_in_btn_Click(object sender, EventArgs e) { Databs db = new Databs(); DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); string query = "Select Id,Name from register17 where Id='" + TextBox7.Text + "' AND passwords='" + TextBox8.Text + "'"; if (TextBox7.Text == "") { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter user id');", true); } else if (!(new Regex(@"^([a-zA-Z0-9]*)$").IsMatch(TextBox7.Text))) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter valid user id');", true); } else if (TextBox8.Text == "") { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter password');", true); } else if (!(new Regex(@"^([a-zA-Z0-9]*)$").IsMatch(TextBox8.Text))) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter valid password');", true); } else { dt1 = db.verifys(query); dt2 = db.verifys("Select count(Name) from register17 where Id='" + TextBox7.Text + "' AND passwords='" + TextBox8.Text + "'"); try { if (dt2.Rows[0][0].ToString() != "0") { Session["cord"] = "cs"; char[] c = TextBox7.Text.ToString().ToCharArray(); if (c[0] == 'C' && c[1] == 'O') { Session["cord1"] = dt1.Rows[0][0].ToString(); if (c[5] == 'C' && c[6] == 'S') { Session["cord"] = "cs"; Response.Redirect("Coordinator.aspx"); } else if (c[5] == 'E' && c[6] == 'C') { Session["cord"] = "ec"; Response.Redirect("Coordinator.aspx"); } else if (c[5] == 'M' && c[6] == 'E') { Session["cord"] = "me"; Response.Redirect("Coordinator.aspx"); } } else { Session["name"] = dt1.Rows[0][0].ToString(); Response.Redirect("Usr_lgn.aspx"); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Logged in as');", true); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "alert", "alert('Logged in as');", true); } } else { // ClientScript.RegisterStartupScript(GetType(), "alert", "alert('User is not logged.. Check your id or password');", true); // ShowMessage("User is not logged in", MessageType.Warning); Session["name"] = null; } } catch { } } }
protected void register_btn_Click(object sender, EventArgs e) { Databs db = new Databs(); String id = TextBox2.Text; var id1 = id.ToCharArray(); StringBuilder s = new StringBuilder("YG"); string q = "select COUNT(Name) from register17"; DataTable dt = new DataTable(); dt = db.verifys(q); for (int i = 0; i < id.Length; i++) { if (i == 0) { s.Append(id1[i]); } else { if (id1[i] == ' ' && id1[i + 1] != ' ') { s.Append(id1[i + 1]); } } } int a = 100; a = a + Convert.ToInt32(dt.Rows[0][0]) + 1; string app = a.ToString(); s.Append(app); s.Append(DateTime.Now.Second.ToString()); string query = "insert into register17(Id,Name,College,Email,Phone,Passwords) values('" + s + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "')"; try { Session["id"] = s; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "testScript", " $(document).ready(function() { $('#cg').show();});", true); if (TextBox1.Text == "") { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter name');", true); } else if (!(new Regex(@"^([a-zA-Z]*)$").IsMatch(TextBox1.Text))) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter valid character in name');", true); } else if (TextBox2.Text == "") { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter college');", true); } else if (!(new Regex(@"^([a-zA-Z\s]*)$").IsMatch(TextBox2.Text))) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter valid characters in college name');", true); } else if (!(new Regex(@"^([a-zA-Z0-9_\.\-])+\@(([gmailyhoutk\-])+\.)+([com]{2,4})+$").IsMatch(TextBox3.Text))) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter valid Email address');", true); } else if (TextBox4.Text.Length < 10) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter valid Mobile no');", true); } else if (TextBox5.Text.Length < 6 || TextBox5.Text.Length > 12) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Enter password length between 6-12');", true); } else if (TextBox5.Text != TextBox6.Text) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Password not matched');", true); } else { db.InsertData(query); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Data Submitted Successfully Check your mail for your user id');", true); } } catch { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Unable to register. Please verify the e mail.');", true); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["name"] == null) { prof.Style.Add("display", "none"); Ank1.Style.Add("display", "none"); } else { prof.Style.Add("display", "block"); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "testScript", " $(document).ready(function() { $('#Ank1').show();});", true); Ank1.Style.Add("display", "block"); } // if (Session["name"] == null) // { // // prof.Style.Add("display", "none"); // } // else // { //A1.Style.Add("display", "block"); //A2.Style.Add("display", "block"); //A3.Style.Add("display", "block"); //A4.Style.Add("display", "block"); //A5.Style.Add("display", "block"); //A6.Style.Add("display", "block"); //A7.Style.Add("display", "block"); //A8.Style.Add("display", "block"); //A9.Style.Add("display", "block"); //A10.Style.Add("display", "block"); //A11.Style.Add("display", "block"); //A12.Style.Add("display", "block"); //A13.Style.Add("display", "block"); //A14.Style.Add("display", "block"); //A15.Style.Add("display", "block"); //A16.Style.Add("display", "block"); //A17.Style.Add("display", "block"); //rrr.Style.Add("display", "block"); // //prof.Style.Add("display", "block"); //} //if (Session["name"] == null) //{ Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "testScript", " $(document).ready(function() { $('.rr').hide();});", true); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "testScript", " $(document).ready(function() { $('#prof').hide();});", true); //} //else if (Session["name"] != null) //{ // Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "testScript", " $(document).ready(function() { $('.rr').show();});", true); // Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "testScript", " $(document).ready(function() { $('#prof').show();});", true); // try // { if (!IsPostBack) { DataTable dt1 = new DataTable(); string query = "Select * from competition where e_no not in (select e_no from event_reg where id='" + Session["name"] + "' or Id1='" + Session["name"] + "' or Id2='" + Session["name"] + "')"; try { dt1 = db.verifys(query); DropDownList1.DataSource = dt1; // DropDownList1.Items.Add("select"); DropDownList1.DataBind(); // DropDownList1.SelectedItem = "select"; } catch { Label1.Text = ""; } // DataSet ds = new DataSet(); // ds.ReadXml(Server.MapPath("Events.xml")); //} //catch //{ // Response.Redirect("Events.aspx"); //} // } } }