public SuiteUsers(Guid userId, string applicationName, string userName, string password, string email, string nome, string cognome) { if (userId == Guid.Empty) { throw new Exception("UserId Obbligatorio!"); } if (String.IsNullOrEmpty(userName) || String.IsNullOrWhiteSpace(userName)) { throw new ArgumentException(DomainExceptions.UserNameNullException, "userName"); } if (String.IsNullOrEmpty(password) || String.IsNullOrWhiteSpace(password)) { throw new ArgumentException(DomainExceptions.PasswordNullException, "password"); } if (String.IsNullOrEmpty(nome) || String.IsNullOrWhiteSpace(nome)) { throw new ArgumentException(DomainExceptions.NomeNullException, "nome"); } if (String.IsNullOrEmpty(cognome) || String.IsNullOrWhiteSpace(cognome)) { throw new ArgumentException(DomainExceptions.CognomeNullException, "cognome"); } if (String.IsNullOrEmpty(email) || String.IsNullOrWhiteSpace(email)) { throw new ArgumentException(DomainExceptions.EmailNullException, "email"); } if (!DomainValidationRules.ValidateEmail(email)) { throw new ArgumentException(DomainExceptions.EmailWrongFormat, "email"); } this.RaiseEvent(new SuiteUserCreated(userId, applicationName, userName, password, email, nome, cognome)); }
private static void ChkDataIntegrity(DtoSuiteUsers entityToChk) { if (String.IsNullOrEmpty(entityToChk.Email) || String.IsNullOrWhiteSpace(entityToChk.Email)) { throw new ArgumentException(DomainExceptions.EmailNullException, "entityToChk"); } if (String.IsNullOrEmpty(entityToChk.Nome) || String.IsNullOrWhiteSpace(entityToChk.Nome)) { throw new ArgumentException(DomainExceptions.NomeNullException, "entityToChk"); } if (String.IsNullOrEmpty(entityToChk.Cognome) || String.IsNullOrWhiteSpace(entityToChk.Cognome)) { throw new ArgumentException(DomainExceptions.CognomeNullException, "entityToChk"); } if (!DomainValidationRules.ValidateEmail(entityToChk.Email)) { throw new ArgumentException(DomainExceptions.EmailWrongFormat, "entityToChk"); } }
public void UpdateSuiteUser(string email, string nome, string cognome) { if (String.IsNullOrEmpty(email) || String.IsNullOrWhiteSpace(email)) { throw new ArgumentException(DomainExceptions.EmailNullException, "email"); } if (String.IsNullOrEmpty(nome) || String.IsNullOrWhiteSpace(nome)) { throw new ArgumentException(DomainExceptions.NomeNullException, "nome"); } if (String.IsNullOrEmpty(cognome) || String.IsNullOrWhiteSpace(cognome)) { throw new ArgumentException(DomainExceptions.CognomeNullException, "cognome"); } if (!DomainValidationRules.ValidateEmail(email)) { throw new ArgumentException(DomainExceptions.EmailWrongFormat, "email"); } this.RaiseEvent(new SuiteUserUpdated(this.Id, email, nome, cognome)); }