Exemple #1
0
        public HomePageDetail()
        {
            InitializeComponent();
            customerId = (int)Application.Current.Properties["CustomerId"];
            _token     = Application.Current.Properties["currentToken"].ToString();
            registrationDBModelRequest            = new GetReservationAgreementMobileRequest();
            registrationDBModelRequest.customerId = customerId;
            registrationDBModelResponse           = null;
            registrationDBModel                              = null;
            agreementIdMobileResponse                        = null;
            agreementIdMobileRequest                         = new GetAgreementByAgreementIdMobileRequest();
            getAgreementByCustomerIdMobileRequest            = new getAgreementByCustomerIdMobileRequest();
            getAgreementByCustomerIdMobileRequest.customerId = customerId;
            customerAgreementModels                          = null;
            lastAgreementId     = 0;
            lastAgreementStatus = null;

            reservationByIDMobileRequest = new GetReservationByIDMobileRequest();
            isreservation    = false;
            isAgreement      = false;
            agreementId      = 0;
            vehicleId        = 0;
            isAgreeRefreshed = false;


            // BooknowBtn.BackgroundColor = (Color)App.Current.Properties["MaxVonYellow"];
        }
 public ViewReservation(int reservationId)
 {
     InitializeComponent();
     this.reservationId           = reservationId;
     reservationByIDMobileRequest = new GetReservationByIDMobileRequest();
     reservationByIDMobileRequest.ReservationID = reservationId;
     customerId = (int)App.Current.Properties["CustomerId"];
     token      = App.Current.Properties["currentToken"].ToString();
     cancelReservationMobileRequest = new CancelReservationMobileRequest();
 }
Exemple #3
0
        private GetReservationByIDMobileResponse getReservationByID(GetReservationByIDMobileRequest reservationByIDMobileRequest, string token)
        {
            GetReservationByIDMobileResponse getReservationByID = null;
            RegisterController register = new RegisterController();

            try
            {
                getReservationByID = register.getReservationByID(reservationByIDMobileRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(getReservationByID);
        }
Exemple #4
0
        public GetReservationByIDMobileResponse getReservationByID(GetReservationByIDMobileRequest reservationByIDMobileRequest, string token)
        {
            GetReservationByIDMobileResponse getReservationByID = null;

            try
            {
                getReservationByID = registerservice.getReservationByID(reservationByIDMobileRequest, token);
                if (getReservationByID.reservationData.Reservationview.VehicleTypeID > 0)
                {
                    getReservationByID.vehicleTypeModel = registerservice.GetVehicleTypesWithRates(getReservationByID.reservationData.Reservationview.VehicleTypeID, token);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(getReservationByID);
        }
Exemple #5
0
        public GetReservationByIDMobileResponse getReservationByID(GetReservationByIDMobileRequest reservationByIDMobileRequest, string token)
        {
            GetReservationByIDMobileResponse resp = null;

            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "ReservationMobile/GetReservationByIDMobile");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(reservationByIDMobileRequest);
                    var buffer      = System.Text.Encoding.UTF8.GetBytes(myContent);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                    var response = client.PostAsync(client.BaseAddress, byteContent).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        resp = JsonConvert.DeserializeObject <GetReservationByIDMobileResponse>(responseStream);
                    }
                    else
                    {
                        ApiMessage mes = new ApiMessage();

                        mes.ErrorCode    = response.StatusCode.ToString();
                        mes.ErrorMessage = response.ReasonPhrase.ToString();
                        mes.Status       = response.IsSuccessStatusCode.ToString();
                        resp.message     = mes;
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(resp);
        }
Exemple #6
0
        public HomePageDetail()
        {
            InitializeComponent();
            customerId = (int)Application.Current.Properties["CustomerId"];
            _token     = Application.Current.Properties["currentToken"].ToString();
            registrationDBModelRequest            = new GetReservationAgreementMobileRequest();
            registrationDBModelRequest.customerId = customerId;
            registrationDBModelResponse           = null;
            registrationDBModel                              = null;
            agreementIdMobileResponse                        = null;
            agreementIdMobileRequest                         = new GetAgreementByAgreementIdMobileRequest();
            getAgreementByCustomerIdMobileRequest            = new getAgreementByCustomerIdMobileRequest();
            getAgreementByCustomerIdMobileRequest.customerId = customerId;
            customerAgreementModels                          = null;
            lastAgreementId     = 0;
            lastAgreementStatus = null;

            reservationByIDMobileRequest = new GetReservationByIDMobileRequest();
            isreservation           = false;
            isAgreement             = false;
            agreementId             = 0;
            vehicleId               = 0;
            isAgreeRefreshed        = false;
            estTime                 = DateTime.Now;
            request                 = new ExtendAgreementRequest();
            response                = null;
            overDueBalanceViewModel = new OverDueBalanceViewModel();

            ICommand refreshCommand = new Command(() =>
            {
                refreshView.IsRefreshing = true;
                this.OnAppearing();
                refreshView.IsRefreshing = false;
            });

            refreshView.Command = refreshCommand;

            // BooknowBtn.BackgroundColor = (Color)App.Current.Properties["MaxVonYellow"];
        }