コード例 #1
0
    protected void checkpin()
    {
        if (Page.IsValid)
        {
            int           found;
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Bonsai_databaseConnectionString"].ConnectionString);
            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr;
            string        mypin;

            con.Open();
            do
            {
                commanFunction cf = new commanFunction();

                mypin = commanFunction.finalcode();
                string str = "select user_id from user_details where user_id = '" + mypin + "' ";
                cmd = new SqlCommand(str, con);
                dr  = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    found = 1;
                    dr.Close();
                }
                else
                {
                    found = 0;
                    cmd.Dispose();
                    dr.Close();
                    con.Close();
                    insert_singup_data(mypin);
                }
            } while (found == 1);
        }
    }
コード例 #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            int            found;
            SqlConnection  con = new SqlConnection(ConfigurationManager.ConnectionStrings["Bonsai_databaseConnectionString"].ConnectionString);
            SqlCommand     cmd = new SqlCommand();
            SqlDataReader  dr;
            commanFunction cf   = new commanFunction();
            string         vpin = "PL" + commanFunction.finalcode();

            con.Open();
            do
            {
                string str = "select plantID from plant_details where plantID = '" + vpin + "' ";
                cmd = new SqlCommand(str, con);
                dr  = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    found = 1;
                    dr.Close();
                }
                else
                {
                    found = 0;
                    cmd.Dispose();
                    dr.Close();
                    con.Close();
                    addplant(vpin);
                    addimg(vpin);
                }
            } while (found == 1);
        }
        Response.Redirect("plant_viwe.aspx");
    }
コード例 #3
0
    protected void btnsendemail_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Bonsai_databaseConnectionString"].ConnectionString);
        SqlCommand    cmd = new SqlCommand();
        SqlDataReader dr;

        commanFunction cf    = new commanFunction();
        string         mypin = commanFunction.getcode1(4);

        try {
            con.Open();
            cmd = new SqlCommand("select * from user_details where email ='" + txtemail.Text + "' ", con);
            dr  = cmd.ExecuteReader();
            dr.Read();
            if (dr.HasRows == true)
            {
                Session["email"] = txtemail.Text;
                string username = dr["usrname"].ToString();
                if (insertkey(mypin) == 1)
                {
                    // string pin1 = dr["pin"].ToString();
                    if (sendemail(mypin, username) == 1)
                    {
                        Response.Redirect("resetpassword.aspx");
                    }
                    else
                    {
                        lblmsg.Text = "try again";
                    }
                }
            }
            else
            {
                lblmsg.Text = "InValid Email ID Plese enter valid email ID";
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
        finally
        {
            con.Close();
            cmd.Dispose();
        }
    }