Пример #1
0
 private UserBasicInfoModel Create(OrganizationRoleUserEntity entity, AddressEntity address)
 {
     //TODO: Default role filtering is not great, so there is hack for now.
     return(new UserBasicInfoModel
     {
         Id = entity.UserId,
         OrganizationRoleUserId = entity.OrganizationRoleUserId,
         OrganizationName =
             entity.RoleId == entity.User.DefaultRoleId
                            ? entity.Organization.Name
                            : "not default",
         Email = string.IsNullOrEmpty(entity.User.Email1)
                                ? null
                                : new Email(entity.User.Email1).ToString(),
         Name =
             new Name(entity.User.FirstName, entity.User.MiddleName,
                      entity.User.LastName).ToString(),
         Phone = GetPhoneNumber(entity),
         Address = _addressFactory.CreateAddressDomain(address).ToString(),
         DefaultRoleDisplayName =
             entity.RoleId == entity.User.DefaultRoleId
                            ? entity.Role.Name
                            : ("Has:" + entity.Role.Name),
         IsActive = entity.User.IsActive
     });
 }
Пример #2
0
        protected override void MapDomainFields(ShippingDetailEntity entity,
                                                ShippingDetail domainObjectToMapTo)
        {
            DataRecorderMetaData dataRecorderMetaData = _dataRecorderMetaDataFactory.
                                                        CreateDataRecorderMetaData(entity.OrganizationRoleUserCreatorId, entity.DateCreated, entity.ModifiedBy, entity.DateModified);

            domainObjectToMapTo.Id = entity.ShippingDetailId;

            domainObjectToMapTo.DataRecorderMetaData = dataRecorderMetaData;

            domainObjectToMapTo.ShipmentDate = entity.ShipmentDate;


            domainObjectToMapTo.ShippingOption = entity.ShippingOption != null
                                                     ? _shippingOptionMapper.Map(entity.ShippingOption)
                                                     : new ShippingOption(entity.ShippingOptionId);

            domainObjectToMapTo.ShippingAddress = entity.Address != null
                ? _addressFactory.CreateAddressDomain(entity.Address) : new Address(entity.ShippingAddressId);

            domainObjectToMapTo.Status = (ShipmentStatus)entity.Status;

            domainObjectToMapTo.ActualPrice            = entity.ActualPrice;
            domainObjectToMapTo.IsExclusivelyRequested = entity.IsExclusivelyRequested;
            domainObjectToMapTo.ShippedByOrgRoleUserId = entity.ShippedByOrgRoleUserId;
        }