コード例 #1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            string email = this.txt_user.Text;
            string password = this.txt_pass.Text;

            LoginInteractor login = new LoginInteractor(email, password);

            try
            {
                this.LoggedUser = login.performCheck();
                labelInvalidCredentials.Hide();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (LoginInteractor.InavlidUsernameOrPassword)
            {
                labelInvalidCredentials.Text = "E-mail ou Senha incorreto(s)!";
                labelInvalidCredentials.Show();
            }
            catch(LoginInteractor.UserBlocked)
            {
                labelInvalidCredentials.Text = "Usuário bloqueado";
                labelInvalidCredentials.Show();
            }
        }
コード例 #2
0
 public ConsultUser(string userId)
 {
     InitializeComponent();
     userRepo = RepositoryManager.ManagerInstance.UserRepository();
     this.currentUser = userRepo.FindById(userId);
     persister = new GenericPersister<User>(userRepo, new Validator<User>[] { userValidator }, userCaster);
     userCaster.SetModel(currentUser);
 }
コード例 #3
0
 private void atualizarButtonBlockUn()
 {
     if (usersGridView.SelectedRows.Count > 0)
     {
         selectedUser = (User)usersGridView.SelectedRows[0].DataBoundItem;
         if (selectedUser.CurrentStatus == User.Status.ACTIVE)
         {
             btnBlockUnblock.Text = "Bloquear";
         }
         else
         {
             btnBlockUnblock.Text = "Desbloquear usuário";
         }
     }
 }
コード例 #4
0
        public void seedData()
        {
            if (userRepository.Count() < 1)
            {
                var usr = new User();
                usr.Name = "Administrador";
                usr.Email = "*****@*****.**";
                usr.Password = "******";
                usr.PasswordChangeDate = System.DateTime.Now;
                usr.BirthDate = System.DateTime.Now.Date;
                usr.Profile = Profile.AdminProfile();
                userRepository.Persist(usr);

                usr = new User();
                usr.Name = "Usuario teste";
                usr.Email = "*****@*****.**";
                usr.Password = "******";
                usr.PasswordChangeDate = System.DateTime.Now;
                usr.BirthDate = System.DateTime.Now.Date;
                usr.Profile = Profile.Operator();
                userRepository.Persist(usr);
            }

            //if (productRepository.Count() < 1)
            //{
            //    var prod = new Product();
            //    prod.Name = "Mouse";
            //    prod.Price = 15;
            //    prod.Amount = 10;
            //    productRepository.Persist(prod);

            //    prod = new Product();
            //    prod.Name = "Teclado";
            //    prod.Price = 30;
            //    prod.Amount = 8;
            //    productRepository.Persist(prod);
            //}
        }
コード例 #5
0
 public FormMain(User CurrentUser)
 {
     InitializeComponent();
     this.CurrentUser = CurrentUser;
 }
コード例 #6
0
        public object Clone()
        {
            var copy = new User();

            copy.id = this.id;
            copy.name = this.name;
            copy.email = this.email;
            copy.currentPassword = this.currentPassword;
            copy.password = this.password;
            copy.oldPassword = this.oldPassword;
            copy.passwordChangeDate = this.passwordChangeDate;
            copy.birthDate = this.birthDate;
            copy.currentStatus = this.currentStatus;
            copy.profileId = this.profileId;

            if (this.profile == null)
                copy.profile = null;
            else
                copy.profile = (Profile)this.Profile.Clone();

            return copy;
        }
コード例 #7
0
 private void usersGridView_RowContextMenuStripChanged(object sender, DataGridViewRowEventArgs e)
 {
     selectedUser = (User)usersGridView.SelectedRows[0].DataBoundItem;
     if(selectedUser.CurrentStatus == User.Status.ACTIVE)
     {
         btnBlockUnblock.Text = "Bloquear usuário";
     }
     else
     {
         btnBlockUnblock.Text = "Desbloquear usuário";
     }
 }