private void InsertUser()
        {
            if (!ValidaUser()) return;
            try
            {
                var user = new AppUsers
                {
                    UserName = txtUserName.Text,
                    UserDescription = txtUserDescription.Text,
                    ProfileID = Convert.ToInt32(cboProfile.SelectedValue),
                    CreatedBy = FrmPrincipal.UserId,
                    Password = "******",
                    Activated = "Y",
                    CreationDate = DateTime.Now
                };

                _db.InsertUser(user);
            }
            catch (EntityException ex)
            {
                MessageBox.Show(Resources.ERROR_INSERT_USER + ex.Message, Text, MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                cmdSalvar.Enabled = true;
                return;
            }
            _frmUtil.SetMessageError(ref tssStatus, true, "Usuário inserido com sucesso!", AppFormUtil.StatusForm.Success);
            GetAllUsers();
        }
Esempio n. 2
0
 //Limpar as Propriedades
 public void ClearPropertys()
 {
     User = null;
     InitializePropertys();
 }
Esempio n. 3
0
 public void UpdateUser(AppUsers user)
 {
     var passwordCrypted = _fn.GetMd5Hash(user.Password);
     user.Password = passwordCrypted;
     _db.AppUsers.AddOrUpdate(user);
     Commit();
 }
Esempio n. 4
0
 private void InitializePropertys()
 {
     User = new AppUsers();
     if (!_db.AppUsers.Any())
     {
         _db.Database.ExecuteSqlCommand("dbo.InitializeDatabase");
     }
 }
Esempio n. 5
0
 public void InsertUser(AppUsers user)
 {
     var passwordCrypted = _fn.GetMd5Hash(user.Password);
     user.Password = passwordCrypted;
     _db.AppUsers.Add(user);
     Commit();
 }