You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.7 KiB
C#

using System.Collections.Generic;
using Common.Library.CustomObjects;
using System.Linq;
namespace Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC
{
public class CompanyInfoDTO
{
public string CompanyName { get; set; }
public string PhoneNumber { get; set; }
public string EmailAddress { get; set; }
public string Address { get; set; }
public string CompanySlogan { get; set; }
public PhoneNumberContainer FormattedPhoneNumber
{
get
{
List<string> phoneNumber = PhoneNumber.Split(" ").Select(val => val.Trim()).ToList<string>();
return new PhoneNumberContainer { AreaCode = phoneNumber[0], PhoneNumber = phoneNumber[1] };
}
}
public AddressContainer FormattedAddress
{
get
{
List<string> address = Address.Split(",").Select(val => val.Trim()).ToList<string>();
string houseNumber = address[0].Substring(0, address[0].IndexOf(" ")).Trim();
string streetName = address[0].Substring(address[0].IndexOf(" ")).Trim();
string city = address[1].Trim();
string state = address[2].Substring(0, address[2].IndexOf(" ")).Trim();
string zip = address[2].Substring(address[2].IndexOf(" ")).Trim();
return new AddressContainer
{
HouseNumber = houseNumber,
StreetName = streetName,
City = city,
State = state,
Zip = zip
};
}
}
}
public class CompanyInfoDTOCollection : List<CompanyInfoDTO> { }
}