public static Entities.Address ToEntity(BusinessObject.Address businessObject)
        {
            if (businessObject == null)
                return null;

            Entities.Address entity = new Entities.Address
            {
                AddressId = businessObject.AddressId,
                PersonId = businessObject.PersonId,
                StreetNumber = businessObject.StreetNumber,
                StreetName = businessObject.StreetName,
                AddressCity = businessObject.AddressCity,
                AddressState = businessObject.AddressState,
                AddressZip = businessObject.AddressZip,
                AddressTypeId = (int)businessObject.AddressType
            };

            return entity;
        }
예제 #2
0
        public static BusinessObject.Address ToBusinessObject(Entities.Address entity)
        {
            if (entity == null)
            {
                return(null);
            }

            BusinessObject.Address businessObject = new BusinessObject.Address
            {
                AddressId    = entity.AddressId,
                PersonId     = entity.PersonId,
                StreetNumber = entity.StreetNumber,
                StreetName   = entity.StreetName,
                AddressCity  = entity.AddressCity,
                AddressState = entity.AddressState,
                AddressZip   = entity.AddressZip,
                AddressType  = (Enumeration.AddressType)entity.AddressTypeId
            };

            return(businessObject);
        }
예제 #3
0
        public static Entities.Address ToEntity(BusinessObject.Address businessObject)
        {
            if (businessObject == null)
            {
                return(null);
            }

            Entities.Address entity = new Entities.Address
            {
                AddressId     = businessObject.AddressId,
                PersonId      = businessObject.PersonId,
                StreetNumber  = businessObject.StreetNumber,
                StreetName    = businessObject.StreetName,
                AddressCity   = businessObject.AddressCity,
                AddressState  = businessObject.AddressState,
                AddressZip    = businessObject.AddressZip,
                AddressTypeId = (int)businessObject.AddressType
            };

            return(entity);
        }
        public static int UpdateByAddressId(Address address)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
              {
              using (UpdateAddressByAddressIdCommand objectCommand = new UpdateAddressByAddressIdCommand(objectConnection))
              {
                  objectCommand.AddressId = address.AddressId;
                  objectCommand.PersonId = address.PersonId;
                  objectCommand.StreetNumber = address.StreetNumber;
                  objectCommand.StreetName = address.StreetName;
                  objectCommand.AddressCity = address.AddressCity;
                  objectCommand.AddressState = address.AddressState;
                  objectCommand.AddressZip = address.AddressZip;
                  objectCommand.AddressTypeId = address.AddressTypeId;

                  objectConnection.Open();
                  objectCommand.ExecuteNonQuery();

                  return objectCommand.ReturnValue;
              }
              }
        }