Exemple #1
0
        public Result <TerminalGroupApkInfo> SearchTerminalGroupApk(int pageNo, int pageSize, Nullable <TerminalGroupApkSearchOrderBy> orderBy, long groupId, Nullable <bool> pendingOnly, Nullable <bool> historyOnly, string keyWords)
        {
            IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo);

            if (validationErrs.Count > 0)
            {
                return(new Result <TerminalGroupApkInfo>(validationErrs));
            }
            RestRequest request = new RestRequest(SEARCH_TERMINAL_GROUP_APK_URL, Method.GET);

            request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo);
            request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString());
            if (orderBy != null)
            {
                request.AddParameter("orderBy", ExtEnumHelper.GetEnumValue(orderBy));
            }
            request.AddParameter("groupId", groupId);
            if (pendingOnly != null)
            {
                request.AddParameter("pendingOnly", pendingOnly.Value.ToString());
            }
            if (historyOnly != null)
            {
                request.AddParameter("historyOnly", historyOnly.Value.ToString());
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                request.AddParameter("keyWords", keyWords);
            }
            string responseContent = Execute(request);
            TerminalGroupApkPageResponse  terminalGroupApkPageResponse = JsonConvert.DeserializeObject <TerminalGroupApkPageResponse>(responseContent);
            Result <TerminalGroupApkInfo> result = new Result <TerminalGroupApkInfo>(terminalGroupApkPageResponse);

            return(result);
        }
        public Result <EntityAttribute> SearchEntityAttributes(int pageNo, int pageSize, Nullable <EntityAttributeSearchOrderBy> orderBy, string key, Nullable <EntityAttributeType> entityType)
        {
            IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo);

            if (validationErrs.Count > 0)
            {
                return(new Result <EntityAttribute>(validationErrs));
            }
            RestRequest request = new RestRequest(SEARCH_ENTITY_ATTRIBUTES_URL, Method.GET);

            request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo.ToString());
            request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString());
            if (orderBy != null)
            {
                request.AddParameter("orderBy", ExtEnumHelper.GetEnumValue(orderBy));
            }
            if (!string.IsNullOrEmpty(key))
            {
                request.AddParameter("key", key);
            }
            if (entityType != null)
            {
                request.AddParameter("entityType", ExtEnumHelper.GetEnumValue(entityType));
            }

            var responseContent = Execute(request);
            EntityAttributePageResponse entityAttributePageResponse = JsonConvert.DeserializeObject <EntityAttributePageResponse>(responseContent);
            Result <EntityAttribute>    result = new Result <EntityAttribute>(entityAttributePageResponse);

            return(result);
        }
Exemple #3
0
        public Result <ApkParameter> GetTerminalApkParameter(int pageNo, int pageSize, Nullable <TerminalApkParamSearchOrderBy> orderBy, string templateName, string packageName, string versionName)
        {
            IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo);

            if (validationErrs.Count > 0)
            {
                return(new Result <ApkParameter>(validationErrs));
            }
            RestRequest request = new RestRequest(GET_TERMINAL_APK_PARAMETER_URL, Method.GET);

            request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo.ToString());
            request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString());
            if (orderBy != null)
            {
                request.AddParameter("orderBy", ExtEnumHelper.GetEnumValue(orderBy));
            }
            if (!string.IsNullOrEmpty(templateName))
            {
                request.AddParameter("templateName", templateName);
            }
            if (!string.IsNullOrEmpty(packageName))
            {
                request.AddParameter("packageName", packageName);
            }
            if (!string.IsNullOrEmpty(versionName))
            {
                request.AddParameter("versionName", versionName);
            }

            var responseContent = Execute(request);
            ApkParameterPageResponse apkParameterPageResponse = JsonConvert.DeserializeObject <ApkParameterPageResponse>(responseContent);
            Result <ApkParameter>    result = new Result <ApkParameter>(apkParameterPageResponse);

            return(result);
        }
