private static void CheckIfExistUser(UserModel model, SmartCRMEntitiesModel db, CheckResult result) { UserRepository repository = new UserRepository(); var user = repository.GetUserByModel(db, model); if (user == null) { result.Details.Add( new CheckResultDetail(CheckResultDetail.ErrorType.Error, "NoUser", "The username or password is incorect!")); } }
public bool ShowErrors(CheckResult result) { bool hasErrors = false; var passwordError = result.Details.FirstOrDefault(x => x.PropertyName == StaticReflection.GetMemberName<UserModel>(u => u.Password).ToString()); if (passwordError != null) { this.dxErrorProvider1.SetError(this.txtPassword, passwordError.Message); hasErrors = true; } var usernameError = result.Details.FirstOrDefault(x => x.PropertyName == StaticReflection.GetMemberName<UserModel>(u => u.Username).ToString()); if (usernameError != null) { this.dxErrorProvider1.SetError(this.txtUsername, usernameError.Message); hasErrors = true; } return hasErrors; }
public bool ShowErrors(CheckResult result) { bool hasErrors = false; var firstNameError = result.Details.FirstOrDefault(x => x.PropertyName == StaticReflection.GetMemberName<EmployeeModel>(e => e.FirstName).ToString()); if (firstNameError != null) { this.dxErrorProvider1.SetError(this.txtFirstName, firstNameError.Message); hasErrors = true; } var lastNameError = result.Details.FirstOrDefault(x => x.PropertyName == StaticReflection.GetMemberName<EmployeeModel>(e => e.LastName).ToString()); if (lastNameError != null) { this.dxErrorProvider1.SetError(this.txtLastName, lastNameError.Message); hasErrors = true; } return hasErrors; }