public void MarkDeliveryAsCollected(long deliveryId) { using (var ctx = new PostRoomDataContext()) { var delivery = ctx.Deliveries.Find(deliveryId); delivery.CollectionDate = DateTime.UtcNow; ctx.SaveChanges(); NotifyCollectionFromApartment(delivery.ApartmentId); } }
internal int GetTotalOutstandingPackagesForApartment(long apartmentId) { using (var ctx = new PostRoomDataContext()) { var package = (from d in ctx.Deliveries join a in ctx.Apartments on d.ApartmentId equals a.ApartmentId where a.ApartmentId == apartmentId && d.CollectionDate.HasValue == false select d).Count(); return(package); } }
public List <Delivery> GetItemsForCollection(long apartmentId) { using (var ctx = new PostRoomDataContext()) { var deliveries = (from d in ctx.Deliveries join a in ctx.Apartments on d.ApartmentId equals a.ApartmentId where a.ApartmentId == apartmentId && d.CollectionDate.HasValue == false select d); return(deliveries.ToList()); } }
public void RecordDelivery(long apartmentId, string recipient) { using (var ctx = new PostRoomDataContext()) { ctx.Deliveries.Add(new Delivery() { ApartmentId = apartmentId, Recipient = recipient, DeliveryDate = DateTime.UtcNow }); ctx.SaveChanges(); NotifyDeliveryToApartment(apartmentId); } }
public void MarkAllDeliveriesAsCollected(long apartmentId) { using (var ctx = new PostRoomDataContext()) { var deliveries = (from d in ctx.Deliveries join a in ctx.Apartments on d.ApartmentId equals a.ApartmentId where a.ApartmentId == apartmentId select d); foreach (var delivery in deliveries) { delivery.CollectionDate = DateTime.UtcNow; } ctx.SaveChanges(); } }
public List <Apartment> SearchApartments(string search) { using (var ctx = new PostRoomDataContext()) { var matchingApartments = ctx.Apartments.Where(a => a.FriendlyName.Contains(search)).ToList(); List <Apartment> results = new List <Apartment>(); foreach (var apartment in matchingApartments) { results.Add(new Apartment() { ApartmentId = apartment.ApartmentId, FriendlyName = apartment.FriendlyName }); } return(results); } }
public PropertyManager() { context = new PostRoomDataContext(); }
public ResidentManager() { context = new PostRoomDataContext(); }