示例#1
0
        public static bool SetLocation(lo.Location location, pdm.Address address)
        {
            var dataAddress = new Address()
            {
                Street = address.Street,
                City   = address.City,
                State  = address.State
            };

            _db.Address.Add(dataAddress);

            var dataLocation = new Location()
            {
                AddressId   = dataAddress.AddressId,
                OrderNumber = location.OrderNumber
            };

            _db.Location.Add(dataLocation);

            var newLocation = _db.Location.Where(a => a.AddressId == dataLocation.AddressId).FirstOrDefault();

            InitLocationInventory(newLocation.LocationId);

            return(_db.SaveChanges() == 3);
        }
示例#2
0
        public static List <lo.Location> GetLocations()
        {
            var du = new List <lo.Location>();

            foreach (var location in _db.Location.ToList())
            {
                var dataAddress = _db.Address.Where(a => a.AddressId == location.AddressId).FirstOrDefault();
                var address     = new pdm.Address(dataAddress.Street, dataAddress.City, dataAddress.State);

                du.Add(new lo.Location(address));
            }

            return(du);
        }
示例#3
0
 public static bool SetLocation(lo.Location location, pdm.Address address)
 {
     return(LocationHelper.SetLocation(location, address));
 }