Exemplo n.º 1
0
        public async Task GetDataSet(HttpSessionStateBase currentSession, string dsid, string dataSetId)
        {
            dataSetIndexPatchView    = new DataSetIndexPatchView();
            dataSetIndexPatch        = new DataSetIndexPatch();
            dataSetIndexPatchView.id = Convert.ToInt32(dsid);
            string        accessToken   = UserSession.accessToken(currentSession);
            HttpGetObject objHttpObject = new HttpGetObject();

            objHttpObject.accessToken = accessToken;
            objHttpObject.id          = dataSetId;
            objHttpObject.endPoint    = dataSetIndexesdatasetidEndPoint;
            APIClient           apiclient = new APIClient();
            HttpResponseMessage dsResp    = await apiclient.getAsync(objHttpObject);

            if (!dsResp.IsSuccessStatusCode)
            {
                errorOccurred = true;
            }
            else
            {
                string val = await dsResp.Content.ReadAsStringAsync();

                dataSetIndexViewList = JsonConvert.DeserializeObject <List <DataSetIndexView> >(val);

                foreach (DataSetIndexView resp in dataSetIndexViewList)
                {
                    if (resp.id == dataSetIndexPatchView.id)
                    {
                        dataSetIndexPatchView.id             = resp.id;
                        dataSetIndexPatchView.dataSetId      = resp.dataSetId;
                        dataSetIndexPatchView.dataSetColumns = resp.dataSetColumns;
                        dataSetIndexPatchView.limitRecords   = (resp.limitRecords == null ? 0 : resp.limitRecords);
                        dataSetIndexPatchView.shingleSize    = resp.shingleSize;
                        dataSetIndexPatchView.rowsPerBand    = resp.rowsPerBand;
                        dataSetIndexPatchView.procType       = resp.procType;
                        dataSetIndexPatchView.nodeUrl        = resp.nodeUrl;
                        dataSetIndexPatchView.active         = resp.active;
                        dataSetIndexPatchView.status         = resp.status;

                        dataSetIndexPatch.dataSetId      = dataSetIndexPatchView.dataSetId;
                        dataSetIndexPatch.dataSetColumns = dataSetIndexPatchView.dataSetColumns;
                        dataSetIndexPatch.limitRecords   = (dataSetIndexPatchView.limitRecords == null ? 0 : dataSetIndexPatchView.limitRecords);
                        dataSetIndexPatch.shingleSize    = dataSetIndexPatchView.shingleSize;
                        dataSetIndexPatch.rowsPerBand    = dataSetIndexPatchView.rowsPerBand;
                        dataSetIndexPatch.procType       = dataSetIndexPatchView.procType;
                        dataSetIndexPatch.nodeUrl        = dataSetIndexPatchView.nodeUrl;
                        dataSetIndexPatch.active         = dataSetIndexPatchView.active;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public async Task AddDataSetIndex(HttpSessionStateBase currentSession)
        {
            dataSetIndexPatchView = new DataSetIndexPatchView();
            string        accessToken   = UserSession.accessToken(currentSession);
            HttpGetObject objHttpObject = new HttpGetObject();

            objHttpObject.accessToken = accessToken;
            objHttpObject.endPoint    = addDataSetIndexEndpoint;
            APIClient apiclient = new APIClient();

            HttpResponseMessage dsResp = await apiclient.postAsync(objHttpObject, apiclient.convertToContent(dataSetIndexPostView));

            if (!dsResp.IsSuccessStatusCode)
            {
                errorOccurred = true;
            }
        }
Exemplo n.º 3
0
        public async Task EditDataSet(HttpSessionStateBase currentSession, int id)
        {
            dataSetIndexPatchView = new DataSetIndexPatchView();
            string        accessToken   = UserSession.accessToken(currentSession);
            HttpGetObject objHttpObject = new HttpGetObject();

            objHttpObject.accessToken = accessToken;
            objHttpObject.endPoint    = updateDataSetIndexEndPoint;
            objHttpObject.id          = Convert.ToString(id);
            dataSetIndexPatchView.id  = Convert.ToInt32(objHttpObject.id);
            //dataSetIndexPatch.id = 0;
            APIClient           apiclient = new APIClient();
            HttpResponseMessage dsResp    = await apiclient.postAsync(objHttpObject, apiclient.convertToContent(dataSetIndexPatch), true);

            if (!dsResp.IsSuccessStatusCode)
            {
                errorOccurred = true;
            }
        }