示例#1
0
        private async Task SaveFishingTrip()
        {
            FishingTripManager manager = new FishingTripManager();

            FishingTrip.PredominantWeather = SelectedWeather;
            Response <FishingTrip> response;

            if (IsEdit)
            {
                response = await manager.UpdateFishingTrip(FishingTrip);
            }
            else
            {
                response = await manager.CreateFishingTrip(FishingTrip);
            }

            InformUserHelper <FishingTrip> informer =
                new InformUserHelper <FishingTrip>(response, this);

            informer.InformUserOfResponse();

            if (CallerFishingTripsPage != null)
            {
                await CallerFishingTripsPage.ReloadFishingTrips();
            }

            if (CallerFishingTripDetailsPage != null)
            {
                await CallerFishingTripDetailsPage.RefreshData(response.Content);
            }
        }
        private async Task SaveFishType()
        {
            FishingTripManager  manager = new FishingTripManager();
            Response <FishType> response;

            if (_isEdit)
            {
                response = await manager.UpdateFishType(_fishType);
            }
            else
            {
                response = await manager.CreateFishType(_fishType);
            }

            InformUserHelper <FishType> informer =
                new InformUserHelper <FishType>(response, this);

            informer.InformUserOfResponse();

            if (CallerCatchFormPage != null)
            {
                await CallerCatchFormPage.SetFishTypes();

                CallerCatchFormPage.RefreshValidation(this, EventArgs.Empty);
            }

            if (CallerFishTypeListPage != null)
            {
                await CallerFishTypeListPage.ReloadFishTypes();
            }
        }
示例#3
0
        public async Task LoadFishingTrips()
        {
            Response <List <FishingTrip> > response = await new FishingTripManager().GetAllFishingTrips();

            _fishingTrips = new List <FishingTrip>(response.Content);

            InformUserHelper <List <FishingTrip> > informer =
                new InformUserHelper <List <FishingTrip> >(response, this);

            informer.InformUserOfResponse();
        }
        private async void Delete_Clicked(object sender, EventArgs e)
        {
            FishingTrip            fishingTrip = (sender as MenuItem)?.CommandParameter as FishingTrip;
            FishingTripManager     manager     = new FishingTripManager();
            Response <FishingTrip> response    = await manager.DeleteFishingTrip(fishingTrip);

            InformUserHelper <FishingTrip> informer =
                new InformUserHelper <FishingTrip>(response, this);

            informer.InformUserOfResponse();
            await ReloadFishingTrips();
        }
示例#5
0
        private async Task ReloadFishingTrip()
        {
            FishingTripManager     manager  = new FishingTripManager();
            Response <FishingTrip> response = await manager.GetFishingTrip(FishingTrip);

            InformUserHelper <FishingTrip> informer =
                new InformUserHelper <FishingTrip>(response, this);

            informer.InformUserOfResponse();

            RefreshList(response.Content);
        }
示例#6
0
        public async Task ReloadFishTypes()
        {
            Response <List <FishType> > response = await new FishingTripManager().GetAllFishTypes();

            _fishTypes = new ObservableCollection <FishType>(response.Content);

            InformUserHelper <List <FishType> > informer =
                new InformUserHelper <List <FishType> >(response, this);

            informer.InformUserOfResponse();

            FishtypeListView.ItemsSource = _fishTypes;
        }
示例#7
0
        public async Task SetFishTypes()
        {
            Response <List <FishType> > response = await new FishingTripManager().GetAllFishTypes();

            InformUserHelper <List <FishType> > informer =
                new InformUserHelper <List <FishType> >(response, this);

            informer.InformUserOfResponse();

            FishTypes = new ObservableCollection <FishType>(response.Content);

            SetFishTypesAsStrings();
        }
示例#8
0
        private async void Delete_Clicked(object sender, EventArgs e)
        {
            Response <FishingTrip> response = await new FishingTripManager().DeleteFishingTrip(FishingTrip);

            InformUserHelper <FishingTrip> informer =
                new InformUserHelper <FishingTrip>(response, this);

            informer.InformUserOfResponse();

            await Caller.ReloadFishingTrips();

            await Navigation.PopAsync();
        }
        public async Task ReloadFishingTrips()
        {
            Response <List <FishingTrip> > response = await new FishingTripManager().GetAllFishingTrips();

            if ((int)response.StatusCode < 400)
            {
                _fishingTrips = new ObservableCollection <FishingTrip>(response.Content);
            }

            InformUserHelper <List <FishingTrip> > informer =
                new InformUserHelper <List <FishingTrip> >(response, this);

            informer.InformUserOfResponse();

            FishingTripsListView.ItemsSource = _fishingTrips;
        }
示例#10
0
        private async Task SaveCatch()
        {
            FishingTripManager     manager = new FishingTripManager();
            Response <FishingTrip> response;

            if (IsEdit)
            {
                response = await manager.UpdateCatch(FishingTrip, Catch);
            }
            else
            {
                response = await manager.AddCatch(FishingTrip, Catch);
            }

            InformUserHelper <FishingTrip> informer =
                new InformUserHelper <FishingTrip>(response, this);

            informer.InformUserOfResponse();
            Caller.RefreshList(response.Content);
        }