Пример #1
0
        private void InsertarEmpleado()
        {
            string rpta = "";

            if (string.IsNullOrEmpty(txtNombres.Text))
            {
                txtNombres.Focus();
                epEmpleado.SetError(txtNombres, "Ingrese nombre del cliente");
            }
            else if (string.IsNullOrEmpty(txtApellidos.Text))
            {
                txtApellidos.Focus();
                epEmpleado.Clear();
                epEmpleado.SetError(txtApellidos, "Ingrese apellidos del cliente");
            }
            else if (string.IsNullOrEmpty(txtDni.Text))
            {
                txtDni.Focus();
                epEmpleado.Clear();
                epEmpleado.SetError(txtDni, "Ingrese dni del cliente");
            }
            else if (string.IsNullOrEmpty(cboSexo.Text))
            {
                cboSexo.Focus();
                epEmpleado.Clear();
                epEmpleado.SetError(cboSexo, "Indique sexo del cliente");
            }


            else
            {
                rpta = NEmpleado.InsertarEmpleado(
                    CultureInfo.InvariantCulture.TextInfo.ToTitleCase(txtNombres.Text).Trim(),
                    CultureInfo.InvariantCulture.TextInfo.ToTitleCase(txtApellidos.Text).Trim(),
                    txtDni.Text.Trim(),
                    cboSexo.Text.Trim().Substring(0, 1),
                    txtTelefono.Text.Trim(),
                    txtCorreo.Text.Trim().ToLower(),
                    CultureInfo.InvariantCulture.TextInfo.ToTitleCase(txtDireccion.Text).Trim(),
                    Convert.ToInt32(cboArea.SelectedValue),
                    ImageToByteArray(pbFoto.Image)
                    );
                if (rpta == "Ok")
                {
                    MessageBox.Show(rpta + "--- Registrado");
                    Limpiar();
                }
                else
                {
                    MessageBox.Show(rpta + "--Error");
                }
            }
        }