protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { x.conopen(); qry = "select * from issue_mster where enrollment_no='" + txt_enroll.Text + "'AND book_id=" + DropDownList1.SelectedItem.Value; dr = x.search(qry); dr.Read(); idate = Convert.ToString(dr[5]); diff = dt - Convert.ToDateTime(idate); var days = diff.TotalDays; lbl_days.Text = Convert.ToString(days); lbl_issuedate.Text = idate.ToString(); DateTime rdate = Convert.ToDateTime(dr[5].ToString()); TimeSpan differ = dt - rdate; double day = differ.TotalDays; if (day <= 7) { lbl_panalty.Text = "NO"; } else { lbl_panalty.Text = "YES"; } x.conclose(); if (lbl_panalty.Text == "YES") { btn_return.Enabled = false; btn_panalty.Enabled = true; } else { btn_return.Enabled = true; btn_panalty.Enabled = false; } x.conopen(); SqlCommand cmd = new SqlCommand("SELECT d.demand_id , d.enrollment_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 b.book_id= '" + DropDownList1.SelectedValue + "'", x.cn); GridView1.DataSource = cmd.ExecuteReader(); GridView1.DataBind(); x.conclose(); //x.conopen(); //dst.Clear(); //qry = "select * from demand_mster "; //SqlDataAdapter adp = new SqlDataAdapter(qry, x.cn); //adp.Fill(dst); //GridView1.DataSource=dst.Tables[0]; //GridView1.DataBind(); //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_search_Click(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "0" || DropDownList2.SelectedValue == "0") { Label3.Text = "You Must Select Any Values IN Dropdown..."; } else { x.conopen(); qry = "select qty from book_mster where book_id='" + DropDownList2.SelectedValue + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); i = Convert.ToInt32(dr[0].ToString()); } x.conclose(); x.conopen(); qry = "select count(*) from issue_mster where book_id='" + DropDownList2.SelectedValue + "'"; string q = x.sca(qry); //Label2.Text = q; int k = i - Convert.ToInt32(q); Label3.Text = " Available Book : " + k.ToString(); if (k.ToString() == "0") { btn_demand.Visible = true; } x.conclose(); } }
protected void Page_Load(object sender, EventArgs e) { try { Image1.Visible = true; x.conopen(); string qry = "select * from student_mster where email_id='" + Session["email_id"] + "'"; x.dr = x.search(qry); if (x.dr.HasRows) { x.dr.Read(); profile = x.dr["image"].ToString(); Image1.ImageUrl = "images/profile/" + profile; } else { Image1.Visible = false; Image1.ImageUrl = ""; } x.conclose(); } catch (Exception Ex) { Image1.Visible = false; Image1.ImageUrl = ""; } }
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_login_Click(object sender, EventArgs e) { x.conopen(); qry = "select * from admin_master where email_id='" + txtuname.Text + "'and password='******'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); Session["name"] = dr[1].ToString(); Response.Redirect("ahome.aspx"); } else { Label1.Text = "User not found..."; } x.conclose(); }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { x.conopen(); qry = "select price from book_lost where book_id='" + DropDownList1.SelectedValue + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); lblbamount.Text = dr["price"].ToString(); } x.conclose(); }
protected void Page_Load(object sender, EventArgs e) { x.conopen(); qry = "select pid from paper"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); id = Convert.ToInt32(dr[0].ToString()); x.conclose(); x.conopen(); qry = "select pname,date from paper"; dr = x.search(qry); //x.ds = x.fillgrid(x.qry); GridView1.DataSource = dr; GridView1.DataBind(); } else { } x.conclose(); //} }
protected void Page_Load(object sender, EventArgs e) { x.conopen(); qry = "select image,usn_no,first_name,mob_no,email_id,dob,sem from student_mster where email_id='" + Session["email_id"] + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); Image1.ImageUrl = "images/profile/" + dr[0].ToString(); lblusn_no.Text = dr[1].ToString(); lblname.Text = dr[2].ToString(); lblmob_no.Text = dr[3].ToString(); lblemail.Text = dr[4].ToString(); lbldob.Text = dr[5].ToString(); lblsem.Text = dr[6].ToString(); } else { Response.Redirect("User/login.aspx"); } x.conclose(); }
protected void Button1_Click(object sender, EventArgs e) { if (txtemail.Text != null) { x.conopen(); qry = "select * from student_mster where email_id='" + txtemail.Text + "'and pass='******'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); Session["email_id"] = txtemail.Text; Session["usn_no"] = dr[1].ToString(); Response.Redirect("uhome.aspx"); } else { //Response.Write("<script>alert('Innvalid Username & Password')</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "$.notify(\"Please Enter the Valid Details.\", \"error\");", true); //Label1.Text = "User not found..."; } x.conclose(); } }
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 btninsert_Click(object sender, EventArgs e) { x.conopen(); qry = "select pid from paper where pname='" + txtpname.Text + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); id = Convert.ToInt32(dr[0].ToString()); } x.conclose(); for (int i = 0; i < GridView1.Rows.Count; i++) { chk = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chkques"); if (chk.Checked) { qry = "select * from question where qid=" + (i + 1); dtt.Clear(); dtt = x.ser(qry); if (dtt.Rows.Count > 0) { x.conopen(); qry = "insert into paper_details values('" + dtt.Rows[0]["qid"].ToString() + "','" + id.ToString() + "')"; x.iud(qry); x.conclose(); } } } x.conopen(); qry = "SELECT q.que, q.ans1, q.ans2, q.ans3, q.ans4 FROM paper_details AS pd INNER JOIN question AS q ON pd.qid =q.qid INNER JOIN paper AS p ON pd.pid =p.pid where pd.pid='" + id.ToString() + "'"; dtt = x.ser(qry); x.conclose(); Document doc = new Document(PageSize.A4, 10, 10, 10, 10); MemoryStream mstream = new MemoryStream(); PdfWriter writter = PdfWriter.GetInstance(doc, new FileStream(Server.MapPath("~/Papers/" + txtpname.Text + ".pdf"), FileMode.Create)); doc.Open(); for (int i = 0; i < dtt.Rows.Count; i++) { Paragraph p = new Paragraph(); ques = dtt.Rows[i]["que"].ToString(); opt1 = dtt.Rows[i]["ans1"].ToString(); opt2 = dtt.Rows[i]["ans2"].ToString(); opt3 = dtt.Rows[i]["ans3"].ToString(); opt4 = dtt.Rows[i]["ans4"].ToString(); p.Add("Q" + (i + 1) + ". "); p.Add(ques); p.Add(new Chunk("\n")); p.Add("A. "); p.Add(opt1); p.Add(new Chunk("\n")); p.Add("B. "); p.Add(opt2); p.Add(new Chunk("\n")); p.Add("C. "); p.Add(opt3); p.Add(new Chunk("\n")); p.Add("D. "); p.Add(opt4); p.Add(new Chunk("\n\n")); doc.Add(p); } doc.Close(); byte[] bytes = mstream.ToArray(); mstream.Close(); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=" + txtpname.Text + ".pdf"); Response.ContentType = "application/pdf"; Response.Buffer = true; Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.BinaryWrite(bytes); Response.AddHeader("refresh", "2;url=generatepaper.aspx"); }
protected void btn_submit_Click(object sender, EventArgs e) { if (txt_enroll.Text == "") { Panel1.Visible = false; Label2.Text = "Pls Enter Enrollment Number...!!!"; } else if (DropDownList1.SelectedValue == "0" || DropDownList2.SelectedValue == "0" || DropDownList3.SelectedValue == "0") { Label2.Text = "You Must Select Any Values In Dropdown "; } else { Panel1.Visible = true; x.conopen(); qry = "select * from student_mster where usn_no ='" + txt_enroll.Text + "'"; dr = x.search(qry); if (dr.HasRows) { dr.Read(); x.conclose(); x.conopen(); qry = "select count(*) from issue_mster where usn_no='" + txt_enroll.Text + "'"; dr = x.search(qry); dr.Read(); books = Convert.ToInt32(dr[0]); lbl_books.Text = "Total Issued : " + books.ToString(); if (books < 3) { Label2.Text = ""; } else { Panel1.Visible = false; Label2.Text = " YOU HAVE ALREADY BEEN ISSUED 3 BOOKS...."; } x.conclose(); x.conopen(); qry = "select * from book_mster where book_id=" + DropDownList1.SelectedValue; dr = x.search(qry); dr.Read(); qty = Convert.ToInt32(dr[7]); lbl_qty.Text = qty.ToString(); x.conclose(); x.conopen(); qry = "select * from student_mster where usn_no='" + txt_enroll.Text + "'"; dr = x.search(qry); dr.Read(); sname = Convert.ToString(dr[2]); lbl_sname.Text = sname.ToString(); x.conclose(); x.conopen(); qry = "SELECT COUNT(*) AS Expr1 FROM issue_mster WHERE pub_id ='" + DropDownList2.SelectedValue + "' AND book_id =" + DropDownList1.SelectedValue; dr = x.search(qry); dr.Read(); rent = Convert.ToInt32(dr[0]); lbl_rent.Text = rent.ToString(); available = Convert.ToInt32(dr[0]); lbl_availabel.Text = qty.ToString(); Int32 val1 = Convert.ToInt32(lbl_qty.Text); Int32 val2 = Convert.ToInt32(lbl_rent.Text); Int32 val3 = val1 - val2; lbl_availabel.Text = val3.ToString(); if (lbl_availabel.Text == "0") { btn_issue.Enabled = false; } else { btn_issue.Enabled = true; } } else { Panel1.Visible = false; Label2.Text = " ENROLLMENT NUMBER IS NOT CORRECT....."; } x.conclose(); } }