Exemplo n.º 1
0
        void GetVehicleStatus(CallbackParameterContainer instructionSet)
        {
            var client       = new FirstForRentalsService();
            var resultString = client.GetVehicleStatus(instructionSet.Parameters[0].ToString());

            returnObject = new CallbackReturnContainer("VehicleStatus");
            returnObject.Parameters.Add(resultString);
        }
Exemplo n.º 2
0
        void GetFaults(CallbackParameterContainer instructionSet)
        {
            var client       = new FirstForRentalsService();
            var resultString = client.GetCarFaultsOverview(int.Parse(instructionSet.Parameters[0].ToString()));

            returnObject = new CallbackReturnContainer("ReturnVehicleFaults");
            returnObject.Parameters.Add(resultString);
        }
Exemplo n.º 3
0
        //

        void GetVehicleAlerts()
        {
            var client       = new FirstForRentalsService();
            var resultString = client.GetRentalAlerts();

            returnObject = new CallbackReturnContainer("ReturnVehicleAlerts");
            returnObject.Parameters.Add(resultString);
        }
Exemplo n.º 4
0
        void AddFault(CallbackParameterContainer instructionSet)
        {
            int car;

            if (Int32.TryParse(instructionSet.Parameters[0].ToString(), out car))
            {
            }

            DateTime faultDate;

            if (DateTime.TryParse(instructionSet.Parameters[1].ToString(), out faultDate))
            {
            }

            string faultDetail = instructionSet.Parameters[2];

            decimal faultAmount = decimal.Parse(instructionSet.Parameters[3].ToString(), CultureInfo.InvariantCulture);

            bool faultServiceSuspension;

            bool.TryParse(instructionSet.Parameters[4].ToString(), out faultServiceSuspension);

            bool faultInsuranceClaim;

            bool.TryParse(instructionSet.Parameters[5].ToString(), out faultInsuranceClaim);

            string faultInsuranceClaimStatus;

            if (faultInsuranceClaim == true)
            {
                faultInsuranceClaimStatus = "Submitted";
            }
            else
            {
                faultInsuranceClaimStatus = "";
            }

            var client   = new FirstForRentalsService();
            var response = client.InsertVehicleFault(car, faultDate, faultDetail, faultAmount, faultServiceSuspension, faultInsuranceClaim, faultInsuranceClaimStatus);

            if (response)
            {
                returnObject = new CallbackReturnContainer("VehicleFaultAdded");
            }
            else
            {
            }
        }
        //

        private void AddRental(CallbackParameterContainer instructionSet)
        {
            var client     = new FirstForRentalsService();
            var collection = RentalCollection.ReturnObject(instructionSet.Parameters[0]);

            var rentailId = client.InsertRental("1", collection.RentalId, collection.StartDate, collection.EndDate, collection.StartDestination, collection.EndDestination);

            var status = client.InsertPayment(rentailId, collection.RentalDate, collection.StartDestination, collection.EndDestination, collection.RentalAmount,
                                              collection.InsuranceAmount, collection.ExtrasAmount, collection.VatAmount, collection.TotalAmount,
                                              collection.DepositAmount, collection.DepositStatus, collection.PaymentStatus);

            if (status)
            {
                returnObject = new CallbackReturnContainer("VehicleRentalAdded");
            }
        }