예제 #1
0
        private DriverCompDS readDriverRoutes()
        {
            //Get a list of all driver routes for this terminal and date range
            DriverCompDS routes = null;

            try {
                routes = new DriverCompDS();
                DataSet ds = this.mMediator.FillDataset(App.USP_DRIVERROUTES, App.TBL_DRIVERROUTES, new object[] { this.AgentNumber, this.StartDate.ToString("yyyy-MM-dd"), this.EndDate.ToString("yyyy-MM-dd") });
                ds.Tables[App.TBL_DRIVERROUTES].Columns.Add("IsNew", typeof(bool), "IsNewRoute=1");
                if (ds.Tables[App.TBL_DRIVERROUTES].Rows.Count > 0)
                {
                    routes.Merge(ds);
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading driver routes...", ex); }
            return(routes);
        }
예제 #2
0
        public static void RefreshCache()
        {
            //Refresh cached data
            try {
                _TerminalConfigs.Clear();
                DataSet ds = Mediator.FillDataset(USP_TERMCONFIG, TBL_TERMCONFIG, null);
                if (ds.Tables[TBL_TERMCONFIG].Rows.Count > 0)
                {
                    _TerminalConfigs.Merge(ds);
                }

                _DriverEquip.Clear();
                ds = Mediator.FillDataset(USP_DRIVEREQUIP, TBL_DRIVEREQUIP, null);
                if (ds.Tables[TBL_DRIVEREQUIP].Rows.Count > 0)
                {
                    _DriverEquip.Merge(ds);
                }

                _AdjustmentTypes.Clear();
                ds = Mediator.FillDataset(USP_ADJUSTTYPE, TBL_ADJUSTTYPE, null);
                if (ds.Tables[TBL_ADJUSTTYPE].Rows.Count > 0)
                {
                    _AdjustmentTypes.Merge(ds);
                }

                _LastRoutes.Clear();
                ds = Mediator.FillDataset(USP_DRIVERLASTROUTE, TBL_DRIVERLASTROUTE, null);
                if (ds.Tables[TBL_DRIVERLASTROUTE].Rows.Count > 0)
                {
                    _LastRoutes.Merge(ds);
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while caching Finance factory data.", ex); }
            finally { if (CacheChanged != null)
                      {
                          CacheChanged(null, EventArgs.Empty);
                      }
            }
        }