protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string querystringId = Convert.ToString(Request.QueryString["id"]);
            if (querystringId != null)
            {
                userDataBAL = new UserDataBAL();
                userData    = new UserData();

                string userId = StringCipher.Decrypt(querystringId, "123");

                userData.Id = Convert.ToInt32(userId);
                bool resultUpdate = userDataBAL.updateUserData(userData);

                if (resultUpdate == true)
                {
                    lblMsgtext.Text     = @"Your email id is confirmed in web site. Please <a href=""Login.aspx"" > Login </a> into your account .";
                    lblMsgtext.CssClass = "msgText";
                }
                else
                {
                    lblMsgtext.Text     = "Your email id is confirmed in web site.";
                    lblMsgtext.CssClass = "errorText";
                }
            }
        }
    }
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        userDataBAL        = new UserDataBAL();
        userData           = new UserData();
        userData.FirstName = txtFirstName.Text;
        userData.LastName  = txtLastName.Text;
        userData.Emailid   = txtEmailId.Text;
        userData.Password  = txtPassword.Text;
        userData.PhoneNo   = txtPhoneNumber.Text;

        bool resultExists = userDataBAL.selectExistsUserData(userData);

        if (resultExists == true)
        {
            lblMsgtext.Text     = "Email id is already registered with the website.";
            lblMsgtext.CssClass = "errorText";
        }
        else
        {
            bool result = userDataBAL.insertUserData(userData);

            if (result == true)
            {
                String originalPath    = new Uri(HttpContext.Current.Request.Url.AbsoluteUri).OriginalString;
                String parentDirectory = originalPath.Substring(0, originalPath.LastIndexOf("/"));

                string encryptedId = StringCipher.Encrypt(Convert.ToString(userData.Id), "123");

                string mailLink = parentDirectory + "/CheckUserData.aspx?" + "id=" + encryptedId;

                sendMailFuntion = new SendMailFuntion();
                string mailBody   = "Please click on the link to confirm your registration. <br/> " + mailLink;
                bool   mailResult = sendMailFuntion.SendMail(userData.Emailid, userData.Emailid, "Confirmation Link", mailBody);

                if (mailResult == true)
                {
                    lblMsgtext.Text     = "You are successfully registered in web site. please check your mail.";
                    lblMsgtext.CssClass = "msgText";
                }
                else
                {
                    lblMsgtext.Text     = "You are not successfully registered. Mail Send failure.";
                    lblMsgtext.CssClass = "errorText";
                }
            }
            else
            {
                lblMsgtext.Text     = "You are not successfully registered. please try again.";
                lblMsgtext.CssClass = "errorText";
            }
        }
        clearControls();
    }
Example #3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        userData    = new UserData();
        userDataBAL = new UserDataBAL();

        userData.Emailid  = txtEmailId.Text;
        userData.Password = txtPassword.Text;

        bool result = userDataBAL.selectUserData(userData);

        if (result == true)
        {
            if (userData.Id != 0)
            {
                Session["id"]        = userData.Id;
                Session["firstname"] = userData.FirstName;

                if (chkRememberMe.Checked)
                {
                    Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(30);
                    Response.Cookies["Password"].Expires = DateTime.Now.AddDays(30);
                }
                else
                {
                    Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(-1);
                    Response.Cookies["Password"].Expires = DateTime.Now.AddDays(-1);
                }
                Response.Cookies["UserName"].Value = txtEmailId.Text.Trim();
                Response.Cookies["Password"].Value = txtPassword.Text.Trim();


                Response.Redirect("Default.aspx");
            }
            else
            {
                lblMsgtext.Text     = "Please enter correct Emailid and password";
                lblMsgtext.CssClass = "errorText";
            }
        }
        else
        {
            lblMsgtext.Text     = "Please enter correct Emailid and password ";
            lblMsgtext.CssClass = "errorText";
        }
    }
Example #4
0
 protected DataSet selectAllUserData()
 {
     userDataBAL = new UserDataBAL();
     return(userDataBAL.selectAllUserData());
 }