private void HandleGetCallback(CallbackParameterContainer instructionSet)
 {
     switch (instructionSet.ActionRequested)
     {
         //case "GetFaults":
         //    GetFaults(instructionSet);
         //    break;
     }
 }
        //
        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");
            }
        }
        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 HandlePostCallback(CallbackParameterContainer instructionSet)
 {
     switch (instructionSet.ActionRequested)
     {
         case "AddRental":
             AddRental(instructionSet);
             break;
     }
 }
 private void HandleGetCallback(CallbackParameterContainer instructionSet)
 {
     switch (instructionSet.ActionRequested)
     {
         case "GetFaults":
             GetFaults(instructionSet);
             break;
         case "GetVehicleStatus":
             GetVehicleStatus(instructionSet);
             break;
         case "GetVehicleAlerts":
             GetVehicleAlerts();
             break;
     }
 }
        void GetVehicleStatus(CallbackParameterContainer instructionSet)
        {
            var client = new FirstForRentalsService();
            var resultString = client.GetVehicleStatus(instructionSet.Parameters[0].ToString());

            returnObject = new CallbackReturnContainer("VehicleStatus");
            returnObject.Parameters.Add(resultString);
        }
        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);
        }