void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("click")) { string cmd = "update book set fine=' 0' where bid='1111' "; db.DbTrcn(cmd); Label1.Text = "Hooooooooo"; Label1.Visible = true; } }
protected void Button1_Click(object sender, EventArgs e) { if (DropDownList1.SelectedValue.Equals("Student")) { try { string new_stu_limit = TextBox1.Text; string update = "update changeSetting set issuelimit_stu='" + new_stu_limit + "' where issuelimit_stu='" + isslimitstu + "'"; int succ = db.DbTrcn(update); if (succ != 0) { Label3.Visible = true; } } catch (Exception eo) { Label3.Visible = true; Label3.Text = "Error==" + eo; } } else if (DropDownList1.SelectedValue.Equals("Faculty")) { try { string new_fac_limit = TextBox2.Text; string update = "update changeSetting set issuelimit_fac='" + new_fac_limit + "' where issuelimit_fac='" + isslimitfac + "'"; int succ = db.DbTrcn(update); if (succ != 0) { Label3.Visible = true; } } catch (Exception eo) { Label3.Visible = true; Label3.Text = "Error==" + eo; } } }
protected void Button1_Click(object sender, EventArgs e) { if (!(TextBox2.Text).Equals("")) { String str = "INSERT INTO suggestions(id,sug) Values('" + id + "' , '" + TextBox2.Text + "')"; int res = con.DbTrcn(str); } else { Label2.Text = "please enter a suggestion"; Label2.Visible = true; } }
protected void Button1_Click(object sender, EventArgs e) { try { string newEmailPass = TextBox1.Text + ":" + TextBox2.Text; string update = "update changeSetting set emailPass='******' where emailPass='******'"; int succ = db.DbTrcn(update); if (succ != 0) { Label3.Visible = true; } } catch (Exception eo) { Label3.Visible = true; Label3.Text = "Error==" + eo; } }
protected void Button1_Click(object sender, EventArgs e) { db.DbTrcn("insert into faculty(name,username,password,contact,email) values('" + fnameTxt.Text + " " + midnameTxt.Text + " " + lastnameTxt.Text + "','" + unameTxt.Text + "','" + passTxt.Text + "','" + contactTxt.Text + "','" + emailTxt.Text + "')"); Label7.Text = "updated successfully"; Label7.Visible = true; }
protected void Button1_Click(object sender, EventArgs e) { int succ = 0; if (DropDownList1.Text.Equals("By Student")) { string update = "update book set loan_period='" + TextBox3.Text + "' where stuid='" + TextBox2.Text + "' and bid='" + TextBox6.Text + "'"; succ = db.DbTrcn(update); if (succ != 0) { String str = "UPDATE book SET duedate='" + newduedateS() + "' where stuid='" + TextBox2.Text + "' and bid='" + TextBox6.Text + "'"; db.DbTrcn(str); Label3.Text = "Return Date for " + TextBox2.Text + " is changed to " + newduedateS() + "."; Label3.Visible = true; } else { Label3.Visible = true; Label3.Text = "Sorry..!! Invalid combination of studentid and bookid..."; } } else if (DropDownList1.Text.Equals("By Faculty")) { string update = "update book set loan_period='" + TextBox5.Text + "' where facusername='******' and bid='" + TextBox1.Text + "'"; succ = db.DbTrcn(update); if (succ != 0) { String str = "UPDATE book SET duedate='" + newduedateF() + "' where facusername='******' and bid='" + TextBox1.Text + "'"; db.DbTrcn(str); Label3.Text = "Return Date for " + TextBox4.Text + " is changed to " + newduedateF() + "."; Label3.Visible = true; } else { Label3.Text = "Sorry..!! Invalid combination of studentid and bookid...."; Label3.Visible = true; } } else { string cmd = "select general_Loan_Fine from changeSetting"; dr = db.RetriveData(cmd); if (dr.Read()) { temp = dr[0].ToString(); LoanFine = temp.Split(':'); if (TextBox7.Text == "") { TextBox7.Text = LoanFine[0]; } if (TextBox8.Text == "") { TextBox8.Text = LoanFine[1]; } } string gen_Loan_Fine = TextBox7.Text + ":" + TextBox8.Text; string update = "update changeSetting set general_Loan_Fine='" + gen_Loan_Fine + "' where general_Loan_Fine='" + temp + "'"; succ = db.DbTrcn(update); if (succ != 0) { Label3.Text = "Genearal Loan Period/Fine changed"; Label3.Visible = true; } else { Label3.Text = "Error in changing Loan Period/Fine"; Label3.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { //getting fine from db string cmd = "select general_Loan_Fine from changeSetting"; dr = db.RetriveData(cmd); if (dr.Read()) { temp = dr[0].ToString(); LoanFine = temp.Split(':'); Get_Loan_Fine = Convert.ToInt32(LoanFine[1]); } // updating fine for student cmd = "select bid, book.dept, bname, duedate,email,name from book,student where book.stuid=student.enrollid and book.ret='n' and book.stuid!='0' "; dr = db.RetriveData(cmd); string duedate = ""; while (dr.Read()) { dt = ((DateTime)dr[3]); duedate = dt.ToShortDateString(); if (DateTime.Now > dt && DateTime.Now.ToShortDateString() != dt.ToShortDateString()) { t = DateTime.Now.Date - dt.Date; fine = t.TotalDays * Get_Loan_Fine; stuDetail.Add(dr[0].ToString()); stuDetail.Add(dr[4].ToString()); stuDetail.Add(dr[5].ToString()); stuDetail.Add(dr[2].ToString()); stuDetail.Add(fine.ToString()); } } for (int i = 0; i < stuDetail.Count; i += 5) { cmd = "update book set fine='" + stuDetail[i + 4] + "' where bid='" + stuDetail[i] + "'"; db.DbTrcn(cmd); } //updating fine for faculty cmd = "select bid, book.dept, bname, duedate,email,name from book,faculty where book.facusername=faculty.username and book.ret='n' and book.facusername!='0' "; dr = db.RetriveData(cmd); while (dr.Read()) { dt = ((DateTime)dr[3]); duedate = dt.ToShortDateString(); if (DateTime.Now > dt && DateTime.Now.ToShortDateString() != dt.ToShortDateString()) { t = DateTime.Now.Date - dt.Date; fine = t.TotalDays * Get_Loan_Fine; facDetail.Add(dr[0].ToString()); facDetail.Add(dr[4].ToString()); facDetail.Add(dr[5].ToString()); facDetail.Add(dr[2].ToString()); facDetail.Add(fine.ToString()); } } for (int i = 0; i < facDetail.Count; i += 5) { cmd = "update book set fine='" + facDetail[i + 4] + "' where bid='" + facDetail[i] + "'"; db.DbTrcn(cmd); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["uname"] == null) { Response.Redirect("login.aspx?info=0"); } try { string qury = " select enrollid,name from student where username='******'"; dr = db.RetriveData(qury); if (dr.Read()) { uid = dr[0].ToString(); name = dr[1].ToString(); ((General)Page.Master).MyText = name; } else { Response.Redirect("login.aspx?info=0"); } cmd = "select general_Loan_Fine from changeSetting"; dr = db.RetriveData(cmd); if (dr.Read()) { temp = dr[0].ToString(); LoanFine = temp.Split(':'); fine = Convert.ToInt32(LoanFine[1]); } cmd = "select bid, duedate from book where ret='n' and stuid='" + uid + "' "; dr = db.RetriveData(cmd); while (dr.Read()) { dt = ((DateTime)dr[1]); duedate = dt.ToShortDateString(); if (DateTime.Now > dt && DateTime.Now.ToShortDateString() != dt.ToShortDateString()) { t = DateTime.Now.Date - dt.Date; tfine = t.TotalDays * fine; stuDetail.Add(dr[0].ToString()); stuDetail.Add(tfine.ToString()); } } for (int i = 0; i < stuDetail.Count; i += 2) { cmd = "update book set fine='" + stuDetail[i + 1] + "' where bid='" + stuDetail[i] + "'"; db.DbTrcn(cmd); } stu_Fine(); } catch (Exception er) { Label1.Visible = true; Label1.Text = "Error:" + er; } }