Exemple #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            var    result   = false;
            var    message  = String.Empty;
            string apellido = txtApellido.Text;
            string nombre   = txtNombre.Text;
            string cuil     = txtCuil.Text;
            //Corregir
            Consorcio oConsorcio = (Consorcio)cmbNombre.SelectedItem;

            if (cmbNombre.SelectedIndex.Equals(0))
            {
                if (!String.IsNullOrEmpty(txtApellido.Text) && !String.IsNullOrEmpty(txtNombre.Text) && !String.IsNullOrEmpty(txtCuil.Text) && !String.IsNullOrEmpty(txtValorHora.Text) && !String.IsNullOrEmpty(txtValorMes.Text))
                {
                    result = cEmpleado.AgregarEmpleado(apellido, nombre, cuil, Convert.ToDouble(txtValorHora.Text), Convert.ToDouble(txtValorMes.Text), oConsorcio.ConsorcioId, oConsorcio.Nombre, oConsorcio.Cuit);
                }
                else
                {
                    message = "Debe llenar los campos vacios";
                }
            }
            else
            {
                message = "Debe llenar los campos vacios";
            }
            if (!result && String.IsNullOrEmpty(message))
            {
                message = "Ya existe empleado";
            }

            MessageBox.Show(message);
            txtNombre.Clear();
            txtApellido.Clear();
            txtApellido.Clear();
            txtValorHora.Clear();
            txtValorMes.Clear();
        }