public EditPage (Employ employ)
		{
			InitializeComponent ();
			this.employ = employ;

			ActualizarButton.Clicked += ActualizarButton_Clicked;
			BorrarButton.Clicked += BorrarButton_Clicked;

			nombresEntry.Text = empleado.Nombres;
			apelliodsEntry.Text = empleado.Apellidos;
			salarioEntry.Text = empleado.Salario.ToString();
			nombresEntry.Text = empleado.Nombres;
			fechaContratoDatePicker.Date = empleado.FechaContrato;
			activoSwitch.IsToggled = Employ.Activo;
				
		}
		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");

		}
		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 ();
			}

		}
Exemple #4
0
		public void DeleteEmploy(Employ employ)
		{
			connection.Delete(employ);
		}
Exemple #5
0
		public void UpdateEmploy(Employ employ)
		{
			connection.Update (employ);
		}
Exemple #6
0
		public void InsertEmploy(Employ employ)
		{
			connection.Insert (employ);
		}