Ejemplo n.º 1
0
        public List <string> setTableNamesFromSelectedIdo(string ido)
        {
            ThisForm.Variables("varDebug").Value += "setTableNamesFromSelectedIdo - " + ido + "\n";
            string filter = "CollectionName = '" + ido + "'";

            string sso          = ThisForm.Variables("varSSO").Value = "0";
            string serverId     = ThisForm.Variables("varServerId").Value = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("ServerID");
            string suiteContext = ThisForm.Variables("varSuiteContext").Value = "MONGOOSE/IDORequestService/ido";
            string httpMethod   = ThisForm.Variables("varHttpMethod").Value = "GET";
            string methodName   = ThisForm.Variables("varMethodName").Value = "/load/IdoTables?properties=TableName&filter=" + filter;
            string parameters   = ThisForm.Variables("varParameters").Value = "[{\"Name\":\"Accept\",\"Type\":\"header\",\"Value\":\"application/json\"}, " +
                                                                              "{\"Name\":\"X-Infor-MongooseConfig\",\"Type\":\"header\",\"Value\":\"" + ThisForm.Variables("varMongooseConfig").Value + "\"}]";
            string contentType = ThisForm.Variables("varContentType").Value = "text/plain";
            string timeout     = ThisForm.Variables("varTimeout").Value = "10000";

            InvokeRequestData IDORequest = new InvokeRequestData();

            IDORequest.IDOName    = "IONAPIMethods";
            IDORequest.MethodName = "InvokeIONAPIMethod";
            IDORequest.Parameters.Add(sso);
            IDORequest.Parameters.Add(serverId);
            IDORequest.Parameters.Add(new InvokeParameter(suiteContext));
            IDORequest.Parameters.Add(new InvokeParameter(httpMethod));
            IDORequest.Parameters.Add(new InvokeParameter(methodName));
            IDORequest.Parameters.Add(new InvokeParameter(parameters));
            IDORequest.Parameters.Add(new InvokeParameter(contentType));
            IDORequest.Parameters.Add(new InvokeParameter(timeout));
            IDORequest.Parameters.Add(IDONull.Value); //ResponseCode 8
            IDORequest.Parameters.Add(IDONull.Value); //ResponseContent 9
            IDORequest.Parameters.Add(IDONull.Value); //ResponseHeaders 10
            IDORequest.Parameters.Add(IDONull.Value); //ResponseInfobar 11

            InvokeResponseData response = IDOClient.Invoke(IDORequest);

            if (response.IsReturnValueStdError())
            {
                ThisForm.Variables("varDebug").Value += "Error: " + methodName + "\r\nResponseCode: " + response.Parameters[8].Value + "\r\nInfobar " + response.Parameters[11].Value + "\n";
            }

            //ThisForm.Variables("varDebug").Value += response.Parameters[9].Value + "\n";

            MongooseResponse mongooseResponseObj = JsonConvert.DeserializeObject <MongooseResponse>(response.Parameters[9].Value);

            if (mongooseResponseObj.Success && mongooseResponseObj.Items != null)
            {
                List <string> tables = new List <string>();
                for (int i = 0; i < mongooseResponseObj.Items.Length; i++)
                {
                    tables.Add(mongooseResponseObj.Items[i].TableName);
                }
                return(tables);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public void loadIdoNamesFromProject()
        {
            //reset list
            ThisForm.Components[listIdos].InvalidateList();

            MongooseResponse mongooseResponseObj = JsonConvert.DeserializeObject <MongooseResponse>(ThisForm.Variables("varIdos").Value);

            if (mongooseResponseObj.Success && mongooseResponseObj.Items != null)
            {
                for (int i = 0; i < mongooseResponseObj.Items.Length; i++)
                {
                    ThisForm.Components[listIdos].InsertListBoxString(i, mongooseResponseObj.Items[i].CollectionName);
                }
            }
            ThisForm.Components[listIdos].Visible = true;
        }