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(); } }
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); }
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"; } } }
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); //} }
public FormMain(User CurrentUser) { InitializeComponent(); this.CurrentUser = CurrentUser; }
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; }
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"; } }