Beispiel #1
0
 public static void AffectGPSInfosParamsToPostRequest(ObWsRequest obWsRequest, ref NameValueCollection nvc)
 {
     if (obWsRequest.GPSInfos != null)
     {
         if (nvc == null)
         {
             nvc = new NameValueCollection();
         }
         nvc.Add("lat", obWsRequest.GPSInfos.Lat);
         nvc.Add("lng", obWsRequest.GPSInfos.Lng);
     }
 }
Beispiel #2
0
        public static ObWsRequest LoadParameterSetting(string strServer      = null, string strLogin      = null, string strPwd = null, string strPort = null, bool blSsl = false,
                                                       string strServerProxy = null, string strLoginProxy = null, string strPwdProxy = null, string strPortProxy = null,
                                                       string strToken       = null, string strLat = null, string strLng = null)
        {
            if (!string.IsNullOrWhiteSpace(strToken))
            {
                _obWsRequest = new ObWsRequest(strToken, strServer,
                                               strPort, false, null, 500000, new GPSInfos(strLat, strLng));
            }
            else
            {
                _obWsRequest = new ObWsRequest(strLogin, strPwd, strServer,
                                               strPort, blSsl, _proxy, 50000, new GPSInfos(strLat, strLng));
            }

            return(_obWsRequest);
        }
Beispiel #3
0
        public static void DownloadDocuments()
        {
            _rootDonwloadFolderPath = ConfigurationManager.AppSettings["DOCFOLDER"];
            _updateMetadata         = Convert.ToBoolean(ConfigurationManager.AppSettings["UPDATEMETADATA"]);
            _downloadMetadata       = Convert.ToBoolean(ConfigurationManager.AppSettings["DOWNLOADMETADATA"]);
            _downloadDocument       = Convert.ToBoolean(ConfigurationManager.AppSettings["DOWNLOADDOCUMENT"]);

            _proxy = Utility.CreatProxy();
            _ssl   = Convert.ToBoolean(ConfigurationManager.AppSettings["SSL"]);
            string foldersConfigurationPath = ConfigurationManager.AppSettings["FOLDERSCONFIGURATIONPATH"];
            string strLog = string.Empty;

            _obWsRequest = Utility.LoadParameterSetting(ConfigurationManager.AppSettings["ADDRESS"], ConfigurationManager.AppSettings["USERNAME"], ConfigurationManager.AppSettings["PASSWORD"], ConfigurationManager.AppSettings["PORT"], _ssl);


            using (StreamReader fStream = new StreamReader(foldersConfigurationPath))
            {
                JObject foldersConfigFile = JObject.Parse(fStream.ReadToEnd());

                string folderID = string.Empty;
                bool   download = false;

                foreach (var folder in foldersConfigFile["folders"])
                {
                    folderID = folder["folderID"] != null ? folder["folderID"].ToString() : string.Empty;
                    download = folder["download"] != null?Convert.ToBoolean(folder["download"].ToString()) : false;

                    if (download)
                    {
                        GetFolders(folderID);

                        strLog = string.Format("Have been downloaded {0} documents in {1} folders ", totalDocumentsDownloaded, totalFolders);
                        Utility.LogToHistory(strLog, "Information");

                        GC.Collect();
                    }

                    GC.Collect();
                }
            }
        }
Beispiel #4
0
        public static void AffectGPSInfosParamsToGetRequest(ObWsRequest obWsRequest, ref string url)
        {
            if (obWsRequest.GPSInfos != null)
            {
                bool changed        = false;
                bool isConcatinated = false;
                if (url.EndsWith("/"))
                {
                    url     = url.Remove(url.LastIndexOf('/'));
                    changed = true;
                }

                if (!string.IsNullOrEmpty(obWsRequest.GPSInfos.Lat) && !string.IsNullOrEmpty(obWsRequest.GPSInfos.Lng))
                {
                    url           += "?lat=" + obWsRequest.GPSInfos.Lat + "^&lng=" + obWsRequest.GPSInfos.Lng;
                    isConcatinated = true;
                }
                else
                {
                    if (!string.IsNullOrEmpty(obWsRequest.GPSInfos.Lng))
                    {
                        url           += "?lng=" + obWsRequest.GPSInfos.Lng;
                        isConcatinated = true;
                    }
                    if (!string.IsNullOrEmpty(obWsRequest.GPSInfos.Lat))
                    {
                        url           += "?lat=" + obWsRequest.GPSInfos.Lat;
                        isConcatinated = true;
                    }
                }
                if (changed && !isConcatinated)
                {
                    url += "/";
                }
            }
        }