コード例 #1
0
ファイル: CRMAccount.cs プロジェクト: yao4ming/Mongoose
        private void CallAddSurveys(string surveys)
        {
            var req = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyAssociation",
                MethodName = "AddSurveyAssociationItems",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(surveys)
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp = IDOClient.Invoke(req);
            }
            catch (Exception ex)
            {
                Application.ShowMessage("Error: " + ex.Message);
                Application.DiagnosticsLog("Error: " + ex.Message);
                return;
            }
            finally
            {
                ThisForm.PrimaryIDOCollection.RefreshKeepCurIndex();
            }
        }
コード例 #2
0
        /// <summary>
        /// Generates a new key based on the table name.
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public string IntGetNewKey(string tableName)
        {
            var key = string.Empty;
            var req = new InvokeRequestData
            {
                IDOName    = "CRMTableKey",
                MethodName = "CRMNewKeySp"
            };

            req.Parameters.Add(tableName);
            req.Parameters.Add(key, true);

            InvokeResponseData resp = null;

            try
            {
                resp = IDOClient.Invoke(req);
            }
            catch (Exception ex)
            {
                Application.ShowMessage(ex.Message);
            }

            if (resp != null)
            {
                key = resp.Parameters[1].Value;
            }

            return(key);
        }
コード例 #3
0
ファイル: CRMAccount.cs プロジェクト: yao4ming/Mongoose
        private string GetSurveyAssociationValues(string associationID)
        {
            var req = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyAssociation",
                MethodName = "GetAssociationValuesByAssociationID",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(associationID),
                    new InvokeParameter("SurveyID,EntityType,EntityID")
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp = IDOClient.Invoke(req);
                return(resp.Parameters[1].Value);
            }
            catch (Exception ex)
            {
                Application.DiagnosticsLog(ex.ToString());
                return(string.Empty);
            }
        }
 static InvokeResponseData get_data()
 {
     var data = new InvokeResponseData(){IDOName = "Chuck", MethodName = "GetHim" };
     data.Parameters.Add("Chevy");
     data.Parameters.Add(10);
     data.ReturnValue = "1"; 
     return data;
 }
コード例 #5
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);
            }
        }
コード例 #6
0
ファイル: CRMAccount.cs プロジェクト: yao4ming/Mongoose
        public void StartNewSurvey()
        {
            var variable = ThisForm.Variables("VarRelationalItemsPointOfReference").Value.Trim();

            var sp = variable.Split(';');

            string[] properties;
            var      associationID = (sp.Length > 2) ? (sp[2] ?? string.Empty) : string.Empty;
            string   newID         = string.Empty;
            string   resultMessage = string.Empty;

            //returns SurveyID, EntityType, EntitiyID, NEED TO GET STATUS TO CHECK
            properties = GetSurveyAssociationValues(associationID).Split(';');

            var insertReq = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyRecord",
                MethodName = "InsertSurveyRecord",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(properties[0]),
                    new InvokeParameter(properties[1]),
                    new InvokeParameter(properties[2]),
                    new InvokeParameter(newID),
                    new InvokeParameter(resultMessage)
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp = IDOClient.Invoke(insertReq);
                if (int.Parse(resp.ReturnValue) == 0)
                {
                    ThisForm.Variables("VarSurveyRecordID").Value = resp.Parameters[3].Value;
                    ThisForm.GenerateEvent("LaunchSurveyRecord");
                }
                else
                {
                    throw new Exception(resp.Parameters[4].Value);
                }
            }
            catch (Exception ex)
            {
                Application.ShowMessage(ex.Message);
                return;
            }
        }
コード例 #7
0
ファイル: CRMAccount.cs プロジェクト: yao4ming/Mongoose
        public void ValidateInProgressSurveys()
        {
            var variable = ThisForm.Variables("VarRelationalItemsPointOfReference").Value.Trim();
            var sp       = variable.Split(';');

            string[] properties;
            var      associationID = (sp.Length > 2) ? (sp[2] ?? string.Empty) : string.Empty;
            string   resultMessage = string.Empty;
            string   result;

            //returns SurveyID, EntityType, EntitiyID
            properties = GetSurveyAssociationValues(associationID).Split(';');
            int inProgress;
            var req = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyRecord",
                MethodName = "PreInsertValidateInProgress",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(properties[1]),
                    new InvokeParameter(properties[2]),
                    new InvokeParameter(properties[0]),
                    new InvokeParameter(resultMessage)
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp       = IDOClient.Invoke(req);
                inProgress = int.Parse(resp.ReturnValue);
            }
            catch (Exception ex)
            {
                Application.ShowMessage(ex.ToString());
                return;
            }
            if (inProgress != 0)
            {
                ThisForm.GenerateEvent("SurveyInProgress");
            }
            else
            {
                ThisForm.GenerateEvent("NoSurveyInProgress");
            }
        }
コード例 #8
0
ファイル: CRMAccount.cs プロジェクト: yao4ming/Mongoose
        public void ContinueInProgressSurvey()
        {
            var variable = ThisForm.Variables("VarRelationalItemsPointOfReference").Value.Trim();
            var sp       = variable.Split(';');

            string[] properties;
            var      accordionType = (sp.Length > 1) ? (sp[1] ?? string.Empty) : string.Empty;
            var      associationID = (sp.Length > 2) ? (sp[2] ?? string.Empty) : string.Empty;
            var      eventName     = (sp.Length > 3) ? (sp[3] ?? string.Empty) : string.Empty; // event or itemid
            string   NewID         = string.Empty;

            //returns SurveyID, EntityType, EntitiyID
            properties = GetSurveyAssociationValues(associationID).Split(';');

            var insertReq = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyRecord",
                MethodName = "GetInProgressSurvey",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(properties[1]),
                    new InvokeParameter(properties[2]),
                    new InvokeParameter(properties[0]),
                    new InvokeParameter(NewID)
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp = IDOClient.Invoke(insertReq);
                ThisForm.Variables("VarSurveyRecordID").SetValue(resp.Parameters[3].GetValue(String.Empty));
            }
            catch (Exception ex)
            {
                Application.ShowMessage(ex.ToString());
                return;
            }
            ThisForm.GenerateEvent("LaunchSurveyRecord");
        }