private async void cancelPassenger() { try { bool isDeleted = await Application.Current.MainPage.DisplayAlert("Dikkat", "Yolcuyu iptal etmek istediğinize emin misiniz?", "OK", "Vazgeç"); if (isDeleted) { Passenger.UserId = App.User.Id; int updatedId = await _passengerService.DeleteAsync(Passenger.Id); if (updatedId > 0) { MessageNotificationHelper.ShowMessageSuccess("Yolcu iptal etme başariyla gerçekleşti."); await NavigationHelper.PopAsyncSingle(); } else { MessageNotificationHelper.ShowMessageFail("Yolcu iptal etmede hata oluştu."); } } } catch (MobileException exception) { MessageNotificationHelper.ShowMessageFail(exception.Message); } catch (Exception exception) { MessageNotificationHelper.ShowMessageError(exception.GetBaseException().Message); } }
private void btnCountry_Clicked(object sender, EventArgs e) { try { _lookupsService.UpdateCountries(); MessageNotificationHelper.ShowMessageFail("Ulke bilgileri basariyla guncellendi"); } catch (Exception ex) { MessageNotificationHelper.ShowMessageFail(ex.Message); } }
private async void addPassenger() { try { if (Passenger.FirstName == "") { MessageNotificationHelper.ShowMessageFail("Yolcu adı boş olamaz."); } if (Passenger.FirstName == "") { MessageNotificationHelper.ShowMessageFail("Yolcu soyadı boş olamaz."); } if (Passenger.JourneyId == 0) { MessageNotificationHelper.ShowMessageFail("JourneyId bulunamadı."); } if (Passenger.CountryId == 0) { MessageNotificationHelper.ShowMessageFail("Ülke bilgisi boş olamaz."); } if (Passenger.CountryId == 0) { MessageNotificationHelper.ShowMessageFail("Pasaport/Id bilgisi boş olamaz."); } if (Passenger.Gender == "") { MessageNotificationHelper.ShowMessageFail("Cinsiyet bilgisi boş olamaz."); } int createdId = await _passengerService.SaveAsync(Passenger); if (createdId > 0) { MessageNotificationHelper.ShowMessageSuccess("İşlem başarıyla gercekleşti"); await NavigationHelper.PopAsyncSingle(); } else { MessageNotificationHelper.ShowMessageFail("Beklenmedik bir hata oluştu."); } } catch (MobileException exception) { MessageNotificationHelper.ShowMessageFail(exception.Message); } catch (Exception exception) { MessageNotificationHelper.ShowMessageError(exception.GetBaseException().Message); } }
protected override async void OnAppearing() { try { base.OnAppearing(); journeyListViewModel.JourneyList = await journeyListViewModel.GetAllJourney(); BindingContext = journeyListViewModel; } catch (Exception ex) { MessageNotificationHelper.ShowMessageError(ex.Message); } }
private void ListViewJourney_ItemTapped(object sender, ItemTappedEventArgs e) { try { JourneyDTO item = (JourneyDTO)e.Item; if (item == null) { return; } journeyListViewModel.GetSelectedJourney(item); } catch (Exception ex) { MessageNotificationHelper.ShowMessageError(ex.Message); } }
public PassengerPage(long journeyId) { InitializeComponent(); try { _passengerViewModel = new PassengerViewModel(); Title = "Yolcu Ekle"; btnSave.IsVisible = true; btnCancel.IsVisible = false; _passengerViewModel.Passenger.JourneyId = journeyId; BindingContext = _passengerViewModel; } catch (Exception ex) { MessageNotificationHelper.ShowMessageError(ex.Message); } }
public PassengerPage(PassengerDTO passenger) { try { InitializeComponent(); _passengerViewModel = new PassengerViewModel(); _passengerViewModel.Passenger = passenger; Title = "Yolcu Görüntüle"; btnSave.IsVisible = false; btnCancel.IsVisible = true; if (passenger.Gender == "K") { pickerGender.SelectedIndex = 0; } else { pickerGender.SelectedIndex = 1; } BindingContext = _passengerViewModel; for (int x = 0; x < _passengerViewModel.CountryList.Count; x++) { if (_passengerViewModel.CountryList[x].Id == _passengerViewModel.Passenger.CountryId) { pickerCountry.SelectedIndex = x; } } } catch (Exception ex) { MessageNotificationHelper.ShowMessageError(ex.Message); } }
private async void cancelJourney() { try { if (Journey.Description == string.Empty) { MessageNotificationHelper.ShowMessageFail("Lutfen bir aciklama giriniz."); } bool isDeleted = await Application.Current.MainPage.DisplayAlert("Dikkat", "Kaydi iptal etmek istediğinize emin misiniz?", "OK", "Vazgeç"); if (isDeleted) { Journey.UserId = App.User.Id; int updatedId = await _journeyService.DeleteAsync(Journey.Id, Journey.Description); if (updatedId > 0) { MessageNotificationHelper.ShowMessageSuccess("Yolcu iptal etme başariyla gerçekleşti."); await NavigationHelper.PopAsyncSingle(); } else { MessageNotificationHelper.ShowMessageFail("Yolcu iptal etmede hata oluştu."); } } } catch (MobileException exception) { MessageNotificationHelper.ShowMessageFail(exception.Message); } catch (Exception exception) { MessageNotificationHelper.ShowMessageError(exception.GetBaseException().Message); } }
private void btnDriver_Clicked(object sender, EventArgs e) { _lookupsService.UpdateDrivers(); MessageNotificationHelper.ShowMessageFail("Surucu bilgileri basariyla guncellendi"); }
private void btnVehicle_Clicked(object sender, EventArgs e) { _lookupsService.UpdateVehicles(); MessageNotificationHelper.ShowMessageFail("Arac bilgileri basariyla guncellendi"); }
private async void saveJourney() { try { int createdId = 0; if (Journey.CompanyId == 0) { Journey.CompanyId = App.User.CompanyId; } if (Journey.From.Length < 5) { MessageNotificationHelper.ShowMessageSuccess("Lütfen başlangıç yeri bilgisini kontrol edin. Girdiginiz değer yetersiz."); return; } if (Journey.To.Length < 5) { MessageNotificationHelper.ShowMessageSuccess("Lütfen bitiş yeri bilgisini kontrol edin. Girdiginiz değer yetersiz."); return; } if (Journey.StartDate > DateTime.Now) { MessageNotificationHelper.ShowMessageSuccess("Başlangıç tarihi bugünden küçük olamaz."); return; } if (Journey.FinishDate > DateTime.Now) { MessageNotificationHelper.ShowMessageSuccess("Bitiş tarihi bugünden küçük olamaz."); return; } if (Journey.DriverId == 0) { if (_driverList.Count == 1) { Journey.DriverId = _driverList[0].Id; } else { MessageNotificationHelper.ShowMessageSuccess("Sürücü bilgisi boş olamaz!!"); return; } } if (Journey.VehicleId == 0) { if (_vehicleList.Count == 1) { Journey.VehicleId = _vehicleList[0].Id; } else { MessageNotificationHelper.ShowMessageSuccess("Araç bilgisi boş olamaz!!"); return; } } if (Journey.Fees < 0) { MessageNotificationHelper.ShowMessageSuccess("Ücert 0 olamaz."); return; } if (Journey.Id == 0) { // Create a new journey createdId = await _journeyService.SaveAsync(Journey); } else { if (Journey.Description == "") { MessageNotificationHelper.ShowMessageSuccess("Açiklama bilgisi boş olamaz!!"); return; } // update a journey createdId = await _journeyService.UpdateAsync(Journey); } if (createdId > 0) { MessageNotificationHelper.ShowMessageSuccess("İşlem başarıyla gercekleşti"); await NavigationHelper.PopAsyncSingle(); } else { MessageNotificationHelper.ShowMessageFail("Beklenmedik bir hata oluştu."); } } catch (MobileException exception) { MessageNotificationHelper.ShowMessageFail(exception.Message); } catch (Exception exception) { MessageNotificationHelper.ShowMessageError(exception.GetBaseException().Message); } }