public string LoadServicesConfigDetails(dynamic Json)
        {
            string Input  = JsonConvert.SerializeObject(Json);
            string output = ServiceConfigurationDataAccessManager.GetServicesConfigURL(Input);

            return(output);
        }
        public IHttpActionResult ProcessRequest(RequestData request)
        {
            //HttpClient client = new HttpClient();
            //Request.Headers.Authorization

            JObject obj = new JObject();

            try
            {
                JObject jsonObj = request.Json;
                var     newObj  = new JObject
                {
                    ["Json"] = jsonObj,
                };

                string newJsonString = Convert.ToString(newObj);


                dynamic inputObject = new ExpandoObject();

                var expConverter = new ExpandoObjectConverter();
                inputObject = JsonConvert.DeserializeObject <ExpandoObject>(newJsonString, expConverter);
                string customApi = "";
                string processServicesConfiguartionURL = ServiceConfigurationDataAccessManager.GetServicesConfiguartionURL(inputObject.Json.ServicesAction);
                // Convert json string to custom .Net object
                JObject ObjProcessServicesConfiguartionURL = (JObject)JsonConvert.DeserializeObject(processServicesConfiguartionURL);
                customApi = ObjProcessServicesConfiguartionURL["Json"]["ServicesURL"].ToString();


                //customApi = _cacheManager.GetServiceConfiguartionUrlFromCache(inputObject.Json.ServicesAction);
                LogData("ProcessRequest customApi" + customApi);


                if (!string.IsNullOrEmpty(customApi))
                {
                    //create the constructor with post type and few data
                    GRClientRequest myRequest = new GRClientRequest(customApi, "POST", newJsonString);
                    //show the response string on the console screen.
                    string outputResponse = myRequest.GetResponse();
                    LogData("outputResponse customApi" + outputResponse);
                    if (outputResponse != null)
                    {
                        obj = (JObject)JsonConvert.DeserializeObject(outputResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                LogData("ProcessRequest Error" + ex.Message);
            }

            return(Ok(obj));
        }
        protected bool ValidateLicense(LoginDTO loginDto)
        {
            bool IsValid = false;

            try
            {
                JObject jsonObj = new JObject();

                var newObj = new JObject
                {
                    ["Json"] = jsonObj,
                };
                string newJsonString = Convert.ToString(newObj);
                LogWsData("newJsonString: " + newJsonString);
                string servicesAction = "GetLicenseInfoList";
                string servicesURL    = ServiceConfigurationDataAccessManager.GetServicesConfiguartionURL(servicesAction);
                LogWsData("servicesURL: " + servicesURL);
                // Convert json string to custom .Net object
                JObject jObjectServicesConfiguartionURL = (JObject)JsonConvert.DeserializeObject(servicesURL);
                string  customApi = jObjectServicesConfiguartionURL["Json"]["ServicesURL"].ToString();
                LogWsData("customApi: " + customApi);
                GRClientRequest myRequest = new GRClientRequest(customApi, "POST", newJsonString);
                LogWsData("myRequest: " + myRequest);
                string outputResponse = myRequest.GetResponse();
                LogWsData("outputResponse: " + outputResponse);
                if (!string.IsNullOrEmpty(outputResponse))
                {
                    JObject obj  = new JObject();
                    JObject obj1 = new JObject();

                    obj = (JObject)JsonConvert.DeserializeObject(outputResponse);

                    // Create a dynamic output object
                    dynamic output = new ExpandoObject();

                    output.LicenseInfoList = obj["LicenseInfo"]["LicenseInfoList"];
                    output.UserTypeCode    = loginDto.UserTypeCode;
                    output.UserName        = loginDto.UserName;
                    output.ActivationCode  = loginDto.ActivationCode;

                    dynamic orderJson = new ExpandoObject();
                    orderJson.Json = output;

                    // Serialize the dynamic output object to a string
                    string outputJson = JsonConvert.SerializeObject(orderJson);

                    // Convert json object to JOSN string format
                    string jsonData = JsonConvert.SerializeObject(obj1);

                    string servicesAction1 = "ValidateLicense";
                    string servicesURL1    = ServiceConfigurationDataAccessManager.GetServicesConfiguartionURL(servicesAction1);

                    // Convert json string to custom .Net object
                    JObject jObjectServicesConfiguartionURL1 = (JObject)JsonConvert.DeserializeObject(servicesURL1);
                    string  customApi1 = jObjectServicesConfiguartionURL1["Json"]["ServicesURL"].ToString();

                    GRClientRequest myRequest1 = new GRClientRequest(customApi1, "POST", outputJson);

                    string outputResponse1 = myRequest1.GetResponse();

                    if (!string.IsNullOrEmpty(outputResponse1))
                    {
                        JObject objoutputResponse = new JObject();

                        objoutputResponse = (JObject)JsonConvert.DeserializeObject(outputResponse1);
                        IsValid           = Convert.ToBoolean(objoutputResponse["Json"]["IsLicenseValid"]);
                    }
                }
            }
            catch (Exception ex)
            {
                LogWsData("ValidateLicense: " + ex);
                LogWsData("ValidateLicenseMessage: " + ex.Message);
                LogWsData("ValidateLicenseInnerException: " + ex.InnerException);
            }

            return(IsValid);
        }