protected void btn2_Click(object sender, EventArgs e) { try { DataView s = (DataView)Sqlds.Select(new DataSourceSelectArguments()); int s1 = (int)s[0][0]; int s2 = (int)s[0][1]; int s3 = (int)s[0][2]; if (s1 >= int.Parse(txtArjit.Text) && s2 >= int.Parse(txtKirkod.Text) && s3 >= int.Parse(txtVaidyakiya.Text)) { int n = SqlDsHolidays.Update(); if (n == 1) { int a = SqldsRemaining.Update(); if (a == 1) { int b = SqlDataSource3.Insert(); Response.Write("<script>alert('Data Inserted Successfully')</script>"); txtArjit.Text = ""; txtKirkod.Text = ""; txtVaidyakiya.Text = ""; } else { Response.Write("<script>alert('Please enter correct details...')</script>"); } } else { Response.Write("<script>alert('Please fill the form Correctly')</script>"); } } else { Response.Write("<script>alert('You do not have enough holidays')</script>"); } } catch (Exception er) { Response.Write(er); } }
protected void btn2_Click(object sender, EventArgs e) { HiddenField1.Value = txtYear.Text + "-" + txtYear1.Text; HiddenField2.Value = txtSchoolName.Text + "," + txtPinCode.Text; HiddenField3.Value = "Not Activated"; try { DataView dv = (DataView)Sqlds.Select(new DataSourceSelectArguments()); if (dv.Count == 0) { int n = SqldsSchooldata.Insert(); if (n == 1) { Session.Add("SchoolName", HiddenField2.Value); Session.Add("UnitName", txtUnitName.Text); Session.Add("Year", HiddenField1.Value); Session.Add("UnitType", ddl1.SelectedValue); Session.Add("EmailId", txtEmailId.Text); Session.Add("pwd", txtpwd.Text); Session.Add("SchoolType", DropDownList1.SelectedValue); Response.Write("<script>alert('Please fill up your Members Details..')</script>"); CleartextBoxes(this); Server.Transfer("admission2.aspx"); } else { Response.Write("<script>alert('Please fill the form Correctly')</script>"); } } else { Response.Write("<script>alert('User Already exists...Please Choose Different Password.')</script>"); return; } } catch (Exception er) { Response.Write(er.Message); } }
protected void btnLogin_Click(object sender, EventArgs e) { DataView d1 = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments()); DataView d2 = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments()); DataView d4 = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments()); DataView d3 = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments()); DataView d5 = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments()); DataView dv = (DataView)Sqlds.Select(new DataSourceSelectArguments()); if (d1.Count != 0 && d2.Count == 0) { Session.Add("SchoolName", d3[0][4]); Session.Add("UnitName", d3[0][3]); Session.Add("Year", d3[0][1]); Session.Add("UnitType", d3[0][2]); Session.Add("EmailId", d3[0][5]); Session.Add("pwd", d3[0][6]); Session.Add("SchoolType", d3[0][0]); Server.Transfer("admission2.aspx"); } else if (d2.Count != 0 && d4.Count == 0) { Session.Add("SchoolName", d3[0][4]); Session.Add("UnitName", d3[0][3]); Session.Add("Year", d3[0][1]); Session.Add("UnitType", d3[0][2]); Session.Add("EmailId", d3[0][5]); Session.Add("pwd", d3[0][6]); Server.Transfer("admission3.aspx"); } else if (d4.Count != 0 && dv.Count == 0) { Server.Transfer("RegistrationFormPrint.aspx"); } else if (txtUsername.Text == "admin" && txtPwd.Text == "admin") { Server.Transfer("Authentication.aspx"); } else if (d5.Count == 1) { Session.Add("District", d5[0][0]); Server.Transfer("Admin2.aspx"); } else { if (dv.Count == 1) { if (dv[0][0] != DBNull.Value) { DataView dv1 = (DataView)SqldsYear.Select(new DataSourceSelectArguments()); String y = (String)dv1[0][0]; String s1 = y.Substring(0, 4); String s = y.Substring(4); String y1 = (String)DateTime.Today.Year.ToString(); String n = y1.Insert(4, s); if (y1 != s1) { int year1 = int.Parse(s1) + 1; int year = int.Parse(y1); DateTime n1 = new DateTime(year, 3, 31); if (year == year1) { if (DateTime.Today.Month.ToString() == n1.Month.ToString() && DateTime.Today.Date.ToString() == n1.Date.ToString()) { Response.Write("<script>alert('Login Successfully...')</script>"); HttpCookie c1, c2; c1 = new HttpCookie("userid", txtUsername.Text); c2 = new HttpCookie("pwd", txtPwd.Text); c1.Expires = DateTime.Now.AddYears(1); c2.Expires = DateTime.Now.AddYears(1); Response.AppendCookie(c1); Response.AppendCookie(c2); Server.Transfer("Schooldashboard.aspx"); Session.Add("EmailId", txtUsername.Text); Session.Add("pwd", txtPwd.Text); } else { Response.Write("<script>alert('Your EmailId or Password has been expired...please register again')</script>"); return; } } } else { if (y == n) { Response.Write("<script>alert('Login Successfully...')</script>"); HttpCookie c1, c2; c1 = new HttpCookie("userid", txtUsername.Text); c2 = new HttpCookie("pwd", txtPwd.Text); c1.Expires = DateTime.Now.AddYears(1); c2.Expires = DateTime.Now.AddYears(1); Response.AppendCookie(c1); Response.AppendCookie(c2); Server.Transfer("Schooldashboard.aspx"); Session.Add("EmailId", txtUsername.Text); Session.Add("pwd", txtPwd.Text); } } } else { Response.Write("<script>alert('Invalid Username or Password...')</script>"); } } } }
protected void btnLogin_Click(object sender, EventArgs e) { DataView dv = (DataView)Sqlds.Select(new DataSourceSelectArguments()); if (dv.Count == 1) { if (dv[0][0] != DBNull.Value) { DataView dv1 = (DataView)SqldsYear.Select(new DataSourceSelectArguments()); String y = (String)dv1[0][0]; String s1 = y.Substring(0, 4); String s = y.Substring(4); String y1 = (String)DateTime.Today.Year.ToString(); String n = y1.Insert(4, s); if (y1 != s1) { int year1 = int.Parse(s1) + 1; int year = int.Parse(y1); DateTime n1 = new DateTime(year, 3, 31); if (year == year1) { if (DateTime.Today.Month.ToString() == n1.Month.ToString() && DateTime.Today.Date.ToString() == n1.Date.ToString()) { Response.Write("<script>alert('Login Successfully...')</script>"); HttpCookie c1, c2; c1 = new HttpCookie("userid", txtUsername.Text); c2 = new HttpCookie("pwd", txtPwd.Text); c1.Expires = DateTime.Now.AddYears(1); c2.Expires = DateTime.Now.AddYears(1); Response.AppendCookie(c1); Response.AppendCookie(c2); Server.Transfer("Schooldashboard.aspx"); Session.Add("EmailId", txtUsername.Text); Session.Add("pwd", txtPwd.Text); } else { Response.Write("<script>alert('Your EmailId or Password has been expired...please register again')</script>"); return; } } } else { if (y == n) { Response.Write("<script>alert('Login Successfully...')</script>"); HttpCookie c1, c2; c1 = new HttpCookie("userid", txtUsername.Text); c2 = new HttpCookie("pwd", txtPwd.Text); c1.Expires = DateTime.Now.AddYears(1); c2.Expires = DateTime.Now.AddYears(1); Response.AppendCookie(c1); Response.AppendCookie(c2); Server.Transfer("Schooldashboard.aspx"); Session.Add("EmailId", txtUsername.Text); Session.Add("pwd", txtPwd.Text); } } } else { Response.Write("<script>alert('Invalid Username or Password...')</script>"); } } }