Esempio n. 1
0
        public static CRMDataset GetIssues()
        {
            //Get issues
            CRMDataset       issues = new CRMDataset();
            CRMServiceClient client = null;

            try {
                if (_Cache == null)
                {
                    _Cache = new IssueCache(DateTime.Today.AddDays(-App.Config.IssueDaysBack));
                }
                client = new CRMServiceClient();
                DataSet ds = client.GetIssuesForDate(_Cache.LastUpdated);
                client.Close();
                System.Diagnostics.Debug.WriteLine("PAYLOAD: fromDate=" + _Cache.LastUpdated.ToString("MM/dd/yyyy HH:mm:ss") + "; bytes=" + ds.GetXml().Length);

                CRMDataset _issues = new CRMDataset();
                if (ds.Tables["IssueTable"] != null && ds.Tables["IssueTable"].Rows.Count > 0)
                {
                    _issues.Merge(ds);
                    _Cache.UpdateCache(_issues);
                    issues.Merge(_Cache.Issues);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <CustomersFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(issues);
        }
Esempio n. 2
0
 public static void ResetCache()
 {
     _Cache = null;
 }