Пример #1
0
        public Permit ValidateVehicle(string issueState, string plateNumber)
        {
            //
            Permit permit = null;
            PermitAdminServiceClient client = new PermitAdminServiceClient();

            try {
                permit = client.ValidateVehicle(issueState, plateNumber);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(permit);
        }
Пример #2
0
        public bool ChangeVehicle(Vehicle vehicle)
        {
            //
            bool changed = false;
            PermitAdminServiceClient client = new PermitAdminServiceClient();

            try {
                changed = client.ChangeVehicle(vehicle);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(changed);
        }
Пример #3
0
        public bool RevokePermit(Permit permit)
        {
            //
            bool revoked = false;
            PermitAdminServiceClient client = new PermitAdminServiceClient();

            try {
                revoked = client.RevokePermit(permit);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(revoked);
        }
Пример #4
0
        public int ReplacePermit(Permit permit, string newNumber)
        {
            //
            int id = 0;
            PermitAdminServiceClient client = new PermitAdminServiceClient();

            try {
                id = client.ReplacePermit(permit, newNumber);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(id);
        }
Пример #5
0
        public Permit ReadPermit(int id)
        {
            //
            Permit permit = null;
            PermitAdminServiceClient client = new PermitAdminServiceClient();

            try {
                permit = client.ReadPermit(id);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(permit);
        }
Пример #6
0
        public DataSet ViewPermits()
        {
            //
            DataSet permits = new DataSet();
            PermitAdminServiceClient client = new PermitAdminServiceClient();

            try {
                DataSet ds = client.ViewPermits();
                if (ds != null)
                {
                    permits.Merge(ds);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(permits);
        }