예제 #1
1
        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);
        }
예제 #2
0
파일: HoloDeck.cs 프로젝트: justi1jc/FPS
    /* 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);
    }
예제 #3
0
 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);
     }
 }
예제 #5
0
    /* 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);
    }
예제 #6
0
    /* 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;
    }
예제 #7
0
 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;
 }
예제 #8
0
    /* 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));
        }