Example #1
0
 public void proGuardarDatos(int iEmpresas, int iEspecialidades)
 {
     try
     {
         OdbcCommand comando = new OdbcCommand("{CALL Pro_ingresoNuevoMedico(?,?,?,?,?,?,?,?,?)}", conexion.ObtenerConexion());
         comando.CommandType = CommandType.StoredProcedure;
         comando.Parameters.AddWithValue("iColegiado", Txt_colegiado.Text);
         comando.Parameters.AddWithValue("sNombre", Txt_nombre.Text);
         comando.Parameters.AddWithValue("sApellido", Txt_apellido.Text);
         comando.Parameters.AddWithValue("nTelefono", Txt_telefono.Text);
         comando.Parameters.AddWithValue("sDireccion", Txt_direccion.Text);
         comando.Parameters.AddWithValue("sCorreo", Txt_Correo.Text);
         comando.Parameters.AddWithValue("iIdEspecialidad", iEspecialidades);
         comando.Parameters.AddWithValue("iIdEmpresa", iEmpresas);
         comando.Parameters.AddWithValue("dFechaDeNacimiento", Dtp_fechaNacimiento.Text);
         comando.ExecuteNonQuery();
         MessageBox.Show("Datos insertados correctamente");
     }
     catch (Exception error) { MessageBox.Show("Error" + error); }
     finally
     {
         conexion.ObtenerConexion().Close();
         Txt_colegiado.ResetText();
         Txt_nombre.ResetText();
         Txt_apellido.ResetText();
         Txt_telefono.ResetText();
         Txt_Correo.ResetText();
         Txt_direccion.ResetText();
         Dtp_fechaNacimiento.ResetText();
     }
 }
Example #2
0
        public void Pro_guardarDatos()
        {
            try
            {
                int iCargo = Convert.ToInt32(Cmb_cargo.SelectedValue);


                OdbcCommand comando = new OdbcCommand("{CALL Pro_insertarEmpleado(?,?,?,?,?,?,?,?,?,?)}", conexion.ObtenerConexion());
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.AddWithValue("iEmpleado", Txt_DPIEmpleado.Text);
                comando.Parameters.AddWithValue("sNombre", Txt_nombre.Text);
                comando.Parameters.AddWithValue("sApellido", Txt_apellido.Text);
                comando.Parameters.AddWithValue("nTelefono", Txt_telefono.Text);
                comando.Parameters.AddWithValue("sDireccion", Txt_direccion.Text);
                comando.Parameters.AddWithValue("sCorreo", Txt_correo.Text);
                comando.Parameters.AddWithValue("iCargo", iCargo);
                comando.Parameters.AddWithValue("fSueldo", Txt_sueldo.Text);
                comando.Parameters.AddWithValue("dFechaDeNacimiento", Dtp_fechaNacimiento.Text);
                comando.Parameters.AddWithValue("iUsuario", Txt_DPIEmpleado.Text);
                comando.ExecuteNonQuery();
                MessageBox.Show("Datos insertados correctamente");
            }
            catch (Exception error) { MessageBox.Show("Error" + error);

                                      conexion.ObtenerConexion().Close(); }
            Txt_DPIEmpleado.ResetText();
            Txt_nombre.ResetText();
            Txt_apellido.ResetText();
            Txt_telefono.ResetText();
            Txt_correo.ResetText();
            Txt_direccion.ResetText();
            Txt_sueldo.ResetText();
            Cmb_cargo.ResetText();
            Dtp_fechaNacimiento.ResetText();
        }