using System;
using System.Collections.Generic;
using System.Text;

namespace EnterpriseDesktop.Contacts.Translator
{
    public class TranslateBetweenContactRowAndContact
    {
        public Contacts.BusinessLayer.Contact TranslateContactRowToContact(Contacts.DataLayer.ContactDataSet.ContactRow from)
        {
            Contacts.BusinessLayer.Contact to = new EnterpriseDesktop.Contacts.BusinessLayer.Contact();
            if (from.IsNull("FirstName"))
            {
                to.FirstName = String.Empty;
            }
            else
            {
                to.FirstName = from.FirstName;    
            }

            if (from.IsNull("LastName"))
            {
                to.LastName = String.Empty;
            }
            else
            {
                to.LastName = from.LastName;
            }

            if (from.IsEmailAddressNull())
            {
                to.Email = String.Empty;
            }
            else
            {
                to.Email = from.EmailAddress;
            }
            return to;
        }
    }
}
