protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _dbContext.Dispose();
     }
     base.Dispose(disposing);
 }
Exemple #2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Exemple #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposed && disposing)
     {
         _context.Dispose();
     }
     disposed = true;
 }
Exemple #4
0
 public virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             _context.Dispose();
         }
         this.disposed = true;
     }
 }
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             _dbContext.Dispose();
         }
     }
     //dispose unmanaged resources
     _disposed = true;
 }
Exemple #6
0
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }
            if (disposing)
            {
                _context.Dispose();
            }

            _disposed = true;
        }
        protected void register_btn_Click(object sender, EventArgs e)
        {
            RegisterModel registerModel = new RegisterModel
            {
                Name     = txbx_name.Value,
                Surname  = txbx_surname.Value,
                Email    = txbx_email.Value,
                Password = txbx_password.Value
            };

            ValidationContext       validationContext = new ValidationContext(registerModel);
            List <ValidationResult> validationResults = new List <ValidationResult>();

            if (!Validator.TryValidateObject(registerModel, validationContext, validationResults))
            {
                foreach (var result in validationResults)
                {
                    ModelState.AddModelError(result.MemberNames.ToList()[1].ToString(), result.ErrorMessage);
                }
            }
            else
            {
                Person person = new Person
                {
                    Name         = registerModel.Name,
                    Surname      = registerModel.Surname,
                    Email        = registerModel.Email,
                    Password     = registerModel.Password,
                    IsLocked     = false,
                    RegisterDate = DateTime.Now
                };

                UserDbContext u = new UserDbContext();
                u.People.Add(person);
                u.SaveChanges();
                u.Dispose();

                //try
                //{
                //    u.SaveChanges();
                //}
                //catch (DbEntityValidationException message)
                //{
                //    Console.WriteLine(message);
                //}


                Response.Redirect("Login.aspx");
            }
        }
Exemple #8
0
        protected void login_btn_Click(object sender, EventArgs e)
        {
            LoginModel loginModel = new LoginModel
            {
                Email    = txbx_email.Value,
                Password = txbx_password.Value
            };

            ValidationContext       validationContext = new ValidationContext(loginModel);
            List <ValidationResult> validationResults = new List <ValidationResult>();

            if (!Validator.TryValidateObject(loginModel, validationContext, validationResults))
            {
                foreach (var result in validationResults)
                {
                    ModelState.AddModelError(result.MemberNames.ToList()[1].ToString(), result.ErrorMessage);
                }
            }
            else
            {
                Person        person = new Person();
                UserDbContext u      = new UserDbContext();

                person = u.People.Where(p => p.Email == loginModel.Email && p.Password == loginModel.Password).FirstOrDefault();
                u.Dispose();

                if (person?.IsLocked == false)
                {
                    Response.Redirect("~/UsersList.aspx");
                }

                else if (person?.IsLocked == true)
                {
                    ModelState.AddModelError("", "Admin is locked you!");
                }
                else
                {
                    ModelState.AddModelError("", "Email or Password is not valid");
                }
            }
        }
Exemple #9
0
 public void Dispose()
 {
     dbContext.Dispose();
 }
Exemple #10
0
 public void Dispose()
 {
     UserDbContext?.Dispose();
     UserManager?.Dispose();
     RoleManager?.Dispose();
 }
Exemple #11
0
 public void Dispose()
 {
     _appDb?.Dispose();
     _userDb?.Dispose();
     _connection?.Close();
 }
Exemple #12
0
 public void Dispose()
 {
     _context.Dispose();
 }
Exemple #13
0
 public void Dispose()
 {
     dataContext.Dispose();
 }
Exemple #14
0
 public void TearDown()
 {
     _context.Database.EnsureDeleted();
     _context.Dispose();
 }