private MailAddressDto AddRecordToAddressesTable(int mailboxId, string addressName, DateTime addressCreatedDate,
            int domainId, string domainName, bool isMailGroup, bool isAlias, bool isVerified, DbManager db = null)
        {
            if (string.IsNullOrEmpty(addressName))
                throw new ArgumentNullException("addressName");

            if (domainId < 0)
                throw new ArgumentException("Argument domain_id less then zero.", "domainId");

            if (string.IsNullOrEmpty(domainName))
                throw new ArgumentNullException("domainName");

            var insertValuesQuery = new SqlInsert(AddressTable.Name)
                .InColumnValue(AddressTable.Columns.Id, 0)
                .InColumnValue(AddressTable.Columns.Tenant, tenant)
                .InColumnValue(AddressTable.Columns.AddressName, addressName)
                .InColumnValue(AddressTable.Columns.DomainId, domainId)
                .InColumnValue(AddressTable.Columns.MailboxId, mailboxId)
                .InColumnValue(AddressTable.Columns.IsMailGroup, isMailGroup)
                .InColumnValue(AddressTable.Columns.IsAlias, isAlias)
                .InColumnValue(AddressTable.Columns.DateCreated, addressCreatedDate)
                .Identity(0, 0, true);

            var addedAddressId = NullSafeExecuteScalar<int>(db, insertValuesQuery);

            var resultDto = new MailAddressDto(addedAddressId, tenant, addressName, domainId, mailboxId,
                                                isMailGroup, isAlias,
                                                new WebDomainDto(domainId, domainName, tenant, isVerified));

            return resultDto;
        }
Beispiel #2
0
 internal MailGroupDto(int id, int tenant, int addressId, MailAddressDto address, List <MailAddressDto> addresses)
 {
     this.id        = id;
     id_tenant      = tenant;
     id_address     = addressId;
     this.address   = address;
     this.addresses = addresses;
 }
Beispiel #3
0
        private MailAddressDto AddRecordToAddressesTable(int mailbox_id, string address_name, DateTime address_created_date,
                                                         int domain_id, string domain_name, bool is_mail_group, bool is_alias, bool is_verified, DbManager db = null)
        {
            if (string.IsNullOrEmpty(address_name))
            {
                throw new ArgumentNullException("address_name");
            }

            if (domain_id < 0)
            {
                throw new ArgumentException("Argument domain_id less then zero.", "domain_id");
            }

            if (string.IsNullOrEmpty(domain_name))
            {
                throw new ArgumentNullException("domain_name");
            }

            var insert_values_query = new SqlInsert(AddressTable.name)
                                      .InColumnValue(AddressTable.Columns.id, 0)
                                      .InColumnValue(AddressTable.Columns.tenant, tenant_id)
                                      .InColumnValue(AddressTable.Columns.name, address_name)
                                      .InColumnValue(AddressTable.Columns.id_domain, domain_id)
                                      .InColumnValue(AddressTable.Columns.id_mailbox, mailbox_id)
                                      .InColumnValue(AddressTable.Columns.is_mail_group, is_mail_group)
                                      .InColumnValue(AddressTable.Columns.is_alias, is_alias)
                                      .InColumnValue(AddressTable.Columns.date_created, address_created_date)
                                      .Identity(0, 0, true);

            var added_address_id = NullSafeExecuteScalar <int>(db, insert_values_query);

            var result_dto = new MailAddressDto(added_address_id, tenant_id, address_name, domain_id, mailbox_id,
                                                is_mail_group, is_alias,
                                                new WebDomainDto(domain_id, domain_name, tenant_id, is_verified));

            return(result_dto);
        }
Beispiel #4
0
 internal MailboxWithAddressDto(MailboxDto mailbox, MailAddressDto mailboxAddress)
 {
     this.mailbox    = mailbox;
     mailbox_address = mailboxAddress;
 }
        private MailAddressDto AddRecordToAddressesTable(int mailboxId, string addressName, DateTime addressCreatedDate,
            int domainId, string domainName, bool isMailGroup, bool isAlias, bool isVerified, DbManager db = null)
        {
            if (string.IsNullOrEmpty(addressName))
                throw new ArgumentNullException("addressName");

            if (domainId < 0)
                throw new ArgumentException("Argument domain_id less then zero.", "domainId");

            if (string.IsNullOrEmpty(domainName))
                throw new ArgumentNullException("domainName");

            var insertValuesQuery = new SqlInsert(AddressTable.name)
                .InColumnValue(AddressTable.Columns.id, 0)
                .InColumnValue(AddressTable.Columns.tenant, tenant)
                .InColumnValue(AddressTable.Columns.name, addressName)
                .InColumnValue(AddressTable.Columns.id_domain, domainId)
                .InColumnValue(AddressTable.Columns.id_mailbox, mailboxId)
                .InColumnValue(AddressTable.Columns.is_mail_group, isMailGroup)
                .InColumnValue(AddressTable.Columns.is_alias, isAlias)
                .InColumnValue(AddressTable.Columns.date_created, addressCreatedDate)
                .Identity(0, 0, true);

            var addedAddressId = NullSafeExecuteScalar<int>(db, insertValuesQuery);

            var resultDto = new MailAddressDto(addedAddressId, tenant, addressName, domainId, mailboxId,
                                                isMailGroup, isAlias,
                                                new WebDomainDto(domainId, domainName, tenant, isVerified));

            return resultDto;
        }
Beispiel #6
0
 internal MailboxWithAddressDto(MailboxDto mailbox, MailAddressDto mailboxAddress)
 {
     this.mailbox = mailbox;
     mailbox_address = mailboxAddress;
 }
Beispiel #7
0
 internal MailGroupDto(int id, int tenant, int addressId, MailAddressDto address, List<MailAddressDto> addresses)
 {
     this.id = id;
     id_tenant = tenant;
     id_address = addressId;
     this.address = address;
     this.addresses = addresses;
 }