Пример #1
0
        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[] db_record)
        {
            if (db_record.Length != mail_address_columns_count + domain_columns_count)
            {
                throw new ArgumentException("Can't convert to PostfixMailbox invalid column num");
            }

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

            add.Domain = db_record.SubArray(mail_address_columns_count, domain_columns_count).ToWebDomainDto();

            return(new PostfixMailgroupDto(add));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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);
        }
Пример #5
0
 internal PostfixMailgroupDto(PostfixMailAddressDto address)
 {
     this.address = address;
 }
Пример #6
0
        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);
        }
Пример #7
0
 internal PostfixMailgroupDto(PostfixMailAddressDto address)
 {
     this.address = address;
 }