Exemplo n.º 1
0
 public void LoadData()
 {
     if (!DataLoaded)
     {
         if (EntitiesId != null && EntitiesId.Length > 0)
         {
             this.DataLoaded = true;
             //Call for get entities by ids.
             OdooCommandContext context = new OdooCommandContext();
             context.EntityName = OdooCommandContextFactory.GetOdooEntityName(typeof(T));
             ResultSet result = this.Service.GetEntityCommand(context, this.EntitiesId);
             OdooObjectFactory.BuildEntities <T>(Service, result, this);
         }
     }
 }
Exemplo n.º 2
0
 internal IEnumerable <T> GetEntities <T>(Expression <Func <T, bool> > conditions, int?offset = null, int?limit = null, string order = null) where T : IOdooObject, new()
 {
     try
     {
         OdooCommandContext context;
         context        = OdooCommandContextFactory.BuildCommandContextFromExpression <T>(conditions);
         context.Limit  = limit ?? 0;
         context.Offset = offset ?? 0;
         context.Order  = order;
         IEnumerable <object> ids = SearchCommand(context);
         context.ClearArguments();
         ResultSet       result   = GetEntityCommand(context, ids);
         IEnumerable <T> entities = OdooObjectFactory.BuildEntities <T>(this, result);
         return(entities);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Exemplo n.º 3
0
        private void LoadData()
        {
            if (!_dataLoaded)
            {
                var context = new OdooCommandContext();
                context.EntityName = OdooCommandContextFactory.GetOdooEntityName(typeof(T));

                var result = _service.GetEntityCommand(context, new List <object> {
                    _id
                });

                var collection = new Collection <T>();

                OdooObjectFactory.BuildEntities(_service, result, collection);

                if (collection.Any())
                {
                    @object = collection.First();
                }
            }
        }