private static void SendQueuedDistributions(string[] args) { // get company name string companyNameShort = null; foreach (string s in args) { if (s.ToUpper().StartsWith("/N")) { companyNameShort = s.Substring(2); break; } } // do stuff DistributionService.DistributionService distributionService = new DistributionService.DistributionService(); distributionService.Url = AppConfig.ReadSetting("DistributionServiceURL", ""); distributionService.Timeout = int.Parse(AppConfig.ReadSetting("DistributionServiceTimeout", "600000")); string user = AppConfig.ReadSetting("DistributionServiceUser", ""); string password = AppConfig.ReadSetting("DistributionServicePassword", ""); if (user != "") { distributionService.Credentials = new System.Net.NetworkCredential(user, password); } else { distributionService.Credentials = System.Net.CredentialCache.DefaultCredentials; } distributionService.AsyncSendQueuedDistributions(companyNameShort); }
private static void SendTodaysDistributions(string[] args) { // get company name string companyNameShort = GetArgumentByTag("N:", args); if (companyNameShort == null) { return; } // do stuff DistributionService.DistributionService distributionService = new DistributionService.DistributionService(); distributionService.Url = AppConfig.ReadSetting("DistributionServiceURL", ""); distributionService.Timeout = int.Parse(AppConfig.ReadSetting("DistributionServiceTimeout", "600000")); string user = AppConfig.ReadSetting("DistributionServiceUser", ""); string password = AppConfig.ReadSetting("DistributionServicePassword", ""); if (user != "") { distributionService.Credentials = new System.Net.NetworkCredential(user, password); } else { distributionService.Credentials = System.Net.CredentialCache.DefaultCredentials; } distributionService.EnqueueScheduledDistributions(companyNameShort); distributionService.AsyncSendQueuedDistributions(companyNameShort); }
private static void ProcessBackgroundJobs(string[] args) { // get company name string companyNameShort = GetArgumentByTag("N:", args); if (companyNameShort == null) { return; } // do stuff DistributionService.DistributionService distributionService = new DistributionService.DistributionService(); distributionService.Url = FI.Common.AppConfig.ReadSetting("DistributionServiceURL", ""); distributionService.Timeout = int.Parse(FI.Common.AppConfig.ReadSetting("DistributionServiceTimeout", "600000")); string user = FI.Common.AppConfig.ReadSetting("DistributionServiceUser", ""); string password = FI.Common.AppConfig.ReadSetting("DistributionServicePassword", ""); if (user != "") { distributionService.Credentials = new System.Net.NetworkCredential(user, password); } else { distributionService.Credentials = System.Net.CredentialCache.DefaultCredentials; } _callStart = DateTime.Now; _callCommand = "ProcessBackgroundJobsAsync"; distributionService.ProcessBackgroundJobsAsync(companyNameShort); distributionService.ProcessBackgroundJobsCompleted += new DistributionService.ProcessBackgroundJobsCompletedEventHandler(distributionService_AsyncCallCompleted); if (_toLog) { FI.Common.LogWriter.Instance.WriteEventLogEntry(_callCommand + " start. Company=" + companyNameShort); } while ((DateTime.Now - _callStart) < _callStopWait) { System.Threading.Thread.Sleep(1000); } distributionService.Dispose(); //distributionService.Dispose(); }
private static void SendTodaysDistributions(string[] args) { // get company name string companyNameShort = GetArgumentByTag("N:", args); if (companyNameShort == null) return; // do stuff DistributionService.DistributionService distributionService=new DistributionService.DistributionService(); distributionService.Url = FI.Common.AppConfig.ReadSetting("DistributionServiceURL", ""); distributionService.Timeout = int.Parse(FI.Common.AppConfig.ReadSetting("DistributionServiceTimeout", "600000")); string user = FI.Common.AppConfig.ReadSetting("DistributionServiceUser", ""); string password = FI.Common.AppConfig.ReadSetting("DistributionServicePassword", ""); if(user!="") distributionService.Credentials=new System.Net.NetworkCredential(user, password); else distributionService.Credentials=System.Net.CredentialCache.DefaultCredentials; _callStart = DateTime.Now; _callCommand = "ProcessDistributionJobsAsync"; distributionService.ProcessDistributionJobsAsync(companyNameShort); distributionService.ProcessDistributionJobsCompleted += new DistributionService.ProcessDistributionJobsCompletedEventHandler(distributionService_AsyncCallCompleted); if (_toLog) FI.Common.LogWriter.Instance.WriteEventLogEntry(_callCommand + " start. Company=" + companyNameShort); while ((DateTime.Now - _callStart) < _callStopWait) System.Threading.Thread.Sleep(1000); distributionService.Dispose(); }