private static void ValidateDictToCount(int count) { Debug.Assert(dealVariantService.GetAll().Count() == count); Debug.Assert(districtService.GetAll().Count() == count); Debug.Assert(floorLevelService.GetAll().Count() == count); Debug.Assert(layoutService.GetAll().Count() == count); Debug.Assert(materialService.GetAll().Count() == count); Debug.Assert(ownershipService.GetAll().Count() == count); Debug.Assert(realtorService.GetAll().Count() == count); Debug.Assert(sewageService.GetAll().Count() == count); Debug.Assert(terraceService.GetAll().Count() == count); Debug.Assert(toiletTypeService.GetAll().Count() == count); Debug.Assert(waterSupplyService.GetAll().Count() == count); }
protected override void InitCollection() { Terrace = new ListCollectionView((new[] { NullTerrace }).Concat(_TerraceService.GetAll()).ToList()); Layout = new ListCollectionView((new[] { NullLayout }).Concat(_LayoutService.GetAll()).ToList()); Material = new ListCollectionView((new[] { NullMaterial }).Concat(_MaterialService.GetAll()).ToList()); FloorLevel = new ListCollectionView((new[] { NullFloorLevel }).Concat(_FloorLevelService.GetAll()).ToList()); }
private void SaveUpdateValidate(Area area, ILayoutService ls, ISeatService ss) { var lsAll = ls.GetAll(); var ssAll = ss.GetAll(); var all = GetAll(); if (!(from x in lsAll where x.Id == area.LayoutId select x).Any()) { throw new Exception("No such layout"); } var areaLowerSet = from x in all where x.LayoutId == area.LayoutId && (x.CoordX < area.CoordX || x.CoordY < area.CoordY) select x; if (areaLowerSet.Any()) { foreach (var v in areaLowerSet.ToList()) { var seatSet = from x in ssAll where x.AreaId == v.Id select x; if (seatSet.Any()) { if (v.CoordX + seatSet.Max(x => x.Row) > area.CoordX || v.CoordY + seatSet.Max(x => x.Number) > area.CoordY) { throw new Exception("Area coords out of range"); } } } } }
public bool Delete(int id, IEventSeatService ess, IEventAreaService eas, ILayoutService ls) { var all = GetAll(); var esAll = ess.GetAll(); var eaAll = eas.GetAll(); var lsAll = ls.GetAll(); if ((from venue in all join layout in lsAll on venue.Id equals layout.VenueId join eventArea in eaAll on layout.Id equals eventArea.LayoutId join eventSeat in esAll on eventArea.Id equals eventSeat.EventAreaId where eventSeat.State != 0 select venue ).Any()) { throw new Exception("Try to delete venue with locked seats"); } return(Repository.Delete(id)); }