public static SensorAT CreateSensor(NeoDatis.Odb.Test.Update.Nullobject.User user, AT at, int index) { SensorAT newSensorAT = new SensorAT (); newSensorAT.SetName(at.GetName() + "-" + index); newSensorAT.SetCreationDate(new System.DateTime()); newSensorAT.SetDeleted(false); newSensorAT.SetKm(System.Convert.ToSingle(105.7)); newSensorAT.SetLane(index); newSensorAT.SetState(1); newSensorAT.SetStatus(true); newSensorAT.SetUpdateDate(new System.DateTime()); newSensorAT.SetUser(user); newSensorAT.SetWay(1); newSensorAT.SetAt(at); return newSensorAT; }
public static AT DuplicateAT(AT at, int index) { AT newAt = new AT (); newAt.SetName(at.GetName() + "-" + index); newAt.SetConstructor(at.GetConstructor()); newAt.SetCreationDate(new System.DateTime()); newAt.SetDeleted(false); newAt.SetIpAddress(at.GetIpAddress()); newAt.SetPhysicalAddress(at.GetPhysicalAddress()); newAt.SetPort(at.GetPort()); newAt.SetStatus(true); newAt.SetType(at.GetType()); newAt.SetUpdateDate(new System.DateTime()); newAt.SetUser(at.GetUser()); return(newAt); }
public static SensorAT CreateSensor(NeoDatis.Odb.Test.Update.Nullobject.User user, AT at, int index) { SensorAT newSensorAT = new SensorAT (); newSensorAT.SetName(at.GetName() + "-" + index); newSensorAT.SetCreationDate(new System.DateTime()); newSensorAT.SetDeleted(false); newSensorAT.SetKm(System.Convert.ToSingle(105.7)); newSensorAT.SetLane(index); newSensorAT.SetState(1); newSensorAT.SetStatus(true); newSensorAT.SetUpdateDate(new System.DateTime()); newSensorAT.SetUser(user); newSensorAT.SetWay(1); newSensorAT.SetAt(at); return(newSensorAT); }
public static SensorAT DuplicateSensor(SensorAT sensorAT, AT at) { SensorAT newSensorAT = new SensorAT (); newSensorAT.SetName(at.GetName() + "-" + sensorAT.GetName()); newSensorAT.SetCreationDate(new System.DateTime()); newSensorAT.SetDeleted(false); newSensorAT.SetKm(sensorAT.GetKm()); newSensorAT.SetLane(sensorAT.GetLane()); newSensorAT.SetState(sensorAT.GetState()); newSensorAT.SetStatus(true); newSensorAT.SetUpdateDate(new System.DateTime()); newSensorAT.SetUser(sensorAT.GetUser()); newSensorAT.SetWay(sensorAT.GetWay()); newSensorAT.SetAt(at); return(newSensorAT); }
/// <exception cref="System.Exception"></exception> public virtual void Test1() { DeleteBase("sict"); NeoDatis.Odb.ODB odb = Open("sict"); NeoDatis.Odb.Test.Update.Nullobject.User user = Popula(odb); AT 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"); NeoDatis.Odb.Objects <AT> ats = odb.GetObjects <AT>(); int nbAts = ats.Count; at = (AT)ats.GetFirst(); AT newAT = null; SensorAT newSensor = null; NeoDatis.Odb.Core.Query.IQuery query = new CriteriaQuery(Where.Equal("at.name", at.GetName())); query.OrderByAsc("lane"); NeoDatis.Odb.Objects <SensorAT> sensors = odb.GetObjects <SensorAT>(query); Println("Duplicando AT " + at.GetName()); for (int i = 0; i < 10; i++) { newAT = DuplicateAT(at, nbAts + i + 1); odb.Store(newAT); sensors.Reset(); while (sensors.HasNext()) { newSensor = DuplicateSensor((SensorAT)sensors .Next(), newAT); odb.Store(newSensor); } } // println("AT " + newAT.getName()+" created"); odb.Close(); }
public static AT DuplicateAT(AT at, int index) { AT newAt = new AT (); newAt.SetName(at.GetName() + "-" + index); newAt.SetConstructor(at.GetConstructor()); newAt.SetCreationDate(new System.DateTime()); newAt.SetDeleted(false); newAt.SetIpAddress(at.GetIpAddress()); newAt.SetPhysicalAddress(at.GetPhysicalAddress()); newAt.SetPort(at.GetPort()); newAt.SetStatus(true); newAt.SetType(at.GetType()); newAt.SetUpdateDate(new System.DateTime()); newAt.SetUser(at.GetUser()); return newAt; }
public static SensorAT DuplicateSensor(SensorAT sensorAT, AT at) { SensorAT newSensorAT = new SensorAT (); newSensorAT.SetName(at.GetName() + "-" + sensorAT.GetName()); newSensorAT.SetCreationDate(new System.DateTime()); newSensorAT.SetDeleted(false); newSensorAT.SetKm(sensorAT.GetKm()); newSensorAT.SetLane(sensorAT.GetLane()); newSensorAT.SetState(sensorAT.GetState()); newSensorAT.SetStatus(true); newSensorAT.SetUpdateDate(new System.DateTime()); newSensorAT.SetUser(sensorAT.GetUser()); newSensorAT.SetWay(sensorAT.GetWay()); newSensorAT.SetAt(at); return newSensorAT; }