internal static BL.DomainModel.User AdaptUser(User u, BL.DomainModel.Customer customer)
        {
            if (u == null)
            {
                return(null);
            }
            BL.DomainModel.User user = new BL.DomainModel.User()
            {
                UserId   = u.UserId,
                UserName = u.Username,
                Password = u.Password,
                Version  = AdapterBase.GetVersionAsUlong(u.Version),
                Roles    = AdaptRoles(u.UserInRoles)
            };
            if (customer == null && u.Customer != null)
            {
                user.Customer = CustomerAdapter.AdaptCustomer(u.Customer, user);
            }
            else if (customer != null)
            {
                user.Customer = customer;
            }

            return(user);
        }
示例#2
0
 internal static BL.DomainModel.Order AdaptOrder(Order o, BL.DomainModel.Customer c)
 {
     BL.DomainModel.Order order = new BL.DomainModel.Order()
     {
         OrderId     = o.OrderId,
         OrderStatus = (OrderStatus)o.OrderStatus,
         OrderDate   = o.OrderDate,
         ShippedDate = o.ShippedDate,
         Version     = o.Version.ToUlong(),
         Customer    = c ?? CustomerAdapter.AdaptCustomer(o.Customer)
     };
     order.OrderDetails = AdaptOrderDetails(o.OrderDetails, order);
     return(order);
 }