public EmailService(IMailboxConfiguration mailboxConfiguration, IEmailProvider emailProvider, ISmsService smsService, IMobileNumberValidator mobileNumberValidator, IBusinessHoursService businessHoursService) { Check.If(mailboxConfiguration).IsNotNull(); Check.If(emailProvider).IsNotNull(); Check.If(smsService).IsNotNull(); Check.If(mobileNumberValidator).IsNotNull(); Check.If(businessHoursService).IsNotNull(); _mailboxConfiguration = mailboxConfiguration; _emailProvider = emailProvider; _smsService = smsService; _mobileNumberValidator = mobileNumberValidator; _businessHoursService = businessHoursService; }
public EmailService(IMailboxConfiguration mailboxConfiguration, IForwardService forwardService, IEmailProvider emailProvider, IEmailRepository emailRepository, IReferenceGenerator referenceGenerator, IEmailServiceSettings emailServiceSettings) { Check.If(mailboxConfiguration).IsNotNull(); Check.If(forwardService).IsNotNull(); Check.If(emailProvider).IsNotNull(); Check.If(emailRepository).IsNotNull(); Check.If(referenceGenerator).IsNotNull(); Check.If(emailServiceSettings).IsNotNull(); _mailboxConfiguration = mailboxConfiguration; _forwardService = forwardService; _emailProvider = emailProvider; _emailRepository = emailRepository; _referenceGenerator = referenceGenerator; _emailServiceSettings = emailServiceSettings; }
public AutoResponderService(IMailboxConfiguration mailboxConfiguration, IEmailProvider emailProvider, IResponseRepository responseRepository, ITemplateRepository templateRepository, IReferenceGenerator referenceGenerator, IAutoResponseServiceSettings autoResponseServiceSettings) { Check.If(mailboxConfiguration).IsNotNull(); Check.If(emailProvider).IsNotNull(); Check.If(responseRepository).IsNotNull(); Check.If(templateRepository).IsNotNull(); Check.If(referenceGenerator).IsNotNull(); Check.If(autoResponseServiceSettings).IsNotNull(); _mailboxConfiguration = mailboxConfiguration; _emailProvider = emailProvider; _responseRepository = responseRepository; _templateRepository = templateRepository; _referenceGenerator = referenceGenerator; _autoResponseServiceSettings = autoResponseServiceSettings; }
public MailboxInfo(Guid mailboxGuid, ADObjectId databaseId, IGenericADUser adUser, IMailboxConfiguration mailboxConfiguration, IMailboxLocation mailboxLocation) { ArgumentValidator.ThrowIfEmpty("mailboxGuid", mailboxGuid); ArgumentValidator.ThrowIfNull("adUser", adUser); ArgumentValidator.ThrowIfNull("mailboxConfiguration", mailboxConfiguration); ArgumentValidator.ThrowIfNull("mailboxLocation", mailboxLocation); MailboxLocationType?mailboxLocationType = adUser.GetMailboxLocationType(mailboxGuid); if (mailboxLocationType == null) { throw new ArgumentException("The provided mailbox guid doesn't match with any of the user's mailbox."); } this.MailboxType = mailboxLocationType.Value; this.DisplayName = adUser.DisplayName; this.PrimarySmtpAddress = adUser.PrimarySmtpAddress; this.ExternalEmailAddress = adUser.ExternalEmailAddress; this.EmailAddresses = (adUser.EmailAddresses ?? Array <ProxyAddress> .Empty); this.OrganizationId = adUser.OrganizationId; this.MailboxGuid = mailboxGuid; this.MailboxDatabase = databaseId; if (this.IsArchive) { this.archiveName = ((adUser.ArchiveName != null) ? (adUser.ArchiveName.FirstOrDefault <string>() ?? string.Empty) : string.Empty); this.archiveState = adUser.ArchiveState; this.archiveStatus = adUser.ArchiveStatus; this.IsRemote = adUser.IsArchiveMailboxRemote(); } else { this.IsRemote = adUser.IsPrimaryMailboxRemote(); } if (this.IsRemote) { this.remoteIdentity = this.GetRemoteIdentity(adUser, this.IsArchive); } else if (this.MailboxDatabase.IsNullOrEmpty()) { throw new ObjectNotFoundException(ServerStrings.MailboxDatabaseRequired(mailboxGuid)); } this.WhenMailboxCreated = adUser.WhenMailboxCreated; this.Location = mailboxLocation; this.Configuration = mailboxConfiguration; }
private IMailboxInfo BuildMailboxInfo(Guid mailboxGuid, ADObjectId mailboxDatabase, bool isSelected, ADObjectId selectedMailboxDatabase, IMailboxLocation selectedMailboxLocation, IGenericADUser adUser, IMailboxConfiguration configuration, Func <ADObjectId, IMailboxLocation> locationFactory) { ADObjectId adobjectId = mailboxDatabase; IMailboxLocation mailboxLocation = null; if (isSelected) { if (!selectedMailboxDatabase.IsNullOrEmpty()) { adobjectId = selectedMailboxDatabase; } mailboxLocation = selectedMailboxLocation; } try { return(new MailboxInfo(mailboxGuid, adobjectId, adUser, configuration, mailboxLocation ?? locationFactory(adobjectId))); } catch (ObjectNotFoundException) { } return(null); }