コード例 #1
0
 void fillbook()
 {
     x.conopen();
     qry = "select distinct a.issue_id,b.first_name,c.book_name,a.issue_date,c.book_id from issue_mster a,student_mster b,book_mster c where b.enrollment_no=a.enrollment_no and a.book_id=c.book_id and a.enrollment_no='" + txt_enroll.Text + "'";
     dst = x.fills(qry);
     if (dst.Tables[0].Rows.Count > 0)
     {
         lbl_sname.Text               = dst.Tables[0].Rows[0][1].ToString();
         DropDownList1.DataSource     = dst.Tables[0];
         DropDownList1.DataTextField  = "book_name";
         DropDownList1.DataValueField = "book_id";
         DropDownList1.DataBind();
         DropDownList1.Items.Insert(0, new ListItem("--Select Book--", "0"));
     }
     else
     {
         Panel1.Visible = false;
         Label1.Text    = " You Don't Have Any Issued Book...";
     }
     x.conclose();
     //x.conopen();
     //qry = "select * from book_mster";
     //dst = x.fills(qry);
     ////DropDownList1.DataSource=dst.Tables[0];
     //DropDownList1.DataTextField = "book_name";
     //DropDownList1.DataValueField = "book_id";
     //DropDownList1.DataBind();
     //DropDownList1.Items.Insert(0, new ListItem("--Select Book--", "0"));
     //x.conclose();
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 void fillsubject()
 {
     x.conopen();
     qry = "select * from subject";
     dst = x.fills(qry);
     //DropDownList1.DataSource=dst.Tables[0];
     subject.DataTextField  = "sname";
     subject.DataValueField = "sid";
     subject.DataBind();
     subject.Items.Insert(0, new ListItem("--Select subject--", "0"));
     x.conclose();
 }
コード例 #4
0
 void fillpaper()
 {
     x.conopen();
     qry = "select * from paper";
     dst = x.fills(qry);
     //DropDownList1.DataSource=dst.Tables[0];
     paper.DataTextField  = "pname";
     paper.DataValueField = "pid";
     paper.DataBind();
     paper.Items.Insert(0, new ListItem("--Select paper--", "0"));
     x.conclose();
 }
コード例 #5
0
 void fillpublication()
 {
     x.conopen();
     qry = "select * from pub_mster";
     dst = x.fills(qry);
     //DropDownList1.DataSource=dst.Tables[0];
     DropDownList1.DataTextField  = "pub_name";
     DropDownList1.DataValueField = "pub_id";
     DropDownList1.DataBind();
     DropDownList1.Items.Insert(0, new ListItem("--Select publication--", "0"));
     x.conclose();
 }
コード例 #6
0
    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();
    }
コード例 #7
0
 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 = "";
     }
 }
コード例 #8
0
    public void FillGrid()
    {
        x.conopen();
        //SELECT b.book_id,b.book_name,p.pub_name,b.edition,author_id,sem,subject,qty,price,(book_mster.Price*book_mster.qty) as Total1 from book_mster
        SqlCommand cmd = new SqlCommand("SELECT b.book_id, b.book_name, p.pub_name, b.edition, a.author_name, b.sem, s.sub_name, b.qty, b.price,(b.Price*b.qty) as Total1 FROM book_mster AS b INNER JOIN pub_mster AS p ON b.pub_id = p.pub_id INNER JOIN author_mster AS a ON b.author_id = a.author_id inner join subject_mster as s on b.sub_id=s.sub_id order by b.book_id", x.cn);

        GridView1.DataSource = cmd.ExecuteReader();
        GridView1.DataBind();
        x.conclose();
        //x.conopen();
        //string s;
        //s = "select sum (qty*price) as Total from book_mster";
        //addition = x.totalprice(s);
        //lbltotal_amt.text = addition.ToString();
        //x.conclose();
    }
コード例 #9
0
 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();
 }
コード例 #10
0
    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");
        }
    }
コード例 #11
0
 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");
     }
 }
コード例 #12
0
 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();
 }
コード例 #13
0
 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();
 }
コード例 #14
0
 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");
     }
 }
コード例 #15
0
 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");
     }
 }
コード例 #16
0
    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();

        //}
    }
コード例 #17
0
 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();
 }
コード例 #18
0
 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();
     }
 }
コード例 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        x.conopen();
        qry          = "select count(*) from pub_mster";
        lbl_pub.Text = x.sca(qry);

        qry = "select count(*) from author_mster";
        lbl_authors.Text = x.sca(qry);

        qry            = "select sum(qty) from book_mster";
        lbl_books.Text = x.sca(qry);

        qry = "select count(*) from student_mster";
        lbl_students.Text = x.sca(qry);
        x.conclose();
    }
コード例 #20
0
 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();
 }
コード例 #21
0
 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();
     }
 }
コード例 #22
0
    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");
    }
コード例 #23
0
 void fillbook()
 {
     x.conopen();
     qry = "select distinct a.issue_id,b.first_name,c.book_name,a.issue_date,c.book_id from issue_mster a,student_mster b,book_mster c where b.enrollment_no=a.enrollment_no and a.book_id=c.book_id and a.enrollment_no='" + txt_enroll.Text + "'";
     dst = x.fills(qry);
     if (dst.Tables[0].Rows.Count > 0)
     {
         lbl_sname.Text               = dst.Tables[0].Rows[0][1].ToString();
         DropDownList1.DataSource     = dst.Tables[0];
         DropDownList1.DataTextField  = "book_name";
         DropDownList1.DataValueField = "book_id";
         DropDownList1.DataBind();
         DropDownList1.Items.Insert(0, new ListItem("--Select Book--", "0"));
         //idate=dst.Tables[0].Rows[0][3].ToString();
         //diff = dt - Convert.ToDateTime(idate);
         // var days = diff.TotalDays;
         //lbl_days.Text = Convert.ToString(days);
         //lbl_issuedate.Text = idate.ToString();
         //x.conclose();
         //x.conopen();
         //qry = "select * from  issue_mster where enrollment_no=" + txt_enroll.Text ;
         //dr = x.search(qry);
         //dr.Read();
         //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";
         //}
     }
     else
     {
         Panel1.Visible = false;
         Label1.Text    = "You Don't Have Any Issued Book...";
     }
     x.conclose();
 }
コード例 #24
0
    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();
        }
    }
コード例 #25
0
    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");
        }
    }