protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // db.fillgrid("select student.name as Name,test.ab_count as Absent_hour from student left join (select count('semid') as ab_count,absent.sid from attendance inner join absent on attendance.atid=absent.atid group by absent.sid) test on student.sid=test.sid where batch=1", GridView1); string str; str = Session["login_id"].ToString(); DataTable dt = db.exetable("select sid from student where lid=" + str); db.fillgrid("select count('semid') as HOUR,attendance.date as DATE from attendance inner join absent on attendance.atid=absent.atid where absent.sid=" + dt.Rows[0][0].ToString() + " group by attendance.date ", GridView1); object dt2 = db.execalar("select sum(k.p) as cnt from (select count(semid) as p,attendance.date from attendance inner join absent on attendance.atid=absent.atid where absent.sid=" + dt.Rows[0][0].ToString() + " group by attendance.date ) k"); Label1.Text = dt2.ToString(); object dt3 = db.execalar("select count('date') as p from (select distinct date from attendance) dt"); Label2.Text = (Convert.ToInt32(dt3) * 5).ToString(); Label3.Text = dt3.ToString(); double totp = 0; if (Label1.Text != "") { int qu = Convert.ToInt32(Label1.Text) / 5; int re = Convert.ToInt32(Label1.Text) % 5; totp = Convert.ToInt32(dt3); if (qu > 0) { totp = totp - qu; } if (re >= 3) { totp = totp - .5; } } Label4.Text = totp.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { string year = TextBox1.Text; if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.ContentLength > 0) { UpLoadAndDisplay(); } // string sql; string sql1 = "select * from callender where filename='" + FileUpload1.FileName + "'"; DataTable dt = db.exetable(sql1); if (dt.Rows.Count > 0) { Response.Write("<script>slert('Data Exist')</script>"); } else { int i = db.exenonquery("insert into callender values('" + FileUpload1.FileName + "','" + year + "')"); if (i > 0) { Response.Write("<script>alert('Insertion Success')</script>"); } else { Response.Write("<script>alert('Insertion failure')</script>"); } } Response.Redirect(Request.Url.AbsoluteUri); }
protected void Button1_Click(object sender, EventArgs e) { string department = DropDownList_dep.SelectedItem.Value; string batch = RadioButtonList1.SelectedItem.Value; string sem = TextBox_sem.Text; string sql1 = "select * from semester where sem='" + sem + "'"; DataTable dt = db.exetable(sql1); if (dt.Rows.Count > 0) { Response.Write("<script>slert('Data Exist')</script>"); } else { string sql = "insert into semester values(" + batch + ",'" + sem + "')"; int i = db.exenonquery(sql); if (i > 0) { Response.Write("<script>alert('Insertion Success')</script>"); Response.Redirect(Request.Url.AbsoluteUri); } else { Response.Write("<script>alert('Insertion Failure')</script>"); } } Response.Redirect(Request.Url.AbsoluteUri); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string lid = Session["Login_id"].ToString(); string sql = "select * from logintable where lid=" + lid; DataTable dt = db.exetable(sql); Label1.Text = dt.Rows[0][1].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = db.exetable("select * from notification"); string s1; s1 = "<table><tr><td>"; for (int i = 0; i < dt.Rows.Count; i++) { s1 += "<a href='#'>" + dt.Rows[i][1].ToString() + "," + dt.Rows[i][2].ToString() + "</a></td>"; s1 += "<br/>"; } s1 += "</tr></table>"; lt2.Text = s1.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { string exname = TextBox1.Text; int mxmrk = Convert.ToInt32(TextBox2.Text); string sql11 = "select * from internal_exam_name where sem='" + exname + "'"; DataTable dt = db.exetable(sql11); if (dt.Rows.Count > 0) { Response.Write("<script>slert('Data Exist')</script>"); } else { string sql1 = "insert into internal_exam_name values('" + exname + "')"; int j = db.exenonquery(sql1); if (j > 0) { Response.Write("<script>alert('Insertion Success')</script>"); } else { Response.Write("<script>alert('Insertion Failure')</script>"); } string sql2 = "insert into max_mark values(" + mxmrk + ")"; int i = db.exenonquery(sql2); if (i > 0) { Response.Write("<script>alert('Insertion Success')</script>"); } else { Response.Write("<script>alert('Insertion Failure')</script>"); } Response.Redirect(Request.Url.AbsoluteUri); } }
protected void Button1_Click(object sender, EventArgs e) { string uname = TextBox1.Text; string pass = TextBox2.Text; string q1 = "select * from logintable where uname='" + uname + "' and password='******' and status='1'"; DataTable dt = db.exetable(q1); if (dt.Rows.Count > 0) { Session["login_id"] = dt.Rows[0][0].ToString(); if (dt.Rows[0][3].ToString() == "admin") { Response.Redirect("~/admin/Admin_Home.aspx"); } else if (dt.Rows[0][3].ToString() == "teacher") { Response.Redirect("~/Teacher/Teacher_Home.aspx"); } else if (dt.Rows[0][3].ToString() == "hod") { Response.Redirect("~/Head of Department/Hod_Home.aspx"); } else if (dt.Rows[0][3].ToString() == "principal") { Response.Redirect("~/Principal/Principal_Home.aspx"); } else if (dt.Rows[0][3].ToString() == "student") { Response.Redirect("~/Student/Student_Home.aspx"); } } else { Response.Write("<script>alert('login Failure')</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { string lid = Session["login_id"].ToString(); string did = DropDownList_dep.SelectedItem.Value; string b = RadioButtonList_year.SelectedValue; string semid = DropDownList_sem.SelectedItem.Value; object ob = db.execalar("select count(distinct dayid) from timetable"); DataTable dt1 = db.exetable("select * from timetable inner join subject on timetable.sid=subject.sid inner join day on timetable.dayid=day.dayid where timetable.did=" + did + " and timetable.semid=" + semid); DataTable dt2 = new DataTable("abc"); DataColumn dtc; DataRow dtr; dtc = new DataColumn(); dtc.Caption = "Day"; dtc.ColumnName = "id"; dt2.Columns.Add(dtc); dtc = new DataColumn(); dtc.Caption = "1"; dtc.ColumnName = "1"; dt2.Columns.Add(dtc); dtc = new DataColumn(); dtc.Caption = "2"; dtc.ColumnName = "2"; dt2.Columns.Add(dtc); dtc = new DataColumn(); dtc.Caption = "3"; dtc.ColumnName = "3"; dt2.Columns.Add(dtc); dtc = new DataColumn(); dtc.Caption = "4"; dtc.ColumnName = "4"; dt2.Columns.Add(dtc); dtc = new DataColumn(); dtc.Caption = "5"; dtc.ColumnName = "5"; dt2.Columns.Add(dtc); for (int j = 0; j < dt1.Rows.Count; j = j + 5) { dtr = dt2.NewRow(); for (int i = 0; i < 5; i++) { dtr["id"] = dt1.Rows[j]["dayname"].ToString(); if (dt1.Rows[i]["hid"].ToString() == "6") { dtr["1"] = dt1.Rows[j + i]["subjectname"].ToString(); } if (dt1.Rows[i]["hid"].ToString() == "7") { dtr["2"] = dt1.Rows[j + i]["subjectname"].ToString(); } if (dt1.Rows[i]["hid"].ToString() == "8") { dtr["3"] = dt1.Rows[j + i]["subjectname"].ToString(); } if (dt1.Rows[i]["hid"].ToString() == "9") { dtr["4"] = dt1.Rows[j + i]["subjectname"].ToString(); } if (dt1.Rows[i]["hid"].ToString() == "10") { dtr["5"] = dt1.Rows[j + i]["subjectname"].ToString(); } } dt2.Rows.Add(dtr); } GridView_timetable.DataSource = dt2; GridView_timetable.DataBind(); }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { string lid = DropDownList1.SelectedItem.Value; DataTable dt = db.exetable("select * from student where lid=" + lid); Label5.Text = dt.Rows[0]["name"].ToString(); Label6.Text = dt.Rows[0]["email"].ToString(); Label7.Text = dt.Rows[0]["admn"].ToString(); Label9.Text = dt.Rows[0]["sem"].ToString(); Label10.Text = dt.Rows[0]["gender"].ToString(); Image1.ImageUrl = "~/UplodedContents/images/" + dt.Rows[0]["photo"].ToString(); Label11.Text = dt.Rows[0]["dob"].ToString(); Label12.Text = dt.Rows[0]["cstudent"].ToString(); Label13.Text = dt.Rows[0]["cparent"].ToString(); Label14.Text = dt.Rows[0]["address"].ToString(); DataTable dt2 = db.exetable("select * from logintable where lid=" + lid); Label15.Text = dt2.Rows[0]["uname"].ToString(); Label16.Text = dt2.Rows[0]["password"].ToString(); DataTable dt1 = db.exetable("select * from internalmarks inner join subject on internalmarks.subjectid=subject.sid inner join semester on semester.semid=internalmarks.semester where internalmarks.studentid=" + dt.Rows[0][0].ToString()); if (dt1.Rows.Count > 0) { db.fillgrid("select * from internalmarks inner join subject on internalmarks.subjectid=subject.sid inner join semester on semester.semid=internalmarks.semester where internalmarks.studentid=" + dt.Rows[0][0].ToString(), GridView1); } else { Label2.Text = "No Internal Mark Added"; } DataTable dt3 = db.exetable("select * from internal_mark inner join subject on subject.sid=internal_mark.subjectid inner join internal_exam_name on internal_exam_name.intexmid=internal_mark.intextype inner join max_mark on max_mark.intextype=internal_mark.intexmid where internal_mark.studentid=" + dt.Rows[0][0].ToString() + " and internal_mark.intextype=1"); if (dt3.Rows.Count > 0) { db.fillgrid("select * from internal_mark inner join subject on subject.sid=internal_mark.subjectid inner join internal_exam_name on internal_exam_name.intexmid=internal_mark.intextype inner join max_mark on max_mark.intextype=internal_mark.intexmid where internal_mark.studentid=" + dt.Rows[0][0].ToString() + " and internal_mark.intextype=1", GridView2); } else { Label3.Text = "No Fist Internal Mark Added"; } DataTable dt4 = db.exetable("select * from internal_mark inner join subject on subject.sid=internal_mark.subjectid inner join internal_exam_name on internal_exam_name.intexmid=internal_mark.intextype inner join max_mark on max_mark.intextype=internal_mark.intexmid where internal_mark.studentid=" + dt.Rows[0][0].ToString() + " and internal_mark.intextype=2"); if (dt4.Rows.Count > 0) { db.fillgrid("select * from internal_mark inner join subject on subject.sid=internal_mark.subjectid inner join internal_exam_name on internal_exam_name.intexmid=internal_mark.intextype inner join max_mark on max_mark.intextype=internal_mark.intexmid where internal_mark.studentid=" + dt.Rows[0][0].ToString() + " and internal_mark.intextype=2", GridView3); } else { Label4.Text = "No Second Internal Mark Added"; } //string str; //str = Session["login_id"].ToString(); DataTable dtq = db.exetable("select sid from student where lid=" + lid); db.fillgrid("select count('semid') as HOUR,attendance.date as DATE from attendance inner join absent on attendance.atid=absent.atid where absent.sid=" + dtq.Rows[0][0].ToString() + " group by attendance.date ", GridView4); object dt2q = db.execalar("select sum(k.p) as cnt from (select count(semid) as p,attendance.date from attendance inner join absent on attendance.atid=absent.atid where absent.sid=" + dtq.Rows[0][0].ToString() + " group by attendance.date ) k"); Label17.Text = dt2.ToString(); object dt3q = db.execalar("select count('date') as p from (select distinct date from attendance) dt"); Label18.Text = (Convert.ToInt32(dt3q) * 5).ToString(); Label19.Text = dt3q.ToString(); double totp = 0; if (Label17.Text != "") { int qu = Convert.ToInt32(Label17.Text) / 5; int re = Convert.ToInt32(Label17.Text) % 5; totp = Convert.ToInt32(dt3q); if (qu > 0) { totp = totp - qu; } if (re >= 3) { totp = totp - .5; } } Label20.Text = totp.ToString(); }