Example #1
0
        public bool CanLoadPickups(DateTime pickupDate, string routeClass)
        {
            bool ret = false;

            try {
                if (DateTime.Compare(pickupDate, DateTime.Today) <= 0)
                {
                    Pickups pickups = GetPickups(pickupDate, routeClass);
                    ret = pickups.Count == 0;
                }
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error when validating pickup loading.", ex))); }
            return(ret);
        }
Example #2
0
        public static bool UpdatePickups(Pickups pickups)
        {
            //
            bool ret = false;

            try {
                _Client = new RoadshowServiceClient();
                ret     = _Client.UpdatePickups(pickups);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("UpdatePickups() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("UpdatePickups() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("UpdatePickups() communication error.", ce); }
            return(ret);
        }
Example #3
0
        public static Pickups GetPickups(DateTime pickupDate, string routeClass)
        {
            //
            Pickups pickups = null;

            try {
                _Client = new RoadshowServiceClient();
                pickups = _Client.GetPickups(pickupDate, routeClass);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetPickups() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetPickups() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetPickups() communication error.", ce); }
            return(pickups);
        }
Example #4
0
        public bool UpdatePickups(Pickups pickups)
        {
            //
            bool ret = false;

            try {
                for (int i = 0; i < pickups.Count; i++)
                {
                    UpdatePickup(pickups[i]);
                }
                ret = true;
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error updating pickups.", ex))); }
            return(ret);
        }
Example #5
0
        public Pickups GetPickups(DateTime pickupDate, string routeClass)
        {
            //
            Pickups pickups = null;

            try {
                pickups = new Pickups();
                DataSet ds = fillDataset(USP_PICKUPS, TBL_PICKUPS, new object[] { pickupDate, routeClass });
                if (ds != null)
                {
                    RoadshowDS _pickups = new RoadshowDS();
                    _pickups.PickupTable.Merge(ds.Tables[TBL_PICKUPS]);
                    for (int i = 0; i < _pickups.PickupTable.Rows.Count; i++)
                    {
                        pickups.Add(new Pickup(_pickups.PickupTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error while reading pickups.", ex))); }
            return(pickups);
        }