Пример #1
0
        public async Task <APIEndpointCommandResponseModels.GetEndpointCommandsList> GetEndPointsListAsync(APIEndpointCommandRequestModels.GetEndpointCommandsList rm)
        {
            string strResult = await HttpPost("/api/EndPointCommands/GetEndPointCommandsList", JsonConvert.SerializeObject(rm));

            APIEndpointCommandResponseModels.GetEndpointCommandsList result = (APIEndpointCommandResponseModels.GetEndpointCommandsList)JsonConvert.DeserializeObject(strResult, typeof(APIEndpointCommandResponseModels.GetEndpointCommandsList));
            return(result);
        }
        /// <summary>
        /// Get List of EndPoint Commands.
        /// </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="EndPointID">Filter by EndPoint ID. You can keep it null or empty to ignore this filter.</param>
        /// <returns></returns>
        public APIEndpointCommandResponseModels.GetEndpointCommandsList GetEndpointCommands(string searchFor, long EndPointID, long ThingID, long locationID, bool loadEndpoint, int pageNumber, int pageSize)
        {
            APIEndpointCommandResponseModels.GetEndpointCommandsList result = new APIEndpointCommandResponseModels.GetEndpointCommandsList();

            IPagedList <EndPointCommand> endpointCommandsPL = uow_Repositories.repoEndPointCommands.GetPagedList(searchFor, EndPointID, ThingID, locationID, pageNumber, pageSize);
            List <EndPointCommand>       endpointCommands   = endpointCommandsPL.ToList();

            List <APIEndPointCommand> listAPIEndpointCommands = new List <APIEndPointCommand>();

            foreach (EndPointCommand cmd in endpointCommands)
            {
                APIEndPointCommand apiCMD = TypesMapper.APIEndPointCommandAdapter.fromEndpointCommand(cmd, loadEndpoint);
                listAPIEndpointCommands.Add(apiCMD);
            }
            result.EndpointCommands = listAPIEndpointCommands;


            PagingInfoResponseModel pagingInfo = new PagingInfoResponseModel();

            pagingInfo.CurrentPage  = endpointCommandsPL.PageNumber;
            pagingInfo.ItemsPerPage = endpointCommandsPL.PageSize;
            pagingInfo.ItemsCount   = endpointCommandsPL.TotalItemCount;
            pagingInfo.PagesCount   = endpointCommandsPL.PageCount;
            result.PagingInfo       = pagingInfo;
            return(result);
        }
Пример #3
0
        private async void btnGetEnpointsCommands_ClickAsync(object sender, EventArgs e)
        {
            Initialize();

            APIEndpointCommandRequestModels.GetEndpointCommandsList model = new APIEndpointCommandRequestModels.GetEndpointCommandsList();
            model.LoadEndpoint = true;

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

            APIEndpointCommandResponseModels.GetEndpointCommandsList cmds = await uow.EndPointCommandsService.GetEndPointsListAsync(model);

            gv1.DataSource = cmds.EndpointCommands;
        }