/// <summary>
        /// Get List of Things.
        /// </summary>
        /// <param name="searchFor">Search text as per the 'Title' field.</param>
        /// <param name="locationID">Filter by Location ID. You can keep it null or empty to ignore this filter.</param>
        /// <param name="pageNumber">Page Number.</param>
        /// <param name="pageSize">Items count per page.</param>
        /// <param name="loadParents">Enable or Disable loading the Parents objects.</param>
        /// <param name="loadChilds">Enable or Disable loading the Childs objects.</param>
        /// <returns></returns>
        public APIThingResponseModels.GetThingsList GetThingsList(string searchFor, long?locationID, bool loadThingEnds, bool loadEndpoints, bool loadLocation, bool loadThingExtensionValues, int pageNumber, int pageSize)
        {
            APIThingResponseModels.GetThingsList result = new APIThingResponseModels.GetThingsList();

            IPagedList <Thing> thingsPL = uof_Repositories.repoThings.GetPagedList(searchFor, locationID, pageNumber, pageSize);

            List <Thing> things = thingsPL.ToList();

            List <APIThing> listAPIThings = new List <APIThing>();

            foreach (Thing thing in things)
            {
                APIThing apiThing = TypesMapper.APIThingAdapter.fromThing(thing, loadLocation, loadThingEnds, loadThingEnds, loadThingExtensionValues);
                listAPIThings.Add(apiThing);
            }
            result.Things = listAPIThings;


            PagingInfoResponseModel pagingInfo = new PagingInfoResponseModel();

            pagingInfo.CurrentPage  = thingsPL.PageNumber;
            pagingInfo.ItemsPerPage = thingsPL.PageSize;
            pagingInfo.ItemsCount   = thingsPL.TotalItemCount;
            pagingInfo.PagesCount   = thingsPL.PageCount;
            result.PagingInfo       = pagingInfo;
            return(result);
        }
Exemple #2
0
        public async Task <APIThingResponseModels.GetThingsList> GetThingsWithWarningsListAsync(APIThingRequestModels.GetThingsList rm)
        {
            string strResult = await HttpPost("/api/Things/GetThingsWithWarningsList", JsonConvert.SerializeObject(rm));

            APIThingResponseModels.GetThingsList result = (APIThingResponseModels.GetThingsList)JsonConvert.DeserializeObject(strResult, typeof(APIThingResponseModels.GetThingsList));
            return(result);
        }
Exemple #3
0
        private async void btnThings_Click(object sender, EventArgs e)
        {
            Initialize();

            APIThingRequestModels.GetThingsList model = new APIThingRequestModels.GetThingsList();
            model.LoadEndPoints            = true;
            model.LoadLocation             = true;
            model.LoadThingEnds            = true;
            model.LoadThingExtensionValues = true;

            model.PageNumber = 1; model.PageSize = 1; model.Token = Guid.Parse(txtToken.Text);

            APIThingResponseModels.GetThingsList things = await uow.ThingsService.GetThingsListAsync(model);

            gv1.DataSource = things.Things;
        }