public static PostfixMailAddressDto ToAddressDto(this object[] dbRecord)
        {
            if (dbRecord.Length != MAIL_ADDRESS_COLUMNS_COUNT) throw new ArgumentException("Can't convert to PostfixMailAddress invalid column num");

            var newAddress = new PostfixMailAddressDto(
                dbRecord[(int)AddressTableColumnsOrder.Address].ToString(),
                dbRecord[(int)AddressTableColumnsOrder.Redirect].ToString(),
                dbRecord[(int)AddressTableColumnsOrder.DomainName].ToString(),
                Convert.ToBoolean(dbRecord[(int)AddressTableColumnsOrder.Actove])
           );

            if (newAddress.redirect.Contains(","))
                throw new InvalidCastException(String.Format("This value can't be converted to MailAddress: {0}", newAddress.redirect));

            return newAddress;
        }
        public static PostfixMailgroupDto ToMailgroupDto(this object[] dbRecord)
        {
            if (dbRecord.Length != MAIL_ADDRESS_COLUMNS_COUNT + DOMAIN_COLUMNS_COUNT) throw new ArgumentException("Can't convert to PostfixMailbox invalid column num");

            var add = new PostfixMailAddressDto(
                dbRecord[(int) AddressTableColumnsOrder.Address].ToString(),
                dbRecord[(int) AddressTableColumnsOrder.Redirect].ToString(),
                dbRecord[(int) AddressTableColumnsOrder.DomainName].ToString(),
                Convert.ToBoolean(dbRecord[(int) AddressTableColumnsOrder.Actove])
                ) {Domain = dbRecord.SubArray(MAIL_ADDRESS_COLUMNS_COUNT, DOMAIN_COLUMNS_COUNT).ToWebDomainDto()};

            return new PostfixMailgroupDto(add);
        }
Example #3
0
 internal PostfixMailgroupDto(PostfixMailAddressDto address)
 {
     this.address = address;
 }