예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var db = new BetaDB();

            //if (Request.QueryString["Id"] == null && Session["email"] == null)
            //{
            //    ErrorMessage.Visible = true;
            //    ltMessage.Text = "Broken Link !";
            //    lblMessagedesc.Text = "Varify link has Experied or Invalid. Please click here to activate account";
            //}
            if (!IsPostBack)
            {
                try
                {
                    {
                        if (Request.QueryString["Id"] != null)
                        {
                            var uniqueId = Guid.Parse(Request.QueryString["Id"]);
                            var Isvalid  = db.GUIDs.Where(x => x.UniqueId.Equals(uniqueId)).SingleOrDefault();

                            if (Isvalid != null && Isvalid.Purpose == "Reset")
                            {
                                ResetPassword.Visible  = true;
                                ChangePassword.Visible = false;
                            }
                            else
                            {
                                ErrorMessage.Visible = true;
                                ltMessage.Text       = "Broken Link !";
                                lblMessagedesc.Text  = "Varify link has Experied or Invalid. Please click here to activate account";
                            }
                        }
                        else if (Session["email"] != null)
                        {
                            ResetPassword.Visible  = false;
                            ChangePassword.Visible = true;
                        }
                        else
                        {
                            ErrorMessage.Visible = true;
                            ltMessage.Text       = "Broken Link !";
                            lblMessagedesc.Text  = "Varify link has Experied or Invalid";
                        }
                    }
                }
                catch
                {
                    return;
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // string retpur = IsGuidValid("");

            //if(retpur!=null)
            // {

            // }
            // else
            // {

            // }

            if (!IsPostBack)
            {
                try
                {
                    var db = new BetaDB();

                    var uniqueId = Guid.Parse(Request.QueryString["Id"]);
                    var IsValid  = db.GUIDs.Where(x => x.UniqueId.Equals(uniqueId)).FirstOrDefault();

                    if (IsValid != null && IsValid.Purpose == "Activation")
                    {
                        Login lg = db.Logins.Find(IsValid.UserId);
                        lg.IsActive        = true;
                        db.Entry(lg).State = System.Data.Entity.EntityState.Modified;
                        var deleteGUID = db.GUIDs.SingleOrDefault(x => x.UniqueId.Equals(IsValid.UniqueId));
                        db.Entry(deleteGUID).State = System.Data.Entity.EntityState.Deleted;
                        db.SaveChanges();
                        AccountActivation.Visible = true;
                        ltMessage.Text            = "Account Activated Successfully!";
                    }
                    else
                    {
                        AccountActivation.Visible = true;
                        ltMessage.Text            = "Broken Link !";
                        lblMessagedesc.Text       = "Varify link has Experied or Invalid. Please click here to activate account";
                    }
                }
                catch
                {
                    return;
                }
            }
        }
예제 #3
0
        // In page load check for valid activation code and deleting it on successful activation
        public String IsGuidValid(string guid)
        {
            var db = new BetaDB();

            var uniqueId = Guid.Parse(Request.QueryString["Id"]);
            var IsValid  = db.GUIDs.Where(x => x.UniqueId.Equals(uniqueId)).FirstOrDefault();

            if (IsValid == null)
            {
                return(null);
            }
            else
            {
                var result = IsValid.Purpose;
                return(result);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var db = new BetaDB();

            if (!IsPostBack)
            {
                try
                {
                    string guid = Page.RouteData.Values["guid"].ToString();
                    if (guid != null)
                    {
                        var uniqueId = Guid.Parse(guid);
                        var Isvalid  = db.GUIDs.Where(x => x.UniqueId.Equals(uniqueId)).SingleOrDefault();

                        if (Isvalid != null && Isvalid.Purpose == "Reset")
                        {
                            ResetPassword.Visible  = true;
                            ChangePassword.Visible = false;
                        }
                        else
                        {
                            ErrorMessage.Visible = true;
                            ltMessage.Text       = "Broken Link !";
                            lblMessagedesc.Text  = "Varify link has Experied or Invalid. Please click here to activate account";
                        }
                        return;
                    }
                }
                catch {}
            }

            if (Session["email"] != null)
            {
                ResetPassword.Visible  = false;
                ChangePassword.Visible = true;
            }
            else
            {
                ErrorMessage.Visible = true;
                ltMessage.Text       = "Broken Link !";
                lblMessagedesc.Text  = "Varify link has Experied or Invalid";
            }
        }