Пример #1
0
        private async void ConfirmAddItemOkClicked(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(CurrentViewModel.Data.ProductPrice) ||
                    string.IsNullOrEmpty(CurrentViewModel.Data.ProductName))
                {
                    await DisplayAlert("Missing information",
                                       "Please make sure you have filled out the product information to save", "OK");


                    return;
                }
                CurrentViewModel.SpendData.Add(CurrentViewModel.Data);
                CurrentViewModel.Data = new SpendObject();
                await AddGrid.TranslateTo(0, LocalHeight, duration, Easing.SinOut);

                CurrentViewModel.ShowAdd = false;
                CalculateTotals();

                var dt    = CurrentViewModel.SerializeDataBase(CurrentViewModel.SpendData);
                var saved = await CurrentViewModel.SaveAnyString(dt, Constants.CurrentSpendList);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                await DisplayAlert("Failed", "Unable to save your list of items", "OK");
            }
        }
Пример #2
0
        private async void CancelAddItemClicked(object sender, EventArgs e)
        {
            //await TasksGrid.TranslateTo(-LocalWidth, 0, duration, Easing.SinInOut);
            await AddGrid.TranslateTo(0, LocalHeight, duration, Easing.SinOut);

            CurrentViewModel.ShowAdd = false;
        }
 public bool InsertNewGrid(AddGrid gridReq)
 {
     try
     {
         if (_context.Grids.Where(x => x.Gridno == gridReq.gridno).Count() > 0)
         {
             return(false);
         }
         Grids grid = _mapper.Map <Grids>(gridReq);
         _context.Grids.Add(grid);
         _context.SaveChanges();
         foreach (GridGeoLocation geoLoc in gridReq.gridGeoLocation)
         {
             GridGeolocations geo = new GridGeolocations();
             geo.GridId    = grid.Id;
             geo.Latitude  = geoLoc.latitude;
             geo.Longitude = geoLoc.longitude;
             _context.GridGeolocations.Add(geo);
         }
         _context.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool AddGrid(AddGrid model)
 {
     try
     {
         return(_gridRepo.InsertNewGrid(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #5
0
        public IActionResult AddGrid(AddGrid model)
        {
            try
            {
                var response = _gridService.AddGrid(model);
                if (response == false)
                {
                    return(BadRequest(new { message = "Grid no. already exists" }));
                }

                return(Ok(response));
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                // return StatusCode InternalServerError(ex.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
            }
        }
Пример #6
0
 private async void AddItemClicked(object sender, EventArgs e)
 {
     CurrentViewModel.ShowAdd = true;
     await AddGrid.TranslateTo(0, 0, duration, Easing.SinOut);
 }
 private void Abort_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     Scroll.Source = currentUri;
     AddGrid.SetVisibility(false);
 }