Exemple #4
0
        public Result <string> PushCmdToTerminal(long terminalId, TerminalPushCmd command)
        {
            RestRequest request = new RestRequest(PUSH_TERMINAL_ACTION_URL, Method.POST);

            request.AddUrlSegment(URL_SEGMENT_TERMINAL_ID, terminalId);
            request.AddParameter("command", ExtEnumHelper.GetEnumValue(command));
            string          responseContent = Execute(request);
            EmptyResponse   emptyResponse   = JsonConvert.DeserializeObject <EmptyResponse>(responseContent);
            Result <string> result          = new Result <string>(emptyResponse);

            return(result);
        }
        public Result <TerminalParameterVariable> GetTerminalVariable(int pageNo, int pageSize, Nullable <VariableSearchOrderBy> orderBy, string tid, string serialNo, string packageName, string key, Nullable <VariableSource> source)
        {
            IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo);

            if (string.IsNullOrEmpty(tid) && string.IsNullOrEmpty(serialNo))
            {
                validationErrs.Add(GetMsgByKey("tidAndSnIsMandatory"));
            }
            if (validationErrs.Count > 0)
            {
                return(new Result <TerminalParameterVariable>(validationErrs));
            }
            RestRequest request = new RestRequest(GET_TERMINAL_VARIABLE_URL, Method.GET);

            request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo.ToString());
            request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString());
            if (orderBy != null)
            {
                request.AddParameter("orderBy", ExtEnumHelper.GetEnumValue(orderBy));
            }
            if (!string.IsNullOrEmpty(tid))
            {
                request.AddParameter("tid", tid);
            }
            if (!string.IsNullOrEmpty(serialNo))
            {
                request.AddParameter("serialNo", serialNo);
            }
            if (!string.IsNullOrEmpty(packageName))
            {
                request.AddParameter("packageName", packageName);
            }
            if (!string.IsNullOrEmpty(key))
            {
                request.AddParameter("key", key);
            }
            if (source != null)
            {
                request.AddParameter("source", ExtEnumHelper.GetEnumValue(source));
            }


            var responseContent = Execute(request);
            ParameterVariablePageResponse      parameterVariablePageResponse = JsonConvert.DeserializeObject <ParameterVariablePageResponse>(responseContent);
            Result <TerminalParameterVariable> result = new Result <TerminalParameterVariable>(parameterVariablePageResponse);

            return(result);
        }
        public Result <Terminal> SearchTerminal(int pageNo, int pageSize, Nullable <TerminalSearchOrderBy> orderBy, Nullable <TerminalStatus> status,
                                                string modelName, string resellerName, string merchantName, string serialNo, Nullable <bool> excludeGroupId)
        {
            IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo);

            if (validationErrs.Count > 0)
            {
                return(new Result <Terminal>(validationErrs));
            }
            RestRequest request = new RestRequest(SEARCH_TERMINAL_URL, Method.GET);

            request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo);
            request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString());
            if (orderBy != null)
            {
                request.AddParameter("orderBy", TerminalApi.GetOrderValue(orderBy.Value));
            }
            if (status != null)
            {
                request.AddParameter("status", ExtEnumHelper.GetEnumValue(status));
            }
            if (!string.IsNullOrEmpty(modelName))
            {
                request.AddParameter("modelName", modelName.Trim());
            }
            if (!string.IsNullOrEmpty(resellerName))
            {
                request.AddParameter("resellerName", resellerName.Trim());
            }
            if (!string.IsNullOrEmpty(merchantName))
            {
                request.AddParameter("merchantName", merchantName.Trim());
            }
            if (!string.IsNullOrEmpty(serialNo))
            {
                request.AddParameter("serialNo", serialNo);
            }
            if (excludeGroupId != null)
            {
                request.AddParameter("excludeGroupId", excludeGroupId);
            }
            string responseContent = Execute(request);
            TerminalPageResponse terminalPageResponse = JsonConvert.DeserializeObject <TerminalPageResponse>(responseContent);
            Result <Terminal>    result = new Result <Terminal>(terminalPageResponse);

            return(result);
        }
        public Result <TerminalGroup> SearchTerminalGroup(int pageNo, int pageSize, Nullable <TerminalGroupSearchOrderBy> orderBy,
                                                          Nullable <TerminalGroupStatus> status, string name, string resellerNames, string modelNames, Nullable <bool> isDynamic)
        {
            IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo);

            if (validationErrs.Count > 0)
            {
                return(new Result <TerminalGroup>(validationErrs));
            }
            RestRequest request = new RestRequest(SEARCH_TERMINAL_GROUP_URL, Method.GET);

            request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo);
            request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString());
            if (orderBy != null)
            {
                request.AddParameter("orderBy", ExtEnumHelper.GetEnumValue(orderBy));
            }
            if (status != null)
            {
                request.AddParameter("status", ExtEnumHelper.GetEnumValue(status));
            }
            if (!string.IsNullOrEmpty(name))
            {
                request.AddParameter("name", name.Trim());
            }

            if (!string.IsNullOrEmpty(resellerNames))
            {
                request.AddParameter("resellerNames", resellerNames.Trim());
            }
            if (!string.IsNullOrEmpty(modelNames))
            {
                request.AddParameter("modelNames", modelNames.Trim());
            }
            if (isDynamic != null)
            {
                request.AddParameter("isDynamic", isDynamic);
            }
            string responseContent = Execute(request);
            TerminalGroupPageResponse terminalGroupPageResponse = JsonConvert.DeserializeObject <TerminalGroupPageResponse>(responseContent);
            Result <TerminalGroup>    result = new Result <TerminalGroup>(terminalGroupPageResponse);

            return(result);
        }
