Esempio n. 1
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetServiceAuthorisationRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetServiceAuthorisationRequest> CustomSetServiceAuthorisationRequestSerializer = null,
                              CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetServiceAuthorisationRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("EVSEIdType", EVSEId.Format.AsText()),
                                   new XElement("EVSEId", EVSEId.ToString()),

                                   new XElement("userIdType", UserId.Format.AsText()),
                                   new XElement("userId", UserId.ToString()),

                                   new XElement("requestedServiceId", RequestedServiceId.ToString()),
                                   new XElement("authorisationValue", AuthorisationValue.ToString()),
                                   new XElement("intermediateCDRRequested", IntermediateCDRRequested ? "1" : "0"),

                                   PartnerServiceSessionId.HasValue
                              ? new XElement("serviceSessionId", PartnerServiceSessionId.ToString())
                              : null,

                                   UserContractIdAlias.HasValue
                              ? new XElement("userContractIdAlias", UserContractIdAlias.ToString())
                              : null,

                                   MeterLimits.SafeAny()
                              ? new XElement("meterLimitList", MeterLimits.Select(meterreport => meterreport.ToXML(CustomMeterReportSerializer: CustomMeterReportSerializer)))
                              : null,

                                   Parameter.IsNotNullOrEmpty()
                              ? new XElement("parameter", Parameter)
                              : null,

                                   BookingId.HasValue
                              ? new XElement("bookingId", BookingId.ToString())
                              : null,

                                   SalePartnerBookingId.HasValue
                              ? new XElement("salePartnerBookingId", SalePartnerBookingId.ToString())
                              : null

                                   );


            return(CustomSetServiceAuthorisationRequestSerializer != null
                       ? CustomSetServiceAuthorisationRequestSerializer(this, XML)
                       : XML);
        }
Esempio n. 2
0
 public string[] ToArray()
 {
     return(new string[]
     {
         BookingId.ToString(),
         RegistrationNumber,
         VehicleType,
         Customer,
         Cost.ToString(),
         Rented.ToString(),
         Returned == DateTime.MinValue ?
         String.Empty : Returned.ToString()
     });
 }
Esempio n. 3
0
 public string[] ToArray()
 {
     return(new string[]
     {
         Customer,
         Title,
         Genre,
         Rented.ToString(),
         Returned == DateTime.MinValue ? String.Empty : Returned.ToString(),
         Cost.ToString(),
         BookingId.ToString(),
         CustomerId.ToString()
     });
 }
Esempio n. 4
0
        private async void GotoParkingReserved()
        {
            Mvx.Resolve <IMvxMessenger>().Publish(
                new AlertMessage(this, "Confirm", string.Format("Your payment card will be charged {0} €", string.Format("{0:0.0}", Cost)), "Cancel", () => { }, new string[] { "OK" },
                                 async() =>
            {
                if (BaseView != null && BaseView.CheckInternetConnection())
                {
                    Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this, true));

                    var result1 = await mApiService.CreateBooking(Mvx.Resolve <ICacheService>().CurrentUser.UserId, ParkingId.ToString(), StartTimeStamp, EndTimeStamp, Vehicle.PlateNumber);
                    if (result1 != null && result1.Response != null)
                    {
                        // Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Result + "\n" + result.Response.BookingId));
                        //Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Result.Equals("success") ? result.Response.Result : string.Format("{0}: {1}", result.Response.Result, result.Response.ErrorCode)));
                        if (result1.Response.Status.Equals("success"))
                        {
                            BookingId  = long.Parse(result1.Response.BookingId);
                            var result = await mApiService.PayBooking(mCacheService.CurrentUser.UserId, ParkingId.ToString(), result1.Response.BookingId);

                            if (result != null)
                            {
                                //Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, result.Result + "\nRemaining credits : " + result.RemainingCredits));
                                //Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Result.Equals("success") ? "Success" : "Error"));
                                if (result.Response != null && result.Response.Status.Equals("success"))
                                {
                                    Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Status));

                                    NeedRelease = true;

                                    if (mCacheService.SearchMode == SearchMode.Now)
                                    {
                                        //TODO : mCacheService.CurrentReservation = ??????

                                        Parking parking = new Parking()
                                        {
                                            ParkingId = ParkingId.ToString(),
                                            Location  = result.Response.Location,
                                            Latitude  = result.Response.Latitude,
                                            Longitude = result.Response.Longitude
                                        };

                                        Reservation reservation = new Reservation()
                                        {
                                            BookingId      = BookingId.ToString(),
                                            Cost           = Cost.ToString(),
                                            StartTimestamp = StartTimeStamp.ToString(),
                                            EndTimestamp   = EndTimeStamp.ToString(),
                                            Parking        = parking,
                                            PlateNumber    = Vehicle.PlateNumber,
                                            VehicleType    = Vehicle.Type,
                                        };
                                        mCacheService.CurrentReservation = reservation;
                                        //mCacheService.CurrentUser.RemainingCredits = (double.Parse(mCacheService.CurrentUser.RemainingCredits, CultureInfo.InvariantCulture) - Cost).ToString();
                                        //mCacheService.CurrentUser.RemainingCredits = result.Response.RemainingCredits;
                                        ShowViewModel <ParkingReservedViewModel>(new { status = ParkingStatus.Rented });
                                    }
                                    else
                                    {
                                        ShowViewModel <MenuViewModel>(presentationFlag: PresentationBundleFlagKeys.Menu);
                                    }
                                }
                                else if (result.ApiError.Error != null && result.ApiError.Error.Equals("cardTrouble"))
                                {
                                    Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, "Please add a credit card in the Wallet section!"));
                                }
                                else
                                {
                                    Mvx.Resolve <IMvxMessenger>().Publish(new AlertMessage(this, string.Empty, string.Format("{0}: {1}", result.Response.Status, result.Response.ErrorCode), "Ok", null));
                                }
                            }
                            else
                            {
                                //Close(this);
                                Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, "Error occur!"));
                            }
                        }
                        else
                        {
                            Mvx.Resolve <IMvxMessenger>().Publish(new AlertMessage(this, string.Empty, string.Format("{0}: {1}", result1.Response.Status, result1.Response.ErrorCode), "Ok", null));
                        }
                    }
                    Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this, false));
                }
                else
                {
                    Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, SharedTextSource.GetText("TurnOnInternetText")));
                }
            }));
        }