Пример #1
0
 public static SensorAT DuplicateSensor(SensorAT sensorAT, AT at)
 {
     var newSensorAT = new SensorAT();
     newSensorAT.SetName(at.GetName() + "-" + sensorAT.GetName());
     newSensorAT.SetCreationDate(new DateTime());
     newSensorAT.SetDeleted(false);
     newSensorAT.SetKm(sensorAT.GetKm());
     newSensorAT.SetLane(sensorAT.GetLane());
     newSensorAT.SetState(sensorAT.GetState());
     newSensorAT.SetStatus(true);
     newSensorAT.SetUpdateDate(new DateTime());
     newSensorAT.SetUser(sensorAT.GetUser());
     newSensorAT.SetWay(sensorAT.GetWay());
     newSensorAT.SetAt(at);
     return newSensorAT;
 }
Пример #2
0
 public static SensorAT CreateSensor(User user, AT at, int index)
 {
     var newSensorAT = new SensorAT();
     newSensorAT.SetName(at.GetName() + "-" + index);
     newSensorAT.SetCreationDate(new DateTime());
     newSensorAT.SetDeleted(false);
     newSensorAT.SetKm(Convert.ToSingle(105.7));
     newSensorAT.SetLane(index);
     newSensorAT.SetState(1);
     newSensorAT.SetStatus(true);
     newSensorAT.SetUpdateDate(new DateTime());
     newSensorAT.SetUser(user);
     newSensorAT.SetWay(1);
     newSensorAT.SetAt(at);
     return newSensorAT;
 }
Пример #3
0
        public static SensorAT DuplicateSensor(SensorAT sensorAT, AT at)
        {
            var newSensorAT = new SensorAT();

            newSensorAT.SetName(at.GetName() + "-" + sensorAT.GetName());
            newSensorAT.SetCreationDate(new DateTime());
            newSensorAT.SetDeleted(false);
            newSensorAT.SetKm(sensorAT.GetKm());
            newSensorAT.SetLane(sensorAT.GetLane());
            newSensorAT.SetState(sensorAT.GetState());
            newSensorAT.SetStatus(true);
            newSensorAT.SetUpdateDate(new DateTime());
            newSensorAT.SetUser(sensorAT.GetUser());
            newSensorAT.SetWay(sensorAT.GetWay());
            newSensorAT.SetAt(at);
            return(newSensorAT);
        }
Пример #4
0
        public static SensorAT CreateSensor(User user, AT at, int index)
        {
            var newSensorAT = new SensorAT();

            newSensorAT.SetName(at.GetName() + "-" + index);
            newSensorAT.SetCreationDate(new DateTime());
            newSensorAT.SetDeleted(false);
            newSensorAT.SetKm(Convert.ToSingle(105.7));
            newSensorAT.SetLane(index);
            newSensorAT.SetState(1);
            newSensorAT.SetStatus(true);
            newSensorAT.SetUpdateDate(new DateTime());
            newSensorAT.SetUser(user);
            newSensorAT.SetWay(1);
            newSensorAT.SetAt(at);
            return(newSensorAT);
        }
Пример #5
0
        public virtual void Test1()
        {
            DeleteBase("sict");
            var odb  = Open("sict");
            var user = Popula(odb);
            var at   = CreateAT(user);

            odb.Store(at);
            odb.Store(CreateSensor(user, at, 1));
            odb.Store(CreateSensor(user, at, 2));
            odb.Store(CreateSensor(user, at, 3));
            odb.Store(CreateSensor(user, at, 4));
            odb.Close();
            odb = Open("sict");
            var query1 = odb.Query <AT>();
            var ats    = query1.Execute <AT>();
            var nbAts  = ats.Count;

            at = ats.GetFirst();
            AT       newAT     = null;
            SensorAT newSensor = null;
            IQuery   query     = odb.Query <SensorAT>();

            query.Descend("at.name").Constrain(at.GetName()).Equal();
            query.Descend("lane").OrderAscending();
            var sensors = query.Execute <SensorAT>();

            Println("Duplicando AT " + at.GetName());
            for (var i = 0; i < 10; i++)
            {
                newAT = DuplicateAT(at, nbAts + i + 1);
                odb.Store(newAT);
                sensors.Reset();
                while (sensors.HasNext())
                {
                    newSensor = DuplicateSensor(sensors.Next(), newAT);
                    odb.Store(newSensor);
                }
            }
            // println("AT " + newAT.getName()+" created");
            odb.Close();
        }