Exemplo n.º 1
0
        private Business.Entities.User ConvertUserToInternalType(MessageTypes.User user)
        {
            Business.Entities.User lInternal = UserProvider.ReadUserById(user.Id);
            if (lInternal == null)
            {
                lInternal = new Business.Entities.User();
            }


            lInternal.Address  = user.Address;
            lInternal.Email    = user.Email;
            lInternal.Id       = user.Id;
            lInternal.Name     = user.Name;
            lInternal.Revision = user.Revision;

            if (user.LoginCredential != null)
            {
                lInternal.LoginCredential = new Business.Entities.LoginCredential()
                {
                    Id                = user.LoginCredential.Id,
                    UserName          = user.LoginCredential.UserName,
                    EncryptedPassword = user.LoginCredential.EncryptedPassword
                };
            }
            return(lInternal);
        }
Exemplo n.º 2
0
        public bool hasBought(MessageTypes.User user, MessageTypes.Media media)
        {
            var internalType_u = MessageTypeConverter.Instance.Convert <
                BookStore.Services.MessageTypes.User,
                BookStore.Business.Entities.User>(
                user);
            var internalType_m = MessageTypeConverter.Instance.Convert <
                BookStore.Services.MessageTypes.Media,
                BookStore.Business.Entities.Media>(
                media);

            return(PurchaseHistoryProvider.hasBought(internalType_u, internalType_m));
        }
Exemplo n.º 3
0
        public void createHistory(MessageTypes.User user, MessageTypes.Media media)
        {
            var internalType_u = MessageTypeConverter.Instance.Convert <
                BookStore.Services.MessageTypes.User,
                BookStore.Business.Entities.User>(
                user);
            var internalType_m = MessageTypeConverter.Instance.Convert <
                BookStore.Services.MessageTypes.Media,
                BookStore.Business.Entities.Media>(
                media);

            PurchaseHistoryProvider.createHistory(internalType_u, internalType_m);
        }
Exemplo n.º 4
0
        private MessageTypes.User ConvertToExternalType(Business.Entities.User user)
        {
            MessageTypes.User lExternal = new MessageTypes.User()
            {
                Address  = user.Address,
                Email    = user.Email,
                Id       = user.Id,
                Name     = user.Name,
                Revision = user.Revision,
            };

            if (user.LoginCredential != null)
            {
                lExternal.LoginCredential = new MessageTypes.LoginCredential()
                {
                    Id                = user.LoginCredential.Id,
                    UserName          = user.LoginCredential.UserName,
                    EncryptedPassword = user.LoginCredential.EncryptedPassword
                };
            }

            return(lExternal);
        }