public static int HandleGETRequest(string EndPoint, string RequestType, string RequestName, List <string> FieldsToReplace, List <string> FieldDataToReplace, string FilePathtoSave)
 {
     using (RequestGenerator reqGen = new RequestGenerator(EndPoint, RequestType, RequestName, FieldsToReplace, FieldDataToReplace))
     {
         try
         {
             using (WebResponse Response = reqGen.BuildGETRequest().GetResponse())
             {
                 HttpWebResponse resp1       = (HttpWebResponse)Response;
                 string          Result      = string.Empty;
                 string          replaceText = "<?xml version=\"1.0\" encoding=\"utf-16\"?>";
                 StreamReader    ReadStream  = new StreamReader(resp1.GetResponseStream());
                 string          str         = WebUtility.HtmlDecode(ReadStream.ReadToEnd());
                 str = str.Replace(replaceText, "");
                 File.WriteAllText(FilePathtoSave, str);
                 ReadStream.Close();
                 return((int)resp1.StatusCode);
             }
         }
         catch (Exception e)
         {
             new DebugLogGenerator().WriteException(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, e);
             return(0);
         }
     }
 }
        public static int HandleGetRESTRequest(string EndPoint, string RequestType, string RequestName)
        {
            try
            {
                using (RequestGenerator reqGen = new RequestGenerator(EndPoint, RequestType, RequestName))
                {
                    using (WebResponse Response = reqGen.BuildGetRestRequest().GetResponse())
                    {
                        HttpWebResponse resp1    = (HttpWebResponse)Response;
                        var             response = resp1.Headers;
                        //JObject joResponse = JObject.Parse("");
                        StreamReader ReadStream = new StreamReader(resp1.GetResponseStream());
                        string       str        = WebUtility.HtmlDecode(ReadStream.ReadToEnd());
                        JObject      joResponse = JObject.Parse(str);

                        JArray array = (JArray)joResponse[0];
                        return((int)resp1.StatusCode);
                    }
                }
            }
            catch (Exception e)
            {
                new DebugLogGenerator().WriteException(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, e);
                return(0);
            }
        }
 public static int HandleSyncRequest(string EndPoint, string RequestType, string RequestName, List <string> FieldsToReplace, List <string> FieldDataToReplace)
 {
     using (RequestGenerator reqGen = new RequestGenerator(EndPoint, RequestType, RequestName, FieldsToReplace, FieldDataToReplace))
     {
         int statusCode;
         try
         {
             using (WebResponse Response = reqGen.BuildRequest().GetResponse())
             {
                 HttpWebResponse resp1      = (HttpWebResponse)Response;
                 StreamReader    ReadStream = new StreamReader(resp1.GetResponseStream());
                 string          str        = WebUtility.HtmlDecode(ReadStream.ReadToEnd());
                 statusCode = (int)resp1.StatusCode;
                 resp1.Dispose();
                 Response.Dispose();
                 return(statusCode);
             }
         }
         catch (Exception e)
         {
             new DebugLogGenerator().WriteException(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, e);
             return(0);
         }
     }
 }