Beispiel #1
0
		public async void BorrarButton_Clicked(object sender, EventArgs e)
		{
			var rta = await DisplayAlert("Confirmation", "Hi borrar", "Yes", "No");
			if (!rta) return;

			using (var datos = new DataAccess())
			{
				datos.DeleteEmploy(employ);
			}

			await DisplayAlert("Confirmation", "Employ borrad", "aceptar");
			await Navigation.PushAsync(new HomePage());
				
		}
Beispiel #2
0
		public HomePage ()
		{
			InitializeComponent ();

			nuevoButton.Clicked += nuevoButton_Clikced;
			datosListView.ItemSelected += DatosListView_ItemSelected;


			datosListView.ItemTemplate = new DataTemplate (typeof(EmployCell));

			using (var datos = new DataAccess ()) 
			{
				datosListView.ItemsSource = datos.GetEmploy ();
			}
		}
Beispiel #3
0
		public async void nuevoButton_Clicked(object sender, EventArgs e)
		{
			if (string.IsNullOrEmpty (nombresEntry.Text)) 
			{
				await DisplayAlert ("Error", "Debe add numbers", "Aceptar");
				nombresEntry.Focus ();
				return;
			}

			if (string.IsNullOrEmpty (apellidosEntry.Text)) 
			{
				await DisplayAlert ("Error", "Debe add apellidos", "Aceptar");
				apellidosEntry.Focus ();
				return;
			}

			if (string.IsNullOrEmpty (salarioEntry.Text)) 
			{
				await DisplayAlert ("Error", "Debe add salario", "Aceptar");
				salarioEntry.Focus ();
				return;
			}

			Employ = Employ = new Employ 
			{
				Activo = activoSwitch.IsToggled,
				Apellidos =  apellidosEntry.Text,
				FechaContrato = fechaContratoDatePicker.Date,
				Nombres = nombresEntry.Text,
				Salario = decimal.Parse(salaryioEntry.Text)
				
			};

			using (var datos = new DataAccess ()) 
			{
				datos.InsertEmploy (employ);
				datosListView.ItemsSource = datos.GetEmploy ();
			}

			apellidosEntry.Text = string.Empty;
			fechaContratoDatePicker.Date = DateTime.Now;
			nombresEntry.Text = string.Empty;
			salaryioEntry.Text = string.Empty;
			await DisplayAlert ("Mensaje", "Employ creado correctamente", "Aceptar");

		}
Beispiel #4
0
		public async void ActualizarButton_Clicked(object sender, EventArgs e)
		{
			if (string.IsNullOrEmpty (nombresEntry.Text)) 
			{
				await DisplayAlert ("Error", "Debe add numbers", "Aceptar");
				nombresEntry.Focus ();
				return;
			}

			if (string.IsNullOrEmpty (apellidosEntry.Text)) 
			{
				await DisplayAlert ("Error", "Debe add apellidos", "Aceptar");
				apellidosEntry.Focus ();
				return;
			}

			if (string.IsNullOrEmpty (salarioEntry.Text)) 
			{
				await DisplayAlert ("Error", "Debe add salario", "Aceptar");
				salarioEntry.Focus ();
				return;
			}

			Employ = Employ = new Employ 
			{
				IDEmploy = this.employ.IDEmploy(),
				Activo = activoSwitch.IsToggled,
				Apellidos =  apellidosEntry.Text,
				FechaContrato = fechaContratoDatePicker.Date,
				Nombres = nombresEntry.Text,
				Salario = decimal.Parse(salaryioEntry.Text)

			};

			using (var datos = new DataAccess ()) 
			{
				datos.UpdateEmploy (employ);
				//datosListView.ItemsSource = datos.GetEmploy ();
			}

		}