コード例 #1
0
        private void EditSalida(object sender, ItemTappedEventArgs e)
        {
            Salida details = e.Item as Salida;

            if (details != null)
            {
                Navigation.PushAsync(new AddSalida(details));
            }
        }
コード例 #2
0
 private void PopulateDetails(Salida details)
 {
     des.Text   = details.Des;
     fecha.Date = DateTime.Parse(details.Fecha);
     //DateTime.ParseExact(details.Fecha, "M/d/yyyy", null)
     monto.Text = details.Monto.ToString();
     Btn.Text   = "Modificar";
     this.Title = "Editar Salida";
 }
コード例 #3
0
        private async void DeleteSalida(object sender, EventArgs e)
        {
            bool res = await DisplayAlert("Message", "¿Quieres eliminar este empleado?", "Ok", "Cancelar");

            if (res)
            {
                var    menu    = sender as MenuItem;
                Salida details = menu.CommandParameter as Salida;
                DependencyService.Get <ISQLite>().DeleteSalida(details.Ids);
                PopulateSalidaList();
            }
        }
コード例 #4
0
        public AddSalida(Salida details)
        {
            InitializeComponent();
            if (details != null)
            {
                salidaDetails = details;
                id            = details.Ids;
                PopulateDetails(salidaDetails);
            }

            pickerEmployee.ItemsSource = DependencyService.Get <ISQLite>().getIdEmployee();
        }
コード例 #5
0
        private void SaveSalida(object sender, EventArgs e)
        {
            if (Btn.Text == "Guardar")
            {
                Salida salida = new Salida();
                salida.Ids   = id;
                salida.Des   = des.Text;
                salida.Fecha = fecha.Date.ToShortDateString().ToString();
                salida.Monto = Convert.ToDouble(String.Format("{0:0.##}", monto.Text));
                salida.Id    = Convert.ToInt32(pickerEmployee.SelectedItem.ToString());

                bool res = DependencyService.Get <ISQLite>().SaveSalida(salida);
                if (res)
                {
                    Navigation.PopAsync();
                }
                else
                {
                    DisplayAlert("Message", "No se pudieron guardar los datos", "Ok");
                }
            }
            else
            {
                // update employee
                salidaDetails.Des   = des.Text;
                salidaDetails.Fecha = fecha.Date.ToShortDateString().ToString();
                salidaDetails.Monto = Convert.ToDouble(monto.Text);


                bool res = DependencyService.Get <ISQLite>().UpdateSalida(salidaDetails);
                if (res)
                {
                    Navigation.PopAsync();
                }
                else
                {
                    DisplayAlert("Message", "No se pudieron actualizar los datos", "Ok");
                }
            }
        }