Esempio n. 1
0
        public EditExercise(TablaEjercicios ej)
        {
            InitializeComponent();

            this.ejercicio = ej;

            this.Padding = Device.OnPlatform(
                new Thickness(10, 20, 10, 10),
                new Thickness(10, 10, 10, 10),
                new Thickness(10, 10, 10, 10));

            nombreejercicioEntry.Text = ejercicio.Nombreejercicio;
            descripcionEntry.Text     = ejercicio.Descripcion;
            comentarioEntry.Text      = ejercicio.ComentarioEjercicio;


            actualizarButton.Clicked += ActualizarButton_Clicked;
            borrarButton.Clicked     += BorrarButton_Clicked;

            // lesionesButton.Clicked += LesionesButton_Clicked;


            // listaaListView.ItemTemplate = new DataTemplate(typeof(Lesioncell));
            // listaaListView.RowHeight = 50;
        }/*
Esempio n. 2
0
        private async void Agregarlesion_Clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(nombresejercicio.Text))
            {
                await DisplayAlert("Error", "Debe ingresar nombres", "Aceptar");

                nombresejercicio.Focus();
                return;
            }
            if (string.IsNullOrEmpty(descripcionEntry.Text))
            {
                await DisplayAlert("Error", "Debe ingresar una descripción del ejercicio", "Aceptar");

                descripcionEntry.Focus();
                return;
            }
            //creamos el deportista
            var ejercicio = new TablaEjercicios
            {
                Nombreejercicio = nombresejercicio.Text,
                Descripcion     = descripcionEntry.Text,
                clavedeportista = deportistaa.IDDeportista,

                // Salario = decimal.Parse(salarioEntry.Text),
            };

            //insertamos el deportista en la base de datos
            using (var datos = new DataAccess())
            {
                datos.InsertEjercicio(ejercicio);
                //listaListView.ItemsSource = datos.GetDeportistas();
            }
            // listaemail.Add("Nombre: " + ejercicio.Nombreejercicio+"Series: "+ejercicio.Series+ Environment.NewLine);

            nombresejercicio.Text = string.Empty;
            descripcionEntry.Text = string.Empty;
            ////emailEntry.Text = string.Empty;
            // salarioEntry.Text = string.Empty;
            // fechaContratoDatePicker.Date = DateTime.Now;
            //// activoSwitch.IsToggled = true;
            await DisplayAlert("Confirmación", "ejercicio agregado", "Aceptar");

            //  await Navigation.PushAsync(new Trabajo.HomePage());
        }
Esempio n. 3
0
 //eliminar
 public void DeleteEjercicio(TablaEjercicios ejercicio)
 {
     connection.Delete(ejercicio);
 }
Esempio n. 4
0
 //actualizar
 public void UpdateEjercicio(TablaEjercicios ejercicio)
 {
     connection.Update(ejercicio);
 }
Esempio n. 5
0
        //Tabla de ejercicios

        //insertar ejercicio
        public void InsertEjercicio(TablaEjercicios ejercicio)
        {
            connection.Insert(ejercicio);
        }
        private async void Add()
        {
            /*
             * if (string.IsNullOrEmpty(this.Product.Description))
             * {
             *  await Application.Current.MainPage.DisplayAlert(
             *      Languages.Error,
             *      Languages.DescriptionError,
             *      Languages.Accept);
             *  return;
             * }
             */
            /*
             * if (this.Product.Price < 0)
             * {
             *  await Application.Current.MainPage.DisplayAlert(
             *      Languages.Error,
             *      Languages.PriceError,
             *      Languages.Accept);
             *  return;
             * }*/
            /*
             * if (this.Category == null)
             * {
             *  await Application.Current.MainPage.DisplayAlert(
             *      Languages.Error,
             *      Languages.CategoryError,
             *      Languages.Accept);
             *  return;
             * }
             */
            this.IsRunning = true;
            this.IsEnabled = false;

            //chekea la conexion
            var connection = await this.apiService.CheckConnection();

            //si la conexion a internet no ha sido exitosa
            if (!connection.IsSuccess)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(Languages.Error, connection.Message, Languages.Accept);

                return;
            }

            //para saber si se cogió o no foto

            /*
             * byte[] imageArray = null;
             * if (this.file != null)
             * {
             *  imageArray = FilesHelper.ReadFully(this.file.GetStream());
             *  this.Product.ImageArray = imageArray;
             * }
             */
            //por si el usuario cambia la categoría
            //this.Product.CategoryId = this.Category.CategoryId;
            string descripcionproducto = this.product.Description;
            string notasproducto       = this.product.Remarks;
            string categoriaa          = this.category.Description;
            //creamos el deportista
            var ejercicio = new TablaEjercicios
            {
                Nombreejercicio = descripcionproducto,
                Descripcion     = notasproducto,
                clavedeportista = deportistaa.IDDeportista,

                // Salario = decimal.Parse(salarioEntry.Text),
            };

            //insertamos el deportista en la base de datos
            using (var datos = new DataAccess())
            {
                datos.InsertEjercicio(ejercicio);
                //listaListView.ItemsSource = datos.GetDeportistas();
            }

            /*
             * var url = Application.Current.Resources["UrlAPI"].ToString();
             *
             * var prefix = Application.Current.Resources["UrlPrefix"].ToString();
             *
             * var controller = Application.Current.Resources["UrlProductsController"].ToString();
             *
             * //invocamos el metodo post del apiservice
             * var response = await this.apiService.Put(url, prefix, controller, this.Product, this.Product.ProductId, Settings.TokenType, Settings.AccessToken);
             */
            //preguntamos si lo grabó de manera exitosa

            /*
             * if (!response.IsSuccess)
             * {
             *  this.IsRunning = false;
             *  this.IsEnabled = true;
             *  await Application.Current.MainPage.DisplayAlert(Languages.Error, response.Message, Languages.Accept);
             *  return;
             * }
             *
             * var newProduct = (Product)response.Result;
             */
            //adicionamos el producto a la colección
            //var productsViewModel = ProductsViewModel.GetInstance();

            //buscamos el producto lo eliminamos y lo volvemos a crear

            /*
             * var oldProduct = productsViewModel.MyProducts.Where(p => p.ProductId == this.Product.ProductId).FirstOrDefault();
             *
             * if (oldProduct != null)
             * {
             *  productsViewModel.MyProducts.Remove(oldProduct);
             * }
             *
             *
             * productsViewModel.MyProducts.Add(newProduct);
             * productsViewModel.RefreshList();
             */
            // la ordenamos
            //viewModel.Products = viewModel.Products.OrderBy(p => p.Description).ToList();


            //si lo hizo de manera exitosa hacemos el back
            this.IsRunning = false;
            this.IsEnabled = true;
            //Desapilamos
            await App.Navigator.PopAsync(false);

            await App.Navigator.PopAsync(false);

            await App.Navigator.PopAsync(false);

            //PopUntilDestination(typeof(TableExercisesView));
        }