/// <exception cref="System.Exception"></exception> public static NeoDatis.Odb.Test.Update.Nullobject.User Popula(NeoDatis.Odb.ODB odb ) { // cria perfil NeoDatis.Odb.Test.Update.Nullobject.Profile profileAdmin = new NeoDatis.Odb.Test.Update.Nullobject.Profile ("administrador"); odb.Store(profileAdmin); NeoDatis.Odb.Test.Update.Nullobject.Profile profileOper = new NeoDatis.Odb.Test.Update.Nullobject.Profile ("operador"); odb.Store(profileOper); // cria funcao CreateFunctionProfile(odb, profileAdmin, profileOper); // cria usuario NeoDatis.Odb.Test.Update.Nullobject.User user = new NeoDatis.Odb.Test.Update.Nullobject.User (); user.SetCreationDate(new System.DateTime()); user.SetDeleted(false); user.SetLastLogin(new System.DateTime()); user.SetLogin("admin"); user.SetName("Administrador"); user.SetPassword("trocar"); user.SetProfileId(profileAdmin); user.SetRejectedLogin(0); user.SetUpdateDate(new System.DateTime()); user.SetStatus(true); user.SetSessionKey("123456"); odb.Store(user); return(user); }
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); }
/// <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 CreateAT(NeoDatis.Odb.Test.Update.Nullobject.User user) { NeoDatis.Odb.Test.Update.Nullobject.Constructor constructor = new NeoDatis.Odb.Test.Update.Nullobject.Constructor (); constructor.SetCreationDate(new System.DateTime()); constructor.SetName("neodatis"); constructor.SetDescription("Neodatis"); AT newAt = new AT (); newAt.SetName("AT1"); newAt.SetConstructor(constructor); newAt.SetCreationDate(new System.DateTime()); newAt.SetDeleted(false); newAt.SetIpAddress("1.1.1.1"); newAt.SetPhysicalAddress("A01"); newAt.SetPort(4000); newAt.SetStatus(true); newAt.SetType("Type1"); newAt.SetUpdateDate(new System.DateTime()); newAt.SetUser(user); return(newAt); }
public virtual void SetUser(NeoDatis.Odb.Test.Update.Nullobject.User user) { this.user = user; }
/// <exception cref="System.Exception"></exception> public static NeoDatis.Odb.Test.Update.Nullobject.User Popula(NeoDatis.Odb.ODB odb ) { // cria perfil NeoDatis.Odb.Test.Update.Nullobject.Profile profileAdmin = new NeoDatis.Odb.Test.Update.Nullobject.Profile ("administrador"); odb.Store(profileAdmin); NeoDatis.Odb.Test.Update.Nullobject.Profile profileOper = new NeoDatis.Odb.Test.Update.Nullobject.Profile ("operador"); odb.Store(profileOper); // cria funcao CreateFunctionProfile(odb, profileAdmin, profileOper); // cria usuario NeoDatis.Odb.Test.Update.Nullobject.User user = new NeoDatis.Odb.Test.Update.Nullobject.User (); user.SetCreationDate(new System.DateTime()); user.SetDeleted(false); user.SetLastLogin(new System.DateTime()); user.SetLogin("admin"); user.SetName("Administrador"); user.SetPassword("trocar"); user.SetProfileId(profileAdmin); user.SetRejectedLogin(0); user.SetUpdateDate(new System.DateTime()); user.SetStatus(true); user.SetSessionKey("123456"); odb.Store(user); return user; }