private bool FillEntity() { this.User = new Users { AppId = UserRepo.GetAppId(), UserType = this.cboUserType.Text, FullName = this.txtUserName.Text, Password = this.txtPassword.Text }; this.Login = new Logins { AppId = LoginRepo.GetAppId(), Password = this.txtPassword.Text, UserId = this.User.AppId }; this.Emp = new Employee { AppId = EmployeeRepo.GetAppId(), FullName = this.User.FullName, Email = null, Gender = null, Address = null, BirthDate = null, PhoneNumber = null, JoinDate = null, Salary = "", UserId = this.User.AppId }; UserValidation validator = new UserValidation(); ValidationResult results = validator.Validate(this.User); IList <ValidationFailure> failures = results.Errors; if (!(results.IsValid)) { foreach (ValidationFailure failure in failures) { MessageBox.Show(failure.ErrorMessage, "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } return(true); }