Exemple #8
0
        public Result <DataQueryResult> FindDataFromInsight(string queryCode, Nullable <TimeRange> timeRange, Nullable <int> pageNo, Nullable <int> pageSize)
        {
            List <string> validationErrs = new List <string>();

            if (string.IsNullOrWhiteSpace(queryCode))
            {
                validationErrs.Add(GetMsgByKey("parameterQueryCodeIsNull"));
            }
            else if (queryCode.Length != QUERY_CODE_LENGTH)
            {
                validationErrs.Add(GetMsgByKey("parameterQueryCodeLengthInvalid"));
            }
            if (pageSize != null && (pageSize <= 0 || pageSize > 1000))
            {
                validationErrs.Add(GetMsgByKey("parametePageSizeLengthInvalid"));
            }
            if (validationErrs.Count > 0)
            {
                return(new Result <DataQueryResult>(validationErrs));
            }
            RestRequest request = new RestRequest(SEARCH_GO_INSIGHT_DATA_URL, Method.GET);

            request.AddParameter("queryCode", queryCode);
            if (pageNo != null && pageNo > 0 && pageSize != null && pageSize > 0)
            {
                request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo);
                request.AddParameter("pageSize", pageSize);
            }
            if (timeRange != null)
            {
                request.AddParameter("timeRangeType", ExtEnumHelper.GetEnumValue(timeRange));
            }
            var responseContent = Execute(request);
            DataQueryResponse        dataQueryResponse = JsonConvert.DeserializeObject <DataQueryResponse>(responseContent);
            Result <DataQueryResult> result            = new Result <DataQueryResult>(dataQueryResponse);

            return(result);
        }
Exemple #9
0
        public Result <PagedApp> SearchApp(
            int pageNo, int pageSize, Nullable <AppSearchOrderBy> orderBy,
            String name,
            Nullable <AppOsType> osType,
            Nullable <AppChargeType> chargeType,
            Nullable <AppBaseType> baseType,
            Nullable <AppStatus> appStatus,
            Nullable <ApkStatus> apkStatus,
            Nullable <bool> specificReseller,
            Nullable <bool> specificMerchantCategory,
            bool includeSubscribedApp,
            String resellerName)
        {
            IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo);

            if (validationErrs.Count > 0)
            {
                return(new Result <PagedApp>(validationErrs));
            }
            RestRequest request = new RestRequest(SEARCH_APP_URL, Method.GET);

            request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo.ToString());
            request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString());

            if (orderBy != null)
            {
                request.AddParameter("orderBy", ExtEnumHelper.GetEnumValue(orderBy));
            }

            request.AddParameter("name", name);

            if (apkStatus != null)
            {
                request.AddParameter("apkStatus", ExtEnumHelper.GetEnumValue(apkStatus));
            }

            if (appStatus != null)
            {
                request.AddParameter("appStatus", ExtEnumHelper.GetEnumValue(appStatus));
            }

            if (baseType != null)
            {
                request.AddParameter("baseType", ExtEnumHelper.GetEnumValue(baseType));
            }
            if (chargeType != null)
            {
                request.AddParameter("chargeType", chargeType.ToString());
            }
            if (osType != null)
            {
                request.AddParameter("osType", ExtEnumHelper.GetEnumValue(osType));
            }
            if (specificReseller != null)
            {
                request.AddParameter("specificReseller", specificReseller.ToString());
            }
            if (specificMerchantCategory != null)
            {
                request.AddParameter("specificMerchantCategory", specificMerchantCategory.ToString());
            }
            request.AddParameter("includeSubscribedApp", includeSubscribedApp.ToString());
            if (!string.IsNullOrWhiteSpace(resellerName))
            {
                request.AddParameter("resellerName", resellerName.Trim());
            }

            var               responseContent = Execute(request);
            AppPageResponse   appPageDTO      = JsonConvert.DeserializeObject <AppPageResponse>(responseContent);
            Result <PagedApp> result          = new Result <PagedApp>(appPageDTO);

            return(result);
        }