public void ViewProfile() { HttpCookie myCookiepr = Request.Cookies["myCookiepr"]; if (myCookiepr != null) { string userId = myCookiepr["prnm"]; //"select * from classsection where id='" + p + "'", con string sql = "select * from classsection where id='" + Convert.ToInt32(Request.QueryString["id"].ToString()) + "'"; ds = glb.GetDataSet(sql); //Select sels = new Select(); //ds = sels.selectitemdet(Convert.ToInt32(Request.QueryString["id"].ToString())); if (ds.Tables[0].Rows.Count == 1) { lblclass.Text = ds.Tables[0].Rows[0]["class"].ToString(); lblsch.Text = ds.Tables[0].Rows[0]["school"].ToString(); } if (!IsPostBack) { fillGridView2(lblsch.Text); fillGridView1(lblclass.Text, lblsch.Text); } } }
public void Sessioninfo() { HttpCookie myCookiet = Request.Cookies["myCookiet"]; if (myCookiet != null) { string userId = myCookiet["tnm"]; string sql = "select * from teacher where usr='******' "; dss = glb.GetDataSet(sql); if (dss.Tables[0].Rows.Count == 1) { lbltchnm.Text = dss.Tables[0].Rows[0]["name"].ToString(); lblsch.Text = dss.Tables[0].Rows[0]["school"].ToString(); } else { string message1 = "Login Session Expired....Please Login again."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); Response.Redirect("../Teacherlogin.aspx"); } if (!IsPostBack) { string sql2 = "SELECT [class] FROM [classsection] WHERE ([school] = '" + lblsch.Text + "')"; dss2 = glb.GetDataSet(sql2); DropDownList2.DataSource = dss2.Tables[0]; DropDownList2.DataTextField = "class"; DropDownList2.DataValueField = "class"; DropDownList2.DataBind(); string sql3 = "SELECT [name] FROM [parent] WHERE (([school] = '" + lblsch.Text + "') AND ([class] = '" + DropDownList2.SelectedValue + "'))"; dss3 = glb.GetDataSet(sql3); DropDownList3.DataSource = dss3.Tables[0]; DropDownList3.DataTextField = "name"; DropDownList3.DataValueField = "name"; DropDownList3.DataBind(); //fillGridView3(); } } }
public void Sessioninfo() { HttpCookie myCookies = Request.Cookies["myCookies"]; if (myCookies != null) { string userId = myCookies["snm"]; //Select sels = new Select(); //dss = sels.selectschooladmn(userId); string sql = "select * from schooladmin where usr='******' "; dss = glb.GetDataSet(sql); if (dss.Tables[0].Rows.Count == 1) { lbltchnm.Text = dss.Tables[0].Rows[0]["name"].ToString(); lblsch.Text = dss.Tables[0].Rows[0]["school"].ToString(); } else { string message1 = "Login Session Expired....Please Login again."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); Response.Redirect("../Schooladminlogin.aspx"); } if (!IsPostBack) { string sql1 = "SELECT [class] FROM [classsection] WHERE ([school] = '" + lblsch.Text + "') ORDER BY [id]"; dss1 = glb.GetDataSet(sql1); DropDownList1.DataSource = dss1.Tables[0]; DropDownList1.DataTextField = "class"; DropDownList1.DataValueField = "class"; DropDownList1.DataBind(); } fillGridView2(); fillGridView3(); } }
public void Sessioninfo() { HttpCookie myCookiepr = Request.Cookies["myCookiepr"]; if (myCookiepr != null) { string userId = myCookiepr["prnm"]; string sql = "select * from principal where usr = '******'"; dss = glb.GetDataSet(sql); if (!IsPostBack) { string sql1 = "SELECT [name] FROM [teacher] WHERE ([school] = '" + dss.Tables[0].Rows[0]["school"].ToString() + "')"; dss1 = glb.GetDataSet(sql1); DropDownList1.DataSource = dss1.Tables[0]; DropDownList1.DataTextField = "name"; DropDownList1.DataValueField = "name"; DropDownList1.DataBind(); } if (dss.Tables[0].Rows.Count == 1) { // lbltchnm.Text = dss.Tables[0].Rows[0]["name"].ToString(); lblsch.Text = dss.Tables[0].Rows[0]["school"].ToString(); } else { string message1 = "Login Session Expired....Please Login again."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); Response.Redirect("../Principallogin.aspx"); } fillGridView1(lblsch.Text); } }
public void Sessioninfo() { HttpCookie myCookiepr = Request.Cookies["myCookiepr"]; if (myCookiepr != null) { string userId = myCookiepr["prnm"]; //Select sels = new Select(); //dss = sels.selectprinci(userId); string sql = "select * from principal where usr='******' "; dss = glb.GetDataSet(sql); if (dss.Tables[0].Rows.Count == 1) { // lblprinm.Text = dss.Tables[0].Rows[0]["namr"].ToString(); lblsch.Text = dss.Tables[0].Rows[0]["school"].ToString(); } else { string message1 = "Login Session Expired....Please Login again."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); Response.Redirect("../Principallogin.aspx"); } if (!IsPostBack) { fillGridView1(lblsch.Text); } } }
public void Sessioninfo() { HttpCookie myCookiep = Request.Cookies["myCookiep"]; if (myCookiep != null) { string userId = myCookiep["pnm"]; string sql = "select * from parent where usr='******' "; dss = glb.GetDataSet(sql); if (dss.Tables[0].Rows.Count == 1) { // lbltchnm.Text = dss.Tables[0].Rows[0]["name"].ToString(); lblsch.Text = dss.Tables[0].Rows[0]["school"].ToString(); lblstdnm.Text = dss.Tables[0].Rows[0]["name"].ToString(); lblclass.Text = dss.Tables[0].Rows[0]["class"].ToString(); } else { string message1 = "Login Session Expired....Please Login again."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); Response.Redirect("../Parentlogin.aspx"); } fillGridView(); } }
public void ViewProfile() { HttpCookie myCookiet = Request.Cookies["myCookiet"]; if (myCookiet != null) { string userId = myCookiet["tnm"]; string sql = "select * from classsection where id='" + Convert.ToInt32(Request.QueryString["id"].ToString()) + "'"; ds = glb.GetDataSet(sql); if (ds.Tables[0].Rows.Count == 1) { lblclass.Text = ds.Tables[0].Rows[0]["class"].ToString(); lblsch.Text = ds.Tables[0].Rows[0]["school"].ToString(); } else { string message1 = "Login Session Expired....Please Login again."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); Response.Redirect("../Teacherlogin.aspx"); } if (!IsPostBack) { fillGridView2(lblsch.Text); fillGridView1(lblclass.Text, lblsch.Text); } } }
protected void btnsubmit_Click(object sender, EventArgs e) { SqlConnection objcon = new SqlConnection(ClsVariable.ConnectionString); //string conn = ConfigurationManager.ConnectionStrings["Data Source=intel-pc\\sqlexpress;Initial Catalog=rentshopee;Integrated Security=True"].ConnectionString; objcon.Open(); SqlCommand objcmd = new SqlCommand("spprlogin", objcon); objcmd.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter objname = new SqlParameter(); objname.ParameterName = "@usr"; objname.SqlDbType = SqlDbType.VarChar; objname.Value = txtname.Text; objcmd.Parameters.Add(objname); SqlParameter pwd = new SqlParameter(); pwd.ParameterName = "@pass"; pwd.SqlDbType = SqlDbType.VarChar; pwd.Value = txtpass.Text; objcmd.Parameters.Add(pwd); SqlDataReader objreader = objcmd.ExecuteReader(); if (objreader.Read() == true) { Session["Principal_name"] = txtname.Text; FormsAuthentication.RedirectFromLoginPage(txtname.Text, check.Checked); //create a cookie HttpCookie myCookiepr = new HttpCookie("myCookiepr"); //Add key-values in the cookie myCookiepr["prnm"] = txtname.Text; myCookiepr["prps"] = txtpass.Text; //set cookie expiry date-time. Made it to last for next 12 hours. myCookiepr.Expires = DateTime.Now.AddMonths(3); //Most important, write the cookie to client. Response.Cookies.Add(myCookiepr); string sql3 = "select namr,school from principal where usr = '******'"; DataSet ds = new DataSet(); ds = glb.GetDataSet(sql3); GridView1.DataSource = ds; GridView1.DataBind(); SqlConnection objcon1 = new SqlConnection(ClsVariable.ConnectionString); objcon1.Open(); SqlCommand objcmd1 = new SqlCommand("splogindet", objcon1); objcmd1.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter objname1 = new SqlParameter(); objname1.ParameterName = "@name"; objname1.SqlDbType = SqlDbType.VarChar; objname1.Value = GridView1.Rows[0].Cells[0].Text; objcmd1.Parameters.Add(objname1); SqlParameter pwd1 = new SqlParameter(); pwd1.ParameterName = "@school"; pwd1.SqlDbType = SqlDbType.VarChar; pwd1.Value = GridView1.Rows[0].Cells[1].Text; objcmd1.Parameters.Add(pwd1); string pr = "Principal"; SqlParameter objname11 = new SqlParameter(); objname11.ParameterName = "@type"; objname11.SqlDbType = SqlDbType.VarChar; objname11.Value = pr.ToString(); objcmd1.Parameters.Add(objname11); SqlParameter pwd11 = new SqlParameter(); pwd11.ParameterName = "@time"; pwd11.SqlDbType = SqlDbType.VarChar; pwd11.Value = System.DateTime.Now.ToString(); objcmd1.Parameters.Add(pwd11); objcmd1.ExecuteNonQuery(); // Response.Write("Created Successfully"); objcon1.Close(); Response.Redirect("~/Principal/Default.aspx"); } else { string message1 = "Your details not matched."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); } }
protected void Button1_Click(object sender, EventArgs e) { if (true) { SqlConnection objcon = new SqlConnection(ClsVariable.ConnectionString); // SqlConnection objcon = new SqlConnection("Data Source=intel-pc\\sqlexpress;Initial Catalog=totalschool;Integrated Security=True"); objcon.Open(); SqlCommand objcom = new SqlCommand("spupno", objcon); objcom.CommandType = CommandType.StoredProcedure; string st = "Active"; SqlParameter objmaincat = new SqlParameter(); objmaincat.ParameterName = "@st"; objmaincat.SqlDbType = System.Data.SqlDbType.NVarChar; objmaincat.Value = st.ToString(); objcom.Parameters.Add(objmaincat); SqlParameter objincat = new SqlParameter(); objincat.ParameterName = "@id"; objincat.SqlDbType = System.Data.SqlDbType.NVarChar; objincat.Value = lblid.Text; objcom.Parameters.Add(objincat); string message1 = " Approved Successfully...! "; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); objcom.ExecuteNonQuery(); // Response.Write("Created Successfully"); objcon.Close(); int count = 0; int flag = 0; string nm = ""; if (lblclass.Text == "All") { string sql3 = "select mob from parent where school = '" + ClsVariable.Schollname + "'"; DataSet ds = new DataSet(); ds = glb.GetDataSet(sql3); for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { if (nm == "") { nm = ds.Tables[0].Rows[j].ItemArray[0].ToString(); } else { nm = nm + "," + ds.Tables[0].Rows[j].ItemArray[0].ToString(); } } } else { string sql3 = "select mob from parent where class = '" + lblclass.Text + "' and school = '" + ClsVariable.Schollname + "'"; DataSet ds = new DataSet(); ds = glb.GetDataSet(sql3); for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { if (nm == "") { nm = ds.Tables[0].Rows[j].ItemArray[0].ToString(); } else { nm = nm + "," + ds.Tables[0].Rows[j].ItemArray[0].ToString(); } } //Class1.WebMsgBox.Show("SMS Sent."); } //nm = "8087981030,9923482177"; Select.sendsms(nm, lbltitle.Text, lbldescr.Text, lblsch.Text); Class1.WebMsgBox.Show("SMS Sent."); //if(nm!="") // { // nm = "" // Select.sendsms(nm, lbltitle.Text, lbldescr.Text, lblsch.Text); // Class1.WebMsgBox.Show("SMS Sent."); // } } Response.Redirect("~/Principal/unapprove.aspx"); }
public void Sessioninfo() { HttpCookie myCookiepr = Request.Cookies["myCookiepr"]; if (myCookiepr != null) { string userId = myCookiepr["prnm"]; string sql = "select * from principal where usr = '******'"; dss = glb.GetDataSet(sql); if (!IsPostBack) { string sql1 = "select name from teacher where school = '" + dss.Tables[0].Rows[0]["school"].ToString() + "'"; dss1 = glb.GetDataSet(sql1); DropDownList1.DataSource = dss1.Tables[0]; DropDownList1.DataTextField = "name"; DropDownList1.DataValueField = "name"; DropDownList1.DataBind(); string sql2 = "select class from classsection where school = '" + dss.Tables[0].Rows[0]["school"].ToString() + "'ORDER BY id DESC"; dss2 = glb.GetDataSet(sql2); DropDownList2.DataSource = dss2.Tables[0]; DropDownList2.DataTextField = "class"; DropDownList2.DataValueField = "class"; DropDownList2.DataBind(); string sql3 = "select snm from [subject-info] where school = '" + dss.Tables[0].Rows[0]["school"].ToString() + "'"; dss3 = glb.GetDataSet(sql3); DropDownList3.DataSource = dss3.Tables[0]; DropDownList3.DataTextField = "snm"; DropDownList3.DataValueField = "snm"; DropDownList3.DataBind(); fillGridView1(dss.Tables[0].Rows[0]["school"].ToString()); } if (dss.Tables[0].Rows.Count == 1) { //lblprinm.Text = dss.Tables[0].Rows[0]["namr"].ToString(); lblsch.Text = dss.Tables[0].Rows[0]["school"].ToString(); } else { string message1 = "Login Session Expired....Please Login again."; string script = "window.onload = function(){ alert('"; script += message1; script += "');"; script += "window.location = '"; script += Request.Url.AbsoluteUri; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); Response.Redirect("../Principallogin.aspx"); } } }