예제 #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);
        }
예제 #2
0
        private MessageTypes.User ConvertToExternalType(Business.Entities.User user)
        {
            if (user == null)
            {
                return(null);
            }

            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);
        }