예제 #1
0
        protected void btn_fsubmit_Click(object sender, EventArgs e)
        {
            //check whether the entered captcha text is matched or not
            if (this.txt_captcha.Text == this.Session["CaptchaImageText"].ToString())
            {
                string emailid = txt_femailid.Text;
                try
                {
                    IUser checkuser = new UserItems();

                    //returns table if given email id exists
                    dt = checkuser.checkavailability(emailid);
                    if (dt == null)
                    {
                        lbl_femailid.Text = HardCodedValues.BuddaResource.EmailIdNull;
                        // Create a random Captcha and store it in the Session object.
                        this.Session["CaptchaImageText"] = Captcha.CaptchaImage.GenerateRandomCode(HardCodedValues.BudhaConstants.RandomPasswordLength);
                        lbl_captcha.Text = string.Empty;
                    }
                    else
                    {
                        //if email id exists, then generate a new random password
                        string newpwd = GenerateRandomPassword(HardCodedValues.BudhaConstants.RandomPasswordLength);

                        //encrypt the given password to store in database
                        string encryptedpwd = CLASS.PasswordEncryption.EncryptIt(newpwd);

                        //update the new password in database
                        bool ispwdupdated = checkuser.UpdatePassword(emailid, encryptedpwd);
                        if (ispwdupdated)
                        {
                            //send the new password to the user email id
                            sendEmail(emailid, newpwd);

                            lbl_fsubmit.Text      = HardCodedValues.BuddaResource.PwdForgotSuccess;
                            lbl_fsubmit.Font.Bold = true;
                        }
                        else
                        {
                            lbl_fsubmit.Text = HardCodedValues.BuddaResource.Error;
                        }
                    }
                }
                catch (Exception ex)
                {
                    lbl_fsubmit.Text = HardCodedValues.BuddaResource.CatchBlockError + ex.Message;
                }
            }
            else
            {
                txt_captcha.Text = "";
                lbl_captcha.Text = HardCodedValues.BuddaResource.CaptchaError;
                // Create a random Captcha and store it in the Session object.
                this.Session["CaptchaImageText"] = Captcha.CaptchaImage.GenerateRandomCode(7);
                txt_captcha.Focus();
            }
        }
예제 #2
0
        public static AddressDetails[] showAdress()
        {
            List <AddressDetails> adrdetails = new List <AddressDetails>();

            //budhashop.USER.OrderPage pge = new budhashop.USER.OrderPage();
            if (HttpContext.Current.Session["currentuser"] != null)
            {
                DataTable dtt     = (DataTable)HttpContext.Current.Session["currentuser"];
                string    emailid = dtt.Rows[0]["Email"].ToString();

                try
                {
                    IUser retrieveuser = new UserItems();

                    //returns the table if given emailid exists
                    DataTable dt2 = retrieveuser.checkavailability(emailid);
                    if (dt2 != null)
                    {
                        AddressDetails adr = new AddressDetails();
                        //pge.txt_emailid.Text
                        adr.EmailId = dt2.Rows[0]["Email"].ToString();

                        //txt_uname.Text
                        adr.UserName = dt2.Rows[0]["UserName"].ToString();
                        //pge.txt_phno.Text
                        adr.Phone = dt2.Rows[0]["Phone"].ToString();
                        //pge.txt_address.Text
                        adr.Address = dt2.Rows[0]["Address"].ToString();

                        adrdetails.Add(adr);
                    }
                }
                catch (Exception ex)
                {
                    //pge.lbl_status.Text = "Error Occured : " + ex.Message;
                    throw ex;
                }
            }

            //ClientScript.RegisterHiddenField("isPostBack", "1");
            return(adrdetails.ToArray());


            //pge.CartDiv.Visible = false;
            //pge.adressDiv.Visible = true;
            //return true;
        }
예제 #3
0
        public bool RegisterUser(string emailid, string password)
        {
            try
            {
                IUser checkuser = new UserItems();

                //returns the table if given emailid exists
                dt = checkuser.checkavailability(emailid);
                if (dt == null)
                {
                    string encryptedpwd = CLASS.PasswordEncryption.EncryptIt(password);
                    BusinessEntitiesBS.UserEntities.userobj userObj = new BusinessEntitiesBS.UserEntities.userobj();

                    userObj.uname   = "";
                    userObj.emailid = emailid;
                    userObj.pwd     = encryptedpwd;
                    try
                    {
                        IUser userInsert = new UserItems();

                        //insert new user details in database with given values
                        userInsert.insertUser(userObj);

                        DataTable dt2 = userInsert.checklogin(emailid, encryptedpwd);

                        this.Session["currentuser"] = dt2;

                        return(true);
                    }
                    catch (Exception exp)
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        protected void txt_emailid_TextChanged(object sender, EventArgs e)
        {
            string emailid   = txt_emailid.Text;
            bool   ismatched = System.Text.RegularExpressions.Regex.IsMatch(emailid, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");

            if (ismatched)
            {
                try
                {
                    IUser checkuser = new UserItems();

                    //returns the table if given emailid exists
                    dt = checkuser.checkavailability(emailid);
                    if (dt != null)
                    {
                        imgEmail.ImageUrl        = "~/images/unavailable.png";
                        imgEmail.Visible         = true;
                        lbl_checkemail.Text      = HardCodedValues.BuddaResource.EmailIdExist;
                        lbl_checkemail.ForeColor = System.Drawing.Color.Red;
                        txt_emailid.Focus();
                    }
                    else
                    {
                        imgEmail.ImageUrl        = "~/images/tick.png";
                        imgEmail.Visible         = true;
                        lbl_checkemail.Text      = HardCodedValues.BuddaResource.EmailIdAvailable;
                        lbl_checkemail.ForeColor = System.Drawing.Color.Green;
                    }
                }
                catch (Exception ex)
                {
                    lbl_checkemail.Text = HardCodedValues.BuddaResource.CatchBlockError + ex.Message;
                }
            }
            else
            {
                imgEmail.ImageUrl        = "~/images/unavailable.png";
                imgEmail.Visible         = true;
                lbl_checkemail.Text      = HardCodedValues.BuddaResource.EmailFormatError;
                lbl_checkemail.ForeColor = System.Drawing.Color.Red;
                txt_emailid.Focus();
            }
        }
예제 #5
0
        private void retrieveUser(string emailid)
        {
            try
            {
                IUser retrieveuser = new UserItems();

                //returns the table if given emailid exists
                DataTable dt = retrieveuser.checkavailability(emailid);
                if (dt != null)
                {
                    txt_emailid.Text = dt.Rows[0]["Email"].ToString();
                    txt_uname.Text   = dt.Rows[0]["UserName"].ToString();
                    txt_phno.Text    = dt.Rows[0]["Phone"].ToString();
                    txt_address.Text = dt.Rows[0]["Address"].ToString();
                }
            }
            catch (Exception ex)
            {
                lbl_status.Text = HardCodedValues.BuddaResource.CatchBlockError + ex.Message;
            }
        }
예제 #6
0
        protected void retrieveUser(string emailid)
        {
            try
            {
                IUser retrieveuser = new UserItems();

                //returns the table if given emailid exists
                dt = retrieveuser.checkavailability(emailid);
                if (dt != null)
                {
                    txt_emailid.Text = dt.Rows[0]["Email"].ToString();
                    txt_uname.Text   = dt.Rows[0]["UserName"].ToString();
                    txt_phno.Text    = dt.Rows[0]["Phone"].ToString();
                    txt_address.Text = dt.Rows[0]["Address"].ToString();
                }
            }
            catch (Exception ex)
            {
                lbl_status.Text = "Error Occured : " + ex.Message;
            }
        }