private static void InsertFakeData(IRepository repository) { var buildingRecord = new BuildingRecord { Name = "10e avenue" }; repository.Building.Save(buildingRecord); var door5545 = new DoorRecord { BuildingID = buildingRecord.BuildingID, Address = "5545, 10e avenue, Montréal, H1Y 2G9" }; repository.Door.Save(door5545); var thomasMorel = new TenantRecord() { DoorID = door5545.DoorID, FirstName = "Thomas", LastName = "Morel" }; repository.Tenant.Save(thomasMorel); var tenantInteractionRecord = new TenantInteractionRecord() { AsOfDate = DateTime.Today, Comment = "Remise de son releve 31", TenantID = thomasMorel.TenantID }; repository.TenantInteraction.Save(tenantInteractionRecord); }
/* Returns the requested door from the map, or null. */ public DoorRecord GetDoor(Cell c, int doorId) { DoorRecord ret = null; if (interior) { ret = Session.session.world.GetBuildingDoor(c.id, c.name, doorId); if (ret == null) { MonoBehaviour.print("Couldn't find interior door " + doorId + " in " + c.name); } } else { foreach (DoorRecord dr in c.doors) { if (dr.id == doorId) { return(dr); } } MonoBehaviour.print("Couldn't ext find door " + doorId + " in " + c.name); } return(ret); }
public void Remove(DoorRecord door) { using (IDbCommand session = Helpers.OpenSession()) using (IDbTransaction transaction = session.Connection.BeginTransaction()) { session.Connection.Delete(door); transaction.Commit(); } }
public void Save(DoorRecord Door) { var record = _dao.Save(Door); if (_cache == null) return; lock (_lock) { if (_cache == null) return; LoadData(record, _cache); } }
/* Returns the door matching this id, or null. */ public DoorRecord GetDoor(int doorID) { DoorRecord ret = null; foreach (DoorRecord dr in doors) { if (dr.id == doorID) { ret = dr; break; } } return(ret); }
/* Cloning constructor */ public DoorRecord(DoorRecord dr) { x = dr.x; y = dr.y; building = dr.building; destName = dr.destName; room = dr.room; exterior = dr.exterior; exteriorFacing = dr.exteriorFacing; destId = dr.destId; id = dr.id; }
public void LoadRecord(DoorRecord dr) { if (dr == null) { MonoBehaviour.print("Door Record null"); return; } MonoBehaviour.print("Loaded door data."); building = dr.building; destId = dr.destId; x = dr.x; y = dr.y; exterior = dr.exterior; exteriorFacing = dr.exteriorFacing; linked = dr.linked; }
/* Returns true if this building has exterior doors across multiple cells. */ public bool MultiCell() { if (doors.Count < 2) { return(false); } List <DoorRecord> efDoors = ExteriorFacingDoors(); if (efDoors.Count < 2) { return(false); } DoorRecord dr = efDoors[0]; for (int i = 1; i < efDoors.Count; i++) { if (efDoors[i].x != dr.x || efDoors[i].y != dr.y) { return(true); } } return(false); }
private void LoadData(DoorRecord record, ConcurrentDictionary<int, IDoor> cache) { int doorID = record.DoorID; Lazy<IEnumerable<ITenant>> tenants = new Lazy<IEnumerable<ITenant>>(()=>_tenantRepository.Value.GetAll().Where(_=>_.DoorID == doorID)); cache[record.DoorID] = Mapper.Map(record, new Door(tenants)); }