void generate_table(string tab_name) { x.conopen(); qry = "create table " + tab_name + " (sqid int , ques nvarchar(MAX),ans1 nvarchar(MAX),ans2 nvarchar(MAX),ans3 nvarchar(MAX),ans4 nvarchar(MAX));"; x.iud(qry); x.conclose(); }
protected void btn_submit1_Click(object sender, EventArgs e) { x.conopen(); qry = "insert into book_lost values('" + txt_enroll.Text + "','" + DropDownList1.SelectedValue + "','" + lblbamount.Text + "')"; x.iud(qry); x.conclose(); if (DropDownList1.SelectedValue == "0") { Label2.Text = "You Must Select Book.."; } else { Label3.Text = "Lost Book Amount Payed"; // fillbook(); Panel1.Visible = false; } x.conopen(); qry = "UPDATE book_mster SET qty = qty - 1 WHERE book_id ='" + DropDownList1.SelectedValue + "'"; x.iud(qry); x.conclose(); x.conopen(); qry = "delete from issue_mster where enrollment_no ='" + txt_enroll.Text + "' and book_id='" + DropDownList1.SelectedValue + "'"; x.iud(qry); x.conclose(); Response.AddHeader("refresh", "2;url=book_lost.aspx"); //x.conopen(); //qry="update book_mster set qty=' //x.conclose(); }
protected void btn_submit_Click(object sender, EventArgs e) { string dt2 = Convert.ToString(dt); string dt4 = dt2.Substring(0, 10); x.conopen(); qry = "select * from paper where pname='" + txtpname.Text + "'"; dtt = x.ser(qry); if (dtt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into paper values('" + txtpname.Text + "','" + dt4 + "')"; x.iud(qry); x.conclose(); Panel1.Visible = true; x.qry = "SELECT que as Question,ans1 as Ans1, ans2 as Ans2, ans3 as Ans3, ans4 as Ans4,type as Type FROM question WHERE sid =" + subject.SelectedValue + " AND cid =" + chapter.SelectedValue; x.ds = x.fillgrid(x.qry); GridView1.DataSource = x.ds.Tables[0]; GridView1.DataBind(); } else { lbl_sub.Text = "This Paper Name Is Already exist"; Response.AddHeader("refresh", "2;url=generatepaper.aspx"); } }
protected void btn_return_Click(object sender, EventArgs e) { x.conopen(); qry = "insert into return_mster values('" + txt_enroll.Text + "','" + DropDownList1.SelectedValue + "','" + lbl_issuedate.Text + "','" + dt + "','" + lbl_panalty.Text + "')"; x.iud(qry); x.conclose(); x.conopen(); qry = "delete from issue_mster where usn_no='" + txt_enroll.Text + "' AND book_id=" + DropDownList1.SelectedValue; x.iud(qry); x.conclose(); //Panel1.Visible = false; if (DropDownList1.SelectedValue == "0") { Label2.Text = "You must select any book..."; } else { Label3.Text = "Book is returned successfully....."; Panel1.Visible = false; clearT(); x.conopen(); SqlDataAdapter dap = new SqlDataAdapter("select d.demand_id,d.usn_no,b.book_name,d.demand_date from demand_mster as d inner join book_mster as b on d.book_id=b.book_id where d.book_id='" + DropDownList1.SelectedValue + "'", x.cn); dap.Fill(dst); if (dst.Tables[0].Rows.Count > 0) { GridView1.DataSource = dst.Tables[0]; GridView1.DataBind(); Panel3.Visible = true; string Password = "******"; string Msg1 = "book_is_avalible_now"; string OPTINS = "SMTLIB"; x.conclose(); x.conopen(); qry = "SELECT TOP (1) s.mob_no, d.usn_no FROM demand_mster AS d INNER JOIN student_mster AS s ON d.usn_no = s.usn_no ORDER BY d.demand_id"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); string mobno = Convert.ToString(dr[0]); x.conclose(); string MobileNumber = mobno; string type = "3"; string strUrl = "http://bulksmsgateway.in/sendmessage.php?user=yashjari&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + 3; System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream s = (Stream)response.GetResponseStream(); StreamReader readStream = new StreamReader(s); string dataString = readStream.ReadToEnd(); response.Close(); s.Close(); readStream.Close(); x.conopen(); qry = "DELETE TOP (1) FROM demand_mster WHERE book_id='" + DropDownList1.SelectedValue + "'"; x.iud(qry); x.conclose(); } } } }
protected void btn_issue_Click(object sender, EventArgs e) { String dtIssue = DateTime.Today.Date.ToString("d"); String dtReturn = DateTime.Today.AddDays(7).Date.ToString("d"); x.conopen(); qry = "select * from issue_mster where usn_no ='" + txt_enroll.Text + "' and book_id = '" + DropDownList1.SelectedValue + "'"; dr = x.search(qry); if (dr.HasRows) { Label1.Text = "This Book Is Alredy Issue By " + lbl_sname.Text; clearL(); } else { x.conclose(); x.conopen(); qry = "insert into issue_mster values ('" + txt_enroll.Text + "','" + DropDownList3.SelectedValue + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + dtIssue.ToString() + "','" + dtReturn.ToString() + "')"; x.iud(qry); Panel1.Visible = false; } x.conclose(); Label3.Text = " Book Is Issued....."; Response.Write("<script></script>"); clearT(); fillpublication(); fillbook(); }
protected void btn_change_Click(object sender, EventArgs e) { x.conopen(); qry = "select * from student_mster where email_id='" + Session["email_id"].ToString() + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); if (txtcurrentpass.Text == dr[9].ToString()) { if (txtnewpass.Text == txtreenter.Text) { x.conclose(); x.conopen(); qry = "update student_mster set pass='******' where email_id='" + Session["email_id"].ToString() + "'"; x.iud(qry); lbl_error.Text = "Password will Be changed"; Response.Redirect("~/User/login.aspx"); } else { lbl_error.Text = "New Password And Confirm Password Must Be Same"; } } else { lbl_error.Text = "Current Password Wrong"; } } else { lbl_error.Text = "No User Found"; } x.conclose(); }
protected void btn_issue_Click(object sender, EventArgs e) { DateTime dt = DateTime.Today; DateTime dt1 = DateTime.Today.AddDays(7); string dt2 = Convert.ToString(dt); string dt3 = Convert.ToString(dt1); string dt4 = dt2.Substring(0, 10); string dt5 = dt3.Substring(0, 10); x.conopen(); qry = "select * from issue_mster where enrollment_no ='" + txt_enroll.Text + "' and book_id = '" + DropDownList1.SelectedValue + "'"; dr = x.search(qry); if (dr.HasRows) { Label1.Text = "This Book Is Alredy Issue By You..."; clearL(); } else { x.conclose(); x.conopen(); qry = "insert into issue_mster values ('" + txt_enroll.Text + "','" + DropDownList3.SelectedValue + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + dt4 + "','" + dt5 + "')"; x.iud(qry); //Label1.Text = " Book Is Issued....."; Panel1.Visible = false; } x.conclose(); // Response.Redirect("book_issue.aspx"); Label3.Text = " Book Is Issued....."; clearT(); fillpublication(); fillbook(); Response.AddHeader("refresh", "2;url=book_issue.aspx"); }
protected void btn_submit_Click(object sender, EventArgs e) { if (subject.SelectedItem.Text == "--Select subject--" || chapter.SelectedItem.Text == "--Select chapter--" || type.SelectedItem.Text == "--Select Type--") { lbl_sub.Text = "DropDown Must Be Select...!!!"; } else { x.conopen(); qry = "select * from question where que='" + txtques.Text + "'"; dt = x.ser(qry); if (dt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into question values ('" + subject.SelectedValue + "','" + chapter.SelectedValue + "','" + txtques.Text + "','" + txtans1.Text + "','" + txtans2.Text + "','" + txtans3.Text + "','" + txtans4.Text + "','" + txtca.Text + "','" + type.SelectedItem.Text + "')"; x.iud(qry); x.conclose(); lbl_sub.Text = "Question is added....."; clear(); Response.AddHeader("refresh", "2;url=question.aspx"); } else { lbl_sub.Text = "Question Is Already Added"; Response.AddHeader("refresh", "2;url=question.aspx"); } } }
protected void btn_submit_Click(object sender, EventArgs e) { x.conopen(); qry = "insert into pub_mster values ('" + txtpubname.Text + "')"; x.iud(qry); x.conclose(); Label1.Text = "Publication is added....."; clear(); }
protected void btn_demand_Click(object sender, EventArgs e) { Label1.Visible = true; x.conopen(); qry = "insert into demand_mster values('" + Session["enrollment_no"] + "','" + DropDownList2.SelectedValue + "','" + dt + "')"; x.iud(qry); x.conclose(); Label1.Text = " Your Demand Request Successfully Send To The Librarian"; }
protected void btn_submit1_Click(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "0") { Label2.Text = "You Must Select Book.."; } else { Label3.Text = "Lost Book Gain & Money is Refunded"; Panel1.Visible = false; } x.conopen(); qry = "UPDATE book_mster SET qty = qty + 1,total_amt=qty*price WHERE book_id ='" + DropDownList1.SelectedValue + "'"; x.iud(qry); x.conclose(); x.conopen(); qry = "delete from book_lost where usn_no ='" + txt_enroll.Text + "' and book_id='" + DropDownList1.SelectedValue + "'"; x.iud(qry); x.conclose(); }
protected void Page_Load(object sender, EventArgs e) { x.conopen(); qry = "select * from sms_mster where date='" + DateTime.Today + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); } else { x.conclose(); x.conopen(); qry = "insert into sms_mster values('1','" + DateTime.Today + "')"; x.iud(qry); x.conclose(); x.conopen(); qry = "select s.mob_no,i.issue_date from issue_mster as i inner join student_mster as s on i.enrollment_no=s.enrollment_no"; dr = x.search(qry); while (dr.Read()) { string idate = Convert.ToString(dr[1]); diff = Convert.ToDateTime(dt) - Convert.ToDateTime(idate); // double days = diff.TotalDays; if (diff.TotalDays == 6) { string Password = "******"; string Msg1 = "Tomorrow_is_last_day-for-issued-book"; string OPTINS = "SMTLIB"; string mobno = Convert.ToString(dr[0]); // x.conclose(); string MobileNumber = mobno; string type = "3"; string strUrl = "http://bulksmsgateway.in/sendmessage.php?user=yashjari&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + 3; System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream s = (Stream)response.GetResponseStream(); StreamReader readStream = new StreamReader(s); string dataString = readStream.ReadToEnd(); response.Close(); s.Close(); readStream.Close(); } } x.conclose(); } x.conclose(); }
protected void btn_submit_Click(object sender, EventArgs e) { if (DropDownList1.SelectedItem.Text == "--Select Sem--") { Label1.Text = "Sem Must Be Selected...!!!"; } else { x.conopen(); qry = "insert into subject_mster values ('" + DropDownList1.SelectedValue + "','" + txtsubname.Text + "')"; x.iud(qry); x.conclose(); Label1.Text = "Subject is added....."; clear(); } }
protected void btn_submit_Click(object sender, EventArgs e) { if (DropDownList1.SelectedItem.Text == "--Select Publication--" || DropDownList2.SelectedItem.Text == "--Select Author--" || DropDownList3.SelectedItem.Text == "--Select Sem--" || ddlsub.SelectedItem.Text == "--Select Subject--") { Label2.Text = "DropDown Must Be Select...!!!"; } else { x.conopen(); qry = "insert into book_mster values ('" + txtbookname.Text + "','" + DropDownList1.SelectedValue + "','" + txtedition.Text + "','" + DropDownList2.SelectedValue + "','" + DropDownList3.SelectedValue + "','" + ddlsub.SelectedValue + "','" + txtqty.Text + "','" + txtprice.Text + "','" + Label1.Text + "')"; x.iud(qry); x.conclose(); Label2.Text = "Book is added....."; clear(); Label1.Text = ""; //Response.Redirect("add_book.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { x.conopen(); qry = "select * from subject where sname='" + txtsubname.Text + "'"; dt = x.ser(qry); if (dt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into subject values ('" + txtsubname.Text + "')"; x.iud(qry); x.conclose(); lbl_sub.Text = "subject is added..."; clear(); Response.AddHeader("refresh", "2;url=subject.aspx"); } else { lbl_sub.Text = "Subject Is Already Added"; Response.AddHeader("refresh", "2;url=subject.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { x.conopen(); qry = "select * from chapter where cname='" + txtchname.Text + "'"; dt = x.ser(qry); if (dt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into chapter values ('" + DropDownList2.SelectedValue + "','" + txtchname.Text + "')"; x.iud(qry); x.conclose(); lbl_sub.Text = "Chapter is added..."; clear(); Response.AddHeader("refresh", "2;url=chapter.aspx"); } else { lbl_sub.Text = "Question Is Already Added"; Response.AddHeader("refresh", "2;url=chapter.aspx"); } }
protected void btn_change_Click(object sender, EventArgs e) { x.conopen(); qry = "select * from admin_mster where name='" + Session["name"].ToString() + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); if (txt_pass.Text == dr[3].ToString()) { if (txtnew_pass.Text == txtre_pass.Text) { x.conclose(); x.conopen(); qry = "update admin_mster set password='******' where name='" + Session["name"].ToString() + "'"; x.iud(qry); Label1.Text = "Password will Be changed"; Response.AddHeader("refresh", "2;url=login.aspx"); //Response.Redirect("~/Admin/login.aspx"); } else { Label2.Text = "You Must Enter Same in Both New & Re-enter Password"; } } else { Label2.Text = "Current Password Wrong"; } } else { Label2.Text = "No User Found"; } x.conclose(); }
protected void btn_submit_Click(object sender, EventArgs e) { string Gender = "M"; if (r2.Checked) { Gender = "F"; } x.conopen(); qry = "select * from student_mster where email_id='" + txtemail.Text + "'"; dt = x.ser(qry); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/ " + txtusn_no.Text + str)); fname = txtusn_no.Text + str; } else { } if (dt.Rows.Count == 0) { x.conclose(); if (MyCaptcha1.IsValid) { string pass = RandomString(8); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); if (chk.Contains(str.ToLower())) { string body = this.PopulateBody(txtemail.Text, txtfname.Text, System.DateTime.Now.ToString(), pass); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/" + txtusn_no.Text + str)); MailMessage Msg = new MailMessage(); Msg.From = new MailAddress(txtemail.Text); Msg.To.Add(txtemail.Text); Msg.Subject = "Please Change your Password After Login"; Msg.Body = body; Msg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "admin@5511"); smtp.EnableSsl = true; smtp.Send(Msg); Msg = null; string Password = "******"; string Msg1 = "Register_Successed..."; string OPTINS = "SMTLIB"; string MobileNumber = txtmob_no.Text; string type = "3"; string strUrl = "http://bulksmsgateway.in/sendmessage.php?user=yashjari&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + type; System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream s = (Stream)response.GetResponseStream(); StreamReader readStream = new StreamReader(s); string dataString = readStream.ReadToEnd(); response.Close(); s.Close(); readStream.Close(); lbl_error.Text = "Your Password Details Sent to your mail"; Response.AddHeader("Refresh", "5;url=Login.aspx"); x.conopen(); qry = "insert into student_mster values ('" + txtusn_no.Text + "','" + txtfname.Text + "','" + txtaddress.Text + "','" + txtmob_no.Text + "','" + txtemail.Text + "','" + Gender + "','" + txtdob.Text + "','" + DropDownList1.SelectedValue + "','" + pass.ToString() + "','" + fname + "')"; x.iud(qry); x.conclose(); } else { lbl_error.Text = "Please Select Image File Only"; } } else { lbl_error.Text = "Please Select the File"; } } else { lbl_error.Text = "Captcha is Wrong"; } } else { // x.conclose(); lbl_error.Text = "You Are Already Registered. Now you will be redirect to login page"; Response.AddHeader("Refresh", "5;url=Login.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { string Gender; Gender = RadioButtonList1.SelectedItem.Value; x.conopen(); qry = "select * from faculty_mster where email_id='" + txtemail.Text + "' or fname='" + txtfname.Text + "'"; dt = x.ser(qry); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/ " + txtfname.Text + str)); fname = txtfname.Text + str; } if (dt.Rows.Count == 0) { x.conclose(); if (ImgSrc.HasFile) { str = System.IO.Path.GetExtension(ImgSrc.PostedFile.FileName); if (chk.Contains(str)) { try { string body = this.PopulateBody(txtemail.Text, txtfname.Text, System.DateTime.Now.ToString(), pass); ImgSrc.PostedFile.SaveAs(Server.MapPath("~/User/images/profile/" + txtfname.Text + str)); MailMessage Msg = new MailMessage(); Msg.From = new MailAddress(txtemail.Text); Msg.To.Add(txtemail.Text); Msg.Subject = "Please Change your Password After Login"; Msg.Body = body; Msg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "admin@5511"); smtp.EnableSsl = true; smtp.Send(Msg); Msg = null; string Password = "******"; string Msg1 = "Register-Successed..."; string OPTINS = "Paper_Generation"; string MobileNumber = txtmob_no.Text; string type = "3"; string strUrl = "https://www.bulksmsgateway.in/sendmessage.php?user=sarthak29&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + 3; System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream s = (Stream)response.GetResponseStream(); StreamReader readStream = new StreamReader(s); string dataString = readStream.ReadToEnd(); response.Close(); s.Close(); readStream.Close(); //Response.Write("Sent"); /*string Password = "******"; * string Msg1 = "Register-Successed..."; * string OPTINS = "Paper_Generation"; * string MobileNumber = txtmob_no.Text; * string type = "3"; * string strUrl = "https://www.bulksmsgateway.in/sendmessage.php?user=ansh7117&password="******"&message=" + Msg1 + "&sender=" + OPTINS + "&mobile=" + MobileNumber + "&type=" + 3; * System.Net.WebRequest request = System.Net.WebRequest.Create(strUrl); * HttpWebResponse response = (HttpWebResponse)request.GetResponse(); * Stream s = (Stream)response.GetResponseStream(); * StreamReader readStream = new StreamReader(s); * string dataString = readStream.ReadToEnd(); * response.Close(); * s.Close(); * readStream.Close();*/ // Response.Write("Sent"); lbl_sub.Text = "Your Password Details Sent to your mail"; string date1 = txtdob.Text.Substring(0, 10); x.conopen(); qry = "insert into faculty_mster values ('" + txtfname.Text + "','" + txtlname.Text + "','" + date1.ToString() + "','" + Gender + "','" + txtcity.Text + "','" + txtmob_no.Text + "','" + txtemail.Text + "','" + pass.ToString() + "','" + fname + "')"; x.iud(qry); x.conclose(); x.conopen(); qry = "insert into admin_master values('" + txtfname.Text + "','" + txtemail.Text + "','" + pass.ToString() + "')"; x.iud(qry); x.conclose(); clear(); } catch (Exception ex) { lbl_sub.Text = "Connection Error Please Try Agian..."; } } else { lbl_sub.Text = "Please Select Image File Only"; } } else { lbl_sub.Text = "Please Select the File"; } } else { // x.conclose(); lbl_sub.Text = "You Are Already Registered. Now you will be redirect to login page"; // lbl_sub.Text = "This Enrollment Number Is Already Registered...."; //Response.AddHeader("Refresh", "5;url=Login.aspx"); } Response.AddHeader("refresh", "5;url=faculty.aspx"); }