Example #1
0
        public async Task <APIThingEndResponseModels.GetThingEndsList> GetThingEndsListAsync(APIThingEndRequestModels.GetThingEndsList rm)
        {
            string strResult = await HttpPost("/api/ThingEnds/GetThingEndsList", JsonConvert.SerializeObject(rm));

            APIThingEndResponseModels.GetThingEndsList result = (APIThingEndResponseModels.GetThingEndsList)JsonConvert.DeserializeObject(strResult, typeof(APIThingEndResponseModels.GetThingEndsList));
            return(result);
        }
Example #2
0
        /// <summary>
        /// Get List of ThingEnds.
        /// </summary>
        /// <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>
        /// <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="thingID">Filter by Thing ID. You can keep it null or empty to ignore this filter.</param>
        /// <param name="thingCategoryID">Filter by ThingCategory ID. You can keep it null or empty to ignore this filter.</param>
        /// <param name="endpointTypeID">Filter by EndPointType ID. You can keep it null or empty to ignore this filter.</param>
        /// <returns></returns>
        public APIThingEndResponseModels.GetThingEndsList GetThingEndsList(string searchFor, long?locationID, long?thingID, long?thingCategoryID, long?endpointTypeID, bool loadThing, bool loadEndpoint, int pageNumber, int pageSize)
        {
            APIThingEndResponseModels.GetThingEndsList result = new APIThingEndResponseModels.GetThingEndsList();

            IPagedList <ThingEnd> thingEndsPL = uof_Repositories.repoThingEnds.GetPagedList(searchFor, locationID, thingID, thingCategoryID, endpointTypeID, endpointTypeID, pageNumber, pageSize);
            List <ThingEnd>       thingEnds   = thingEndsPL.ToList();

            List <APIThingEnd> listAPIThingEnds = new List <APIThingEnd>();

            foreach (ThingEnd te in thingEnds)
            {
                APIThingEnd apiThingEnd = TypesMapper.APIThingEndAdapter.fromThingEnd(te, loadThing, loadThing);
                listAPIThingEnds.Add(apiThingEnd);
            }
            result.ThingEnds = listAPIThingEnds;

            PagingInfoResponseModel pagingInfo = new PagingInfoResponseModel();

            pagingInfo.CurrentPage  = thingEndsPL.PageNumber;
            pagingInfo.ItemsPerPage = thingEndsPL.PageSize;
            pagingInfo.ItemsCount   = thingEndsPL.TotalItemCount;
            pagingInfo.PagesCount   = thingEndsPL.PageCount;
            result.PagingInfo       = pagingInfo;

            return(result);
        }
Example #3
0
        private async void btnGetThingEnds_ClickAsync(object sender, EventArgs e)
        {
            Initialize();

            APIThingEndRequestModels.GetThingEndsList model = new APIThingEndRequestModels.GetThingEndsList();
            model.LoadEndpoint = true;
            model.LoadThing    = true;

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

            APIThingEndResponseModels.GetThingEndsList thingEnds = await uow.ThingEndsService.GetThingEndsListAsync(model);

            gv1.DataSource = thingEnds.ThingEnds;
        }