public VehicleRates(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle) { InitializeComponent(); this.reservationView = reservationView; //misChargeFilter = new MisChargeFilter(); misChargeRequest = new GetMischargeSearchDetailsMobileRequest(); //taxFilter = new TaxFilter(); taxRequest = new GetTaxMobileListRequest(); promotionMobileRequest = new GetPromotionMobileRequest(); //misChargeFilter.LocationId =(int) reservationView.StartLocationId; //misChargeFilter.VehicleTypeId =(int) reservationView.VehicleTypeID; misChargeRequest.LocationId = (int)reservationView.StartLocationId; misChargeRequest.VehicleTypeId = (int)reservationView.VehicleTypeID; //taxFilter.LocationId = (int)reservationView.StartLocationId; taxRequest.LocationId = (int)reservationView.StartLocationId; promotionMobileResponse = null; misChargeResults = null; misChargeResponse = null; taxResults = null; taxResponse = null; reservationController = new ReservationController(); token = App.Current.Properties["currentToken"].ToString(); this.selectedVehicle = selectedVehicle; startDateLabel.Text = ((DateTime)reservationView.StartDate).ToString("ddd MM/dd/yyyy"); endDateLabel.Text = ((DateTime)reservationView.EndDate).ToString("ddd MM/dd/yyyy"); startTimeLabel.Text = ((DateTime)reservationView.StartDate).ToString("hh:mm tt"); endTimeLabel.Text = ((DateTime)reservationView.EndDate).ToString("hh:mm tt"); if (selectedVehicle.VehicleTypeImageUrl != null) { vehilcleTypeImage.Source = ImageSource.FromUri(new Uri(selectedVehicle.VehicleTypeImageUrl)); } vehicleSampleLabel.Text = selectedVehicle.sample; vehilcleTypeLabel.Text = selectedVehicle.VehicleType; priceLabel.Text = "$ " + selectedVehicle.RateDetail.RateTotal.ToString(); }
public GetTaxMobileListResponse GetTaxMobileList(GetTaxMobileListRequest taxRequest, string token) { GetTaxMobileListResponse result = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "TaxMobile/GetSearchTaxMobile"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(taxRequest); var buffer = 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; result = JsonConvert.DeserializeObject <GetTaxMobileListResponse>(responseStream); } } } catch (Exception ex) { throw ex; } return(result); }
public GetTaxMobileListResponse GetTaxMobileList(GetTaxMobileListRequest taxRequest, string token) { GetTaxMobileListResponse mobileResponse = null; try { mobileResponse = reservationservice.GetTaxMobileList(taxRequest, token); } catch (Exception ex) { throw ex; } return(mobileResponse); }
public EditVehicleRates(ReservationView reservationView, ReservationViewModel reservationData) { InitializeComponent(); this.reservationView = reservationView; //misChargeFilter = new MisChargeFilter(); misChargeRequest = new GetMischargeSearchDetailsMobileRequest(); //taxFilter = new TaxFilter(); taxRequest = new GetTaxMobileListRequest(); promotionMobileRequest = new GetPromotionMobileRequest(); //misChargeFilter.LocationId =(int) reservationView.StartLocationId; //misChargeFilter.VehicleTypeId =(int) reservationView.VehicleTypeID; misChargeRequest.LocationId = (int)reservationView.StartLocationId; misChargeRequest.VehicleTypeId = (int)reservationView.VehicleTypeID; //taxFilter.LocationId = (int)reservationView.StartLocationId; taxRequest.LocationId = (int)reservationView.StartLocationId; promotionMobileResponse = null; misChargeResults = null; misChargeResponse = null; taxResults = null; taxResponse = null; reservationController = new ReservationController(); token = App.Current.Properties["currentToken"].ToString(); this.reservationData = reservationData; }
protected override async void OnAppearing() { base.OnAppearing(); var assembly = typeof(VehicleRates); //if ((int)App.Current.Properties["CustomerId"] == 0) //{ // loginIcon.IconImageSource = ImageSource.FromResource("NativeCamperVans.Assets.LogInTool.png", assembly); //} //else //{ // loginIcon.IconImageSource = ImageSource.FromResource("NativeCamperVans.Assets.logOutTool.png", assembly); //} if (PopupNavigation.Instance.PopupStack.Count > 0) { //if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup)) //{ await PopupNavigation.Instance.PopAllAsync(); //} } bool busy = false; if (!busy) { try { busy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("Getting vehicles rates...")); await Task.Run(() => { try { //misChargeResults = reservationController.getMisCharge(misChargeFilter,token); misChargeResponse = reservationController.getMisChargeMobile(misChargeRequest, token); //taxResults = reservationController.getTax(taxFilter,token); taxResponse = reservationController.GetTaxMobileList(taxRequest, token); } catch (Exception ex) { PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message)); } }); } finally { busy = false; if (PopupNavigation.Instance.PopupStack.Count == 1) { await PopupNavigation.Instance.PopAllAsync(); } if (PopupNavigation.Instance.PopupStack.Count > 1) { if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup)) { await PopupNavigation.Instance.PopAllAsync(); } } if (taxResponse.message.ErrorCode == "200") { taxResults = taxResponse.LocationTaxResult; foreach (LocationTaxModel t in taxResults) { if (t.IsOption) { t.IsSelected = false; if (reservationView.TaxList2 != null) { if (reservationView.TaxList2.Count > 0) { foreach (LocationTaxModel ltm in reservationView.TaxList2) { if (ltm.TaxId == t.TaxId) { t.IsSelected = true; } } } } } else { t.IsSelected = true; } } } ; if (taxResponse.message.ErrorCode != "200") { await PopupNavigation.Instance.PushAsync(new Error_popup(taxResponse.message.ErrorMessage)); } ; if (misChargeResponse.message.ErrorCode == "200") { misChargeResults = misChargeResponse.MischargeResultList; misChargeResultsSelectable = new List <MiscChargeSearchReview>(); misChargeResultsNonSelectable = new List <MiscChargeSearchReview>(); misChargeResultsSelectableDeducible = new List <MiscChargeSearchReview>(); misChargeResultsSelectableDeducibleThree = new List <MiscChargeSearchReview>(); misChargeResultsSelectableDeducibleFour = new List <MiscChargeSearchReview>(); misChargeResultsSelectableDeducibleFive = new List <MiscChargeSearchReview>(); if (misChargeResults != null) { foreach (MiscChargeSearchReview m in misChargeResults) { switch (m.CalculationType) { case "Perday": if (m.IsDeductible) { m.ViewString = "( " + m.CalculationType + " ) "; m.price = (decimal)m.Value * (decimal)selectedVehicle.RateDetail.TotalDays; break; } else { m.ViewString = "( " + m.CalculationType + " $" + m.Value + " ) x " + selectedVehicle.RateDetail.TotalDays; m.price = (decimal)m.Value * (decimal)selectedVehicle.RateDetail.TotalDays; break; } case "Fixed": if (m.IsDeductible) { m.ViewString = "( " + m.CalculationType + " )"; m.price = m.Value; break; } else { m.ViewString = "( " + m.CalculationType + " $" + m.Value + " )"; m.price = m.Value; break; } } //if (m.IsQuantity) { m.price=(decimal)m.Value *(decimal)m.Unit; } //else //{ // m.price=m.Value; //} if (!m.IsOptional) { m.IsSelected = false; if (reservationView.MiscList2 != null) { if (reservationView.MiscList2.Count > 0) { foreach (MiscChargeSearchReview msv in reservationView.MiscList2) { if (msv.MiscChargeID == m.MiscChargeID) { m.IsSelected = true; } } } } if (m.IsDeductible) { if (m.MisChargeOptionList.Count == 2) { misChargeResultsSelectableDeducible.Add(m); } if (m.MisChargeOptionList.Count == 3) { misChargeResultsSelectableDeducibleThree.Add(m); } if (m.MisChargeOptionList.Count == 4) { misChargeResultsSelectableDeducibleFour.Add(m); } if (m.MisChargeOptionList.Count == 5) { misChargeResultsSelectableDeducibleFive.Add(m); } if (selectedDeductibleMiscValues.ContainsKey(m.MiscChargeID)) { foreach (MisChargeOption mscp in m.MisChargeOptionList) { if (mscp.Value.ToString() == selectedDeductibleMiscValues[m.MiscChargeID]) { mscp.IsSelect = true; } } } } else { misChargeResultsSelectable.Add(m); } } else { m.IsSelected = true; if (m.IsDeductible) { if (m.MisChargeOptionList.Count == 2) { misChargeResultsSelectableDeducible.Add(m); } if (m.MisChargeOptionList.Count == 3) { misChargeResultsSelectableDeducibleThree.Add(m); } if (m.MisChargeOptionList.Count == 4) { misChargeResultsSelectableDeducibleFour.Add(m); } if (m.MisChargeOptionList.Count == 5) { misChargeResultsSelectableDeducibleFive.Add(m); } if (selectedDeductibleMiscValues.ContainsKey(m.MiscChargeID)) { foreach (MisChargeOption mscp in m.MisChargeOptionList) { if (mscp.Value.ToString() == selectedDeductibleMiscValues[m.MiscChargeID]) { mscp.IsSelect = true; } } } } else { misChargeResultsNonSelectable.Add(m); } } } } } ; if (misChargeResponse.message.ErrorCode != "200") { await PopupNavigation.Instance.PushAsync(new Error_popup(misChargeResponse.message.ErrorMessage)); } ; if (misChargeResultsNonSelectable.Count() > 0) { RateList.ItemsSource = misChargeResultsNonSelectable; RateList.HeightRequest = misChargeResultsNonSelectable.Count() * 65; } if (misChargeResultsNonSelectable.Count() == 0) { RateList.IsVisible = false; } if (misChargeResultsSelectable.Count() > 0) { RateListSelectLabel.ItemsSource = misChargeResultsSelectable; RateListSelectLabel.HeightRequest = misChargeResultsSelectable.Count() * 80; } if (misChargeResultsSelectable.Count() == 0) { RateListSelectLabel.IsVisible = false; } if (taxResults.Count() > 0) { taxList.ItemsSource = taxResults; taxList.HeightRequest = taxResults.Count() * 65; } if (taxResults.Count() == 0) { taxList.IsVisible = false; taxHeadingLabel.IsVisible = false; } if (misChargeResultsSelectableDeducible.Count() > 0) { RateListSelectLabelDeducible.ItemsSource = misChargeResultsSelectableDeducible; RateListSelectLabelDeducible.HeightRequest = misChargeResultsSelectableDeducible.Count * 140; } if (misChargeResultsSelectableDeducible.Count() == 0) { RateListSelectLabelDeducible.IsVisible = false; } if (misChargeResultsSelectableDeducibleThree.Count() > 0) { RateListSelectLabelDeducibleThree.ItemsSource = misChargeResultsSelectableDeducibleThree; RateListSelectLabelDeducibleThree.HeightRequest = misChargeResultsSelectableDeducibleThree.Count * 140; } if (misChargeResultsSelectableDeducibleThree.Count() == 0) { RateListSelectLabelDeducibleThree.IsVisible = false; } if (misChargeResultsSelectableDeducibleFour.Count() > 0) { RateListSelectLabelDeducibleFour.ItemsSource = misChargeResultsSelectableDeducibleFour; RateListSelectLabelDeducibleFour.HeightRequest = misChargeResultsSelectableDeducibleFour.Count * 140; } if (misChargeResultsSelectableDeducibleFour.Count() == 0) { RateListSelectLabelDeducibleFour.IsVisible = false; } if (misChargeResultsSelectableDeducibleFive.Count() > 0) { RateListSelectLabelDeducibleFive.ItemsSource = misChargeResultsSelectableDeducibleFive; RateListSelectLabelDeducibleFive.HeightRequest = misChargeResultsSelectableDeducibleFive.Count * 140; } if (misChargeResultsSelectableDeducibleFive.Count() == 0) { RateListSelectLabelDeducibleFive.IsVisible = false; } } } }
protected override async void OnAppearing() { base.OnAppearing(); var assembly = typeof(VehicleRates); if ((int)App.Current.Properties["CustomerId"] == 0) { loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.LogInTool.png", assembly); } else { loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.logOutTool.png", assembly); } if (PopupNavigation.Instance.PopupStack.Count > 0) { if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup)) { await PopupNavigation.Instance.PopAllAsync(); } } bool busy = false; if (!busy) { try { busy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("Getting vehicles rates...")); await Task.Run(() => { try { //misChargeResults = reservationController.getMisCharge(misChargeFilter,token); misChargeResponse = reservationController.getMisChargeMobile(misChargeRequest, token); //taxResults = reservationController.getTax(taxFilter,token); taxResponse = reservationController.GetTaxMobileList(taxRequest, token); } catch (Exception ex) { PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message)); } }); } finally { busy = false; if (PopupNavigation.Instance.PopupStack.Count == 1) { await PopupNavigation.Instance.PopAllAsync(); } if (PopupNavigation.Instance.PopupStack.Count > 1) { if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup)) { await PopupNavigation.Instance.PopAllAsync(); } } if (taxResponse.message.ErrorCode == "200") { taxResults = taxResponse.LocationTaxResult; foreach (LocationTaxModel t in taxResults) { if (t.IsOption) { t.IsSelected = false; if (reservationView.TaxList2 != null) { if (reservationView.TaxList2.Count > 0) { foreach (LocationTaxModel ltm in reservationView.TaxList2) { if (ltm.TaxId == t.TaxId) { t.IsSelected = true; } } } } } else { t.IsSelected = true; } } } ; if (taxResponse.message.ErrorCode != "200") { await PopupNavigation.Instance.PushAsync(new Error_popup(taxResponse.message.ErrorMessage)); } ; if (misChargeResponse.message.ErrorCode == "200") { misChargeResults = misChargeResponse.MiscResult; foreach (MischargeResultMobile m in misChargeResults) { if (!m.IsOptional) { m.isSelected = false; if (reservationView.MiscList2 != null) { if (reservationView.MiscList2.Count > 0) { foreach (MiscChargeSearchReview msv in reservationView.MiscList2) { if (msv.MiscChargeID == m.MiscChargeID) { m.isSelected = true; } } } } } else { m.isSelected = true; } } } ; if (misChargeResponse.message.ErrorCode != "200") { await PopupNavigation.Instance.PushAsync(new Error_popup(misChargeResponse.message.ErrorMessage)); } ; if (misChargeResults.Count() > 0) { RateList.ItemsSource = misChargeResults; RateList.HeightRequest = (misChargeResults.Count() * 42) + 50; } if (misChargeResults.Count() == 0) { RateList.IsVisible = false; } if (taxResults.Count() > 0) { taxList.ItemsSource = taxResults; taxList.HeightRequest = (taxResults.Count() * 42) + 50; } if (taxResults.Count() == 0) { taxList.IsVisible = false; } } } }