private void btnCancelTicket_Clicked(object sender, EventArgs e) { Logger.Clicked("btnCancelTicket"); if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Error, ProgressTime.Normal); } else if (Database.TempData.Ticket.Journeys.Any(x => x.Segments.Any(y => y.DepartureDate < DateTime.Now))) { App.ShowProgress("yolculuk tarihi geçmiş", ProgressType.Error, ProgressTime.Normal); } else { TicketPivot.SelectedIndex = 2; var dispacterTimer = new DispatcherTimer(); dispacterTimer.Tick += (c, r) => { dispacterTimer.Stop(); App.AddBackPressedEvent(BackPressed); _actionType = 2; DefaultButtons.Visibility = Visibility.Collapsed; ContinueButtons.Visibility = Visibility.Visible; TicketPassengerItem.CheckBoxesForCancel(); }; dispacterTimer.Interval = TimeSpan.FromMilliseconds(500); dispacterTimer.Start(); } }
private void TogglePanel() { var sb = new Storyboard(); var da = new DoubleAnimation() { To = 50, Duration = TimeSpan.FromMilliseconds(200) }; if (!isExpanded) { da.To = 195 + (int)((int)(AllFactories.Count() / 4) + (AllFactories.Count() % 4 != 0 ? 1 : 0)) * 65; } Storyboard.SetTarget(da, LayoutRoot); Storyboard.SetTargetProperty(da, new PropertyPath("(Grid.Height)")); sb.Children.Add(da); sb.Completed += (c, r) => { isExpanded = !isExpanded; if (isExpanded) { App.AddBackPressedEvent(BackPressedForToggle); } else { App.RemoveBackPressedEvent(BackPressedForToggle); } }; RotateControlImage(); sb.Begin(); }
private void ShowRemoveButtons() { App.AddBackPressedEvent(BackPressedForCheckBoxes); TicketListItem.ShowCheckBoxes(); SearchButtons.Visibility = Visibility.Collapsed; RemoveButtons.Visibility = Visibility.Visible; }
private void OpenSearchPanel() { App.AddBackPressedEvent(BackPressedForSearchPanel); Grid.SetColumnSpan(btnSearch, 1); btnCancel.Visibility = Visibility.Visible; SearchPanel.Visibility = Visibility.Visible; }
/*private void txtFromStation_ValueChanged(object sender, EventArgs e) * { * if (txtFromStation.Value != null && App.IsInternetAvailable) * { * var fromValue = txtFromStation.Value as Station; * var fromStation = Database.SavedData.Stations.SingleOrDefault(x => x.Name == fromValue.Name); * if (fromStation != null) * { * App.ShowProgress("varış istasyonları yükleniyor..."); * StationRequest.OnToStationsCompleted = (stations) => * { * if (stations != null) * { * txtToStation.ItemsSource = stations.ToList(); * if (Database.SavedData.BusJourney != null && Database.SavedData.BusJourney.To != null && fromValue.Name.ToString() != Database.SavedData.BusJourney.To.Name.ToString()) * txtToStation.Value = Database.SavedData.BusJourney.To; * } * App.HideProgress(); * }; * StationRequest.GetToStations(fromStation); * } * } * }*/ private void btnSearch_Click(object sender, EventArgs e) { Logger.Clicked("btnSearch"); this.Focus(); if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else if (!Database.SavedData.Stations.Any()) { App.ShowProgress("istasyonların yüklenmesini bekleyiniz", ProgressType.Warning, ProgressTime.Normal); } else if (txtFromStation.Value == null || txtToStation.Value == null || dpDepartureDate.Value == null) { App.ShowProgress("boş bıraktığınız alan(lar) var", ProgressType.Warning, ProgressTime.Normal); } else if (dpDepartureDate.Value < Convert.ToDateTime(DateTime.Now.ToShortDateString())) { App.ShowProgress("seçtiğiniz tarih bugünden geçmişte olamaz", ProgressType.Warning, ProgressTime.Normal); } else { App.AddBackPressedEvent(BackPressed); App.ShowProgress("uygun seferler aranıyor..."); btnSearch.IsActivated = false; Database.TempData.Ticket.Type = TicketType.BusJourney; Database.TempData.TicketSearch = Database.SavedData.BusSearch = new TicketSearch() { Factory = new Factory() { Id = 0 }, From = txtFromStation.Value as Station, To = txtToStation.Value as Station, DepartureDate = Convert.ToDateTime(dpDepartureDate.Value), Passengers = { new Passenger() }, Type = Database.TempData.Ticket.Type }; JourneyRequests.JourneysRequest.OnCompleted = (response) => { var journeys = response.Result; App.RemoveBackPressedEvent(BackPressed); Database.TempData.Journeys = journeys; App.HideProgress(); if (journeys == null || journeys.Count() == 0) { App.ShowProgress("aradığınız kriterlere uygun sefer bulunamadı", ProgressType.Error, ProgressTime.Normal); } else { NavigationService.Navigate(new Uri("/Pages/Bus/JourneyListPage.xaml", UriKind.RelativeOrAbsolute)); } btnSearch.IsActivated = true; }; JourneyRequests.GetJourneys(Database.TempData.TicketSearch); } }
private void btnSearch_Click(object sender, EventArgs e) { Logger.Clicked("btnSearch"); this.Focus(); if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else if (!Database.SavedData.Airports.Any()) { App.ShowProgress("havalimanlarının yüklenmesini bekleyiniz", ProgressType.Warning, ProgressTime.Normal); } else if (txtFromStation.Value == null || txtToStation.Value == null || dpDepartureDate.Value == null || (rbRoundTrip.IsChecked == true && dpReturnDate.Value == null)) { App.ShowProgress("boş bıraktığınız alan(lar) var", ProgressType.Warning, ProgressTime.Normal); } else if (dpDepartureDate.Value < Convert.ToDateTime(DateTime.Now.ToShortDateString()) || (rbRoundTrip.IsChecked == true && dpReturnDate.Value < Convert.ToDateTime(DateTime.Now.ToShortDateString()))) { App.ShowProgress("seçtiğiniz tarih bugünden geçmişte olamaz", ProgressType.Warning, ProgressTime.Normal); } else if (rbRoundTrip.IsChecked == true && dpDepartureDate.Value > dpReturnDate.Value) { App.ShowProgress("dönüş tarihi gidiş tarihinden önce olamaz", ProgressType.Warning, ProgressTime.Normal); } else { App.AddBackPressedEvent(BackPressed); Database.TempData.TicketSearch.From = txtFromStation.Value as Station; Database.TempData.TicketSearch.To = txtToStation.Value as Station; Database.TempData.TicketSearch.DepartureDate = Convert.ToDateTime(dpDepartureDate.Value); Database.TempData.TicketSearch.ReturnDate = Convert.ToDateTime(dpReturnDate.Value); Database.TempData.TicketSearch.Type = Database.TempData.Ticket.Type; App.ShowProgress("uygun seferler aranıyor..."); btnSearch.IsActivated = false; Database.SavedData.AirplaneSearch = Database.TempData.TicketSearch; JourneyRequests.JourneysRequest.OnCompleted = (response) => { var flights = response.Result; App.RemoveBackPressedEvent(BackPressed); Database.TempData.Journeys = flights; App.HideProgress(); if (flights == null || flights.Count() == 0) { App.ShowProgress("aradığınız kriterlere uygun sefer bulunamadı", ProgressType.Error, ProgressTime.Normal); } else { NavigationService.Navigate(new Uri("/Pages/Airplane/JourneyListPage.xaml", UriKind.RelativeOrAbsolute)); } btnSearch.IsActivated = true; }; JourneyRequests.GetJourneys(Database.TempData.TicketSearch); } }
public static void UpdateTicket(PNR pnr, NavigationService navigation) { Logger.MethodCalled("Functions.UpdateTicket(PNR, NavigationService)", new object[] { pnr }); if (!App.IsInternetAvailable) { var savedTicket = Database.SavedData.Tickets.SingleOrDefault(x => x.PNR.Code == pnr.Code); if (savedTicket == null) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else { App.ShowProgress("güncel bilgiler yüklenemedi", ProgressType.Error, ProgressTime.Normal); App.ShowProgress("kayıtlı bilgiler yükleniyor", ProgressType.Warning, ProgressTime.Normal); Database.TempData.Ticket = savedTicket; var timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(2000); timer.Tick += (c, r) => { timer.Stop(); App.HideProgress(); navigation.Navigate(new Uri("/Pages/TicketAction/DetailsPage.xaml", UriKind.RelativeOrAbsolute)); }; timer.Start(); } } else { App.ShowProgress("bilet güncelleniyor..."); App.AddBackPressedEvent(_ticketUpdateBackPressed); TicketRequests.TicketRequest.OnCompleted = (response) => { var ticket = response.Result; Database.TempData.Ticket = ticket; App.RemoveBackPressedEvent(_ticketUpdateBackPressed); App.HideProgress(); if (ticket == null) { App.ShowProgress("bilet bulunamadı", ProgressType.Error, ProgressTime.Normal); } else { Database.UpdateTicket(ticket); navigation.Navigate(new Uri("/Pages/TicketAction/DetailsPage.xaml", UriKind.RelativeOrAbsolute)); } }; TicketRequests.GetTicket(pnr); } }
private void btnSearch_Clicked(object sender, EventArgs e) { if (SearchPanel.Visibility == Visibility.Collapsed) { OpenSearchPanel(); } else { if (string.IsNullOrEmpty(txtPNR.Value) || string.IsNullOrEmpty(txtParameter.Value)) { App.ShowProgress("boş bıraktığınız alan(lar) var", ProgressType.Warning, ProgressTime.Normal); } else if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else { btnSearch.IsActivated = false; btnCancel.IsActivated = false; App.AddBackPressedEvent(BackPressedForSearch); App.ShowProgress("bilet aranıyor..."); TicketRequests.TicketRequest.OnCompleted = (response) => { var ticket = response.Result; Database.TempData.Ticket = ticket; App.HideProgress(); btnSearch.IsActivated = true; btnCancel.IsActivated = true; App.RemoveBackPressedEvent(BackPressedForSearchPanel); if (response.Status != ResponseStatus.Successful) { App.ShowProgress("bu bilgilere ait bilet bulunamadı", ProgressType.Error, ProgressTime.Normal); } else { CloseSearchPanel(); Database.AddTicket(ticket); NavigationService.Navigate(new Uri("/Pages/TicketAction/DetailsPage.xaml", UriKind.RelativeOrAbsolute)); } }; TicketRequests.GetTicket(Database.TempData.PNR); } } }
private void NextDay_Tap(object sender, EventArgs e) { Logger.Clicked("NextDay"); App.AddBackPressedEvent(BackPressedForDayChanging); if (JourneyRequests.JourneysRequest.IsCompleted) { App.ShowProgress("sonraki gün yükleniyor..."); if (IsReturn) { Database.TempData.TicketSearch.ReturnDate = Database.TempData.TicketSearch.ReturnDate.AddDays(+1); } else { Database.TempData.TicketSearch.DepartureDate = Database.TempData.TicketSearch.DepartureDate.AddDays(+1); } JourneyRequests.JourneysRequest.OnCompleted += Journeys_Completed; JourneyRequests.GetJourneys(Database.TempData.TicketSearch); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); App.SetTitle("Yolcu Seçimi"); if (NavigationContext.QueryString.ContainsKey("internationalFlight")) { Grid.SetColumnSpan(txtChildCount, 2); Grid.SetColumnSpan(txtBabyCount, 2); txtInfantCount.Visibility = Visibility.Collapsed; txtStudentCount.Visibility = Visibility.Collapsed; txtMilitaryCount.Visibility = Visibility.Collapsed; txtTeenagerCount.Visibility = Visibility.Collapsed; } txtAdultCount.Value = Database.TempData.TicketSearch.Passengers.Count(x => x.Type == PassengerType.Adult); txtChildCount.Value = Database.TempData.TicketSearch.Passengers.Count(x => x.Type == PassengerType.Child); txtBabyCount.Value = Database.TempData.TicketSearch.Passengers.Count(x => x.Type == PassengerType.Baby); txtInfantCount.Value = Database.TempData.TicketSearch.Passengers.Count(x => x.Type == PassengerType.Infant); txtStudentCount.Value = Database.TempData.TicketSearch.Passengers.Count(x => x.Type == PassengerType.Student); txtMilitaryCount.Value = Database.TempData.TicketSearch.Passengers.Count(x => x.Type == PassengerType.Military); txtTeenagerCount.Value = Database.TempData.TicketSearch.Passengers.Count(x => x.Type == PassengerType.Teenager); App.AddBackPressedEvent(BackPressed); }
private void btnBuyTicket_Clicked(object sender, EventArgs e) { Logger.Clicked("btnBuyTicket"); if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Error, ProgressTime.Normal); } else { TicketPivot.SelectedIndex = 2; var dispacterTimer = new DispatcherTimer(); dispacterTimer.Tick += (c, r) => { dispacterTimer.Stop(); App.AddBackPressedEvent(BackPressed); _actionType = 1; DefaultButtons.Visibility = Visibility.Collapsed; ContinueButtons.Visibility = Visibility.Visible; TicketPassengerItem.CheckBoxesForBuy(); }; dispacterTimer.Interval = TimeSpan.FromMilliseconds(500); dispacterTimer.Start(); } }
private void btnBuy_Clicked(object sender, EventArgs e) { Logger.Clicked("btnBuy"); if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else if (string.IsNullOrEmpty(txtOwnerName.Value) || string.IsNullOrEmpty(txtCardNumber.Value) || string.IsNullOrEmpty(txtExpirationMonth.Value) || string.IsNullOrEmpty(txtExpirationYear.Value) || string.IsNullOrEmpty(txtCVC.Value) || (cbPersonBill.IsChecked == true && (txtBillTCKN.Value == "0" || string.IsNullOrEmpty(txtBillFirstName.Value) || string.IsNullOrEmpty(txtBillLastName.Value))) || (cbFactoryBill.IsChecked == true && (string.IsNullOrEmpty(txtBillFactoryName.Value) || string.IsNullOrEmpty(txtBillTaxId.Value) || string.IsNullOrEmpty(txtBillTaxOfficeName.Value)))) { App.ShowProgress("boş bıraktığınız alan(lar) var", ProgressType.Warning, ProgressTime.Normal); } else if (txtCardNumber.Length != 16) { App.ShowProgress("kart numarası 16 haneden oluşmalıdır", ProgressType.Warning, ProgressTime.Normal); } else if (cbAcceptRules.IsChecked != true) { App.ShowProgress("kuralları okuyup, kabul ettiğinizi belirtmelisiniz", ProgressType.Warning, ProgressTime.Normal); } else { var ticket = Database.TempData.Ticket; if (cbUse3DSecure.IsChecked == true) { NavigationService.Navigate(new Uri("/Pages/Buying3DSecurePage.xaml", UriKind.RelativeOrAbsolute)); } else { btnBuy.IsActivated = false; App.AddBackPressedEvent(BackPressed); BuyingRequests.BuyingRequest.OnCompleted = (response) => { var actionResult = response.Result; btnBuy.IsActivated = true; App.RemoveBackPressedEvent(BackPressed); if (Database.TempData.Ticket.Bill.Type == BillType.Person) { Database.AddPassenger(new Passenger() { TCKN = Database.TempData.Ticket.Bill.PersonTCKN, FirstName = Database.TempData.Ticket.Bill.PersonFirstName, LastName = Database.TempData.Ticket.Bill.PersonLastName, Address = Database.TempData.Ticket.Bill.Address }); } if (response.Status == ResponseStatus.Successful) { Database.FillSavedPNR(); Database.AddPassenger(Database.TempData.Ticket.Passengers.ToList()); Database.TempData.Ticket.PNR.Code = actionResult.PNR; Database.TempData.Ticket.PNR.ExpirationDate = actionResult.ExpirationDate; Database.SavedData.Tickets.Add(Database.TempData.Ticket); Functions.UpdateTicket(Database.TempData.Ticket.PNR, NavigationService); App.ClearBackHistory(); } else if (response.Status == ResponseStatus.InvalidTCKN) { App.ShowProgress("belirttiğiniz yolcuların bilgilerini kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else { App.ShowProgress(response.Message, ProgressType.Error, ProgressTime.Normal); } }; BuyingRequests.GetBuying(ticket); } } }
public Buying3DSecurePage() { InitializeComponent(); if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else { App.AddBackPressedEvent(BackPressed); App.ShowProgress("onay sayfası yükleniyor..."); BuyingRequests.OnPageLoaded = () => { App.HideProgress(); }; BuyingRequests.On3DSecureBuyingCompleted = (response) => { var actionResult = response.Result; App.RemoveBackPressedEvent(BackPressed); if (response.Status == ResponseStatus.Successful) { Database.AddPassenger(Database.TempData.Ticket.Passengers.ToList()); App.ShowProgress("biletiniz başarıyla alınmıştır, yönlendiriliyorsunuz...", ProgressType.Success, ProgressTime.Normal); Database.TempData.Ticket.PNR.Code = actionResult.PNR; Database.TempData.Ticket.PNR.Parameter = Database.TempData.Ticket.Passengers[0].LastName; Database.TempData.Ticket.PNR.ExpirationDate = actionResult.ExpirationDate; Database.SavedData.Tickets.Add(Database.TempData.Ticket); Database.FillSavedPNR(); var timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(2000); timer.Tick += (x, r) => { timer.Stop(); NavigationService.Navigate(new Uri("/Pages/TicketAction/DetailsPage.xaml", UriKind.RelativeOrAbsolute)); App.ClearBackHistory(); }; timer.Start(); } else if (response.Status == ResponseStatus.InvalidTCKN) { App.ShowProgress("belirttiğiniz yolcuların bilgilerini kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } } else { App.ShowProgress(response.Message, ProgressType.Plain, ProgressTime.Infinite, new List <string>() { "Yeniden düzenle", "Vazgeç" }); Header.HeaderConfirmed = (buttonId) => { if (buttonId == 0) { if (NavigationService.CanGoBack) { NavigationService.GoBack(); } } else { NavigationService.Navigate(new Uri("/Pages/MainPage.xaml", UriKind.RelativeOrAbsolute)); App.ClearBackHistory(); } }; } }; BuyingRequests.Get3DSecureBuying(Database.TempData.Ticket, this.webBrowserGrid); } }
private void btnContinue_Clicked(object sender, EventArgs e) { Logger.Clicked("btnContinue"); bool isValid = true; foreach (var passenger in Database.TempData.Ticket.Passengers.ToList()) { if (!passenger.IsValidForAirplane || (Database.TempData.Ticket.IsPassportRequired && passenger.PassaportId == 0)) { isValid = false; } } if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else if (!isValid || string.IsNullOrEmpty(txtEmail.Value) || string.IsNullOrEmpty(txtPhoneNumber.Value)) { App.ShowProgress("boş bıraktığınız alan(lar) var", ProgressType.Warning, ProgressTime.Normal); } else if (!Regex.Match(txtEmail.Value.ToString(), @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$").Success) { App.ShowProgress("email adresiniz geçerli değil", ProgressType.Warning, ProgressTime.Normal); } else if (txtPhoneNumber.Value.Length < 10 || txtTelephoneNumber.Value.Length < 10) { App.ShowProgress("telefon numaranız 10 haneden oluşmalıdır", ProgressType.Warning, ProgressTime.Normal); } else { if (Database.TempData.Ticket.ActionType == ActionType.Reservation) { App.AddBackPressedEvent(BackPressed); btnContinue.IsActivated = false; App.ShowProgress("rezervasyon yapılıyor..."); ReservationRequests.ReservationRequest.OnCompleted = (response) => { var actionResult = response.Result; App.HideProgress(); btnContinue.IsActivated = true; App.RemoveBackPressedEvent(BackPressed); if (response.Status == ResponseStatus.Successful) { Database.AddPassenger(Database.TempData.Ticket.Passengers.ToList()); Database.TempData.Ticket.PNR.Code = actionResult.PNR; Database.TempData.Ticket.PNR.Parameter = Database.TempData.Ticket.Passengers[0].LastName; Database.TempData.Ticket.PNR.ExpirationDate = actionResult.ExpirationDate; Database.SavedData.Tickets.Add(Database.TempData.Ticket); Database.FillSavedPNR(); Functions.UpdateTicket(Database.TempData.Ticket.PNR, NavigationService); App.ClearBackHistory(); } else if (response.Status == ResponseStatus.InvalidTCKN) { App.ShowProgress("belirttiğiniz yolcuların bilgilerini kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else { App.ShowProgress(response.Message, ProgressType.Error, ProgressTime.Normal); } }; ReservationRequests.GetReservation(Database.TempData.Ticket); } else { NavigationService.Navigate(new Uri("/Pages/Airplane/CreditCardPage.xaml", UriKind.RelativeOrAbsolute)); } } }