Пример #1
0
        protected void AddAdmin_Click(object sender, EventArgs e)
        {
            string password      = TxtPassword.Text.ToString();
            string validpassword = password.ValidatePassword();

            if (validpassword == "ok")
            {
                Login login = new Login()
                {
                    Email    = TxtEmail.Text,
                    Password = Helper.HelpUs.Encrypt(password),
                    IsActive = true,
                    UserRole = "Admin"
                };
                db.Logins.Add(login);
                db.SaveChanges();
                lblmessage.ForeColor = System.Drawing.Color.Green;
                lblmessage.Text      = "New Admin Created";
            }
            else
            {
                lblmessage.ForeColor = System.Drawing.Color.Red;
                lblmessage.Text      = "Password Must Contain Uppercase,Lowercase,Character and 8 Digits";
            }
        }
Пример #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
 protected void Submit_Click(object sender, EventArgs e)
 {
     try
     {
         bool newprofile = false;
         var  email      = Session["email"].ToString();
         login = db.Logins.Where(x => x.Email == email).FirstOrDefault();
         Profile profile;
         try
         {
             profile = db.Profiles.Where(x => x.UserId == login.ID).SingleOrDefault();
         }catch (Exception ee)
         {
             profile    = new Profile();
             newprofile = true;
         }
         if (profile == null)
         {
             profile    = new Profile();
             newprofile = true;
         }
         profile.FirstName = txt_Firstname.Text;
         profile.LastName  = txt_Lastname.Text;
         profile.Address   = txt_Address.Text;
         profile.City      = txt_City.Text;
         profile.Country   = txt_Country.Text;
         profile.PinCode   = Convert.ToDecimal(txt_Pincode.Text).ToString();
         profile.State     = txt_State.Text;
         profile.Phone     = Convert.ToDecimal(txt_Phone.Text).ToString();
         profile.Login     = login;
         if (newprofile)
         {
             db.Profiles.Add(profile);
         }
         db.SaveChanges();
         loaddata(id);
     }
     catch (Exception ee) { }
 }