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 GetReservationAgreementMobileResponse getMobileRegistrationDBModel(GetReservationAgreementMobileRequest registrationDBModelRequest, string token) { GetReservationAgreementMobileResponse response = null; try { response = registerservice.getMobileRegistrationDBModel(registrationDBModelRequest, token); //if(response.regDB != null) //{ // if(response.regDB.Agreements != null) // { // if (response.regDB.Agreements.Count > 0) // { // GetVehicleDetailsMobileListResponse getVehicleDetailsMobile = null; // VehicleService vehicleService = new VehicleService(); // getVehicleDetailsMobile = vehicleService.getVehicleTypesMobile(token); // AgreementService agreementService = new AgreementService(); // foreach (CustomerAgreementModel cam in response.regDB.Agreements) // { // int agreeId = cam.AgreementId; // int vehId = cam.VehicleId; // int vehicleTypeID = 0; // GetAgreementByAgreementIdMobileResponse agreementByAgreementIdMobileResponse = null; // GetAgreementByAgreementIdMobileRequest agreementIdMobileRequest = new GetAgreementByAgreementIdMobileRequest(); // agreementIdMobileRequest.agreementId = agreeId; // agreementByAgreementIdMobileResponse = agreementService.getAgreement(agreementIdMobileRequest, token); // cam.custAgreement = agreementByAgreementIdMobileResponse.custAgreement; // foreach (VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle) // { // if (vtmr.VehicleType == agreementByAgreementIdMobileResponse.custAgreement.AgreementDetail.VehicleType) // { // vehicleTypeID = vtmr.VehicleTypeId; // } // } // if (vehId > 0 && vehicleTypeID > 0) // { // cam.agreementVehicle = vehicleService.Getvehicle(vehicleTypeID, vehId, token); // } // } // } // } //} } catch (Exception ex) { throw ex; } return(response); }
private GetReservationAgreementMobileResponse getMobileRegistrationDBModel(GetReservationAgreementMobileRequest registrationDBModelRequest, string token) { GetReservationAgreementMobileResponse response = null; try { RegisterController registerController = new RegisterController(); response = registerController.getMobileRegistrationDBModel(registrationDBModelRequest, token); } catch (Exception ex) { throw ex; } return(response); }
public GetReservationAgreementMobileResponse getMobileRegistrationDBModel(GetReservationAgreementMobileRequest registrationDBModelRequest, string token) { GetReservationAgreementMobileResponse resp = null; try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "AgreementMobile/getRegistrationDBModel"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(registrationDBModelRequest); 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 <GetReservationAgreementMobileResponse>(responseStream); } else { ApiMessage mes = new ApiMessage(); resp = new GetReservationAgreementMobileResponse(); 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); }
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"]; }