Example #1
0
        private object TraerListaClientes()
        {
            DataSet     ds          = new DataSet();
            BaseDeDatos baseDeDatos = BaseDeDatos.Instance;
            SqlCommand  sqlCommand  = new SqlCommand();

            sqlCommand.Parameters.Clear();

            sqlCommand.CommandText = "SP_TRAER_CLIENTES_CODIGO_APELLIDO_Y_NOMBRE";
            sqlCommand.CommandType = CommandType.StoredProcedure;
            dt_lista_clientes      = baseDeDatos.consulta_parametrizada(sqlCommand);
            sqlCommand.Parameters.Clear();

            return(dt_lista_clientes);
        }
Example #2
0
        private void cargarComboBox(ComboBox comboBox, string storedProcedure, string displayMember, string valueMember)
        {
            DataSet     ds          = new DataSet();
            BaseDeDatos baseDeDatos = BaseDeDatos.Instance;
            SqlCommand  sqlCommand  = new SqlCommand();

            sqlCommand.CommandText = storedProcedure;
            sqlCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt_tipo = baseDeDatos.consulta(sqlCommand).Tables[0];

            comboBox.DataSource    = dt_tipo;
            comboBox.DisplayMember = displayMember;
            comboBox.ValueMember   = valueMember;
            sqlCommand.Parameters.Clear();
        }
Example #3
0
        private void actualizarComboBox(ComboBox comboBox, string storedProcedure, string displayMember, string valueMember, string selectedIndex, string paramName)
        {
            DataSet     ds          = new DataSet();
            BaseDeDatos baseDeDatos = BaseDeDatos.Instance;
            SqlCommand  sqlCommand  = new SqlCommand();

            sqlCommand.Parameters.Clear();
            sqlCommand.CommandText = storedProcedure;
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue(paramName, selectedIndex);

            DataTable dt_tipo = baseDeDatos.consulta_parametrizada(sqlCommand);

            comboBox.DataSource    = dt_tipo;
            comboBox.DisplayMember = displayMember;
            comboBox.ValueMember   = valueMember;
            sqlCommand.Parameters.Clear();
        }
Example #4
0
        private DataTable traer_datos_usuario()
        {
            DataSet     ds          = new DataSet();
            BaseDeDatos baseDeDatos = BaseDeDatos.Instance;
            SqlCommand  sqlCommand  = new SqlCommand();

            sqlCommand.Parameters.Clear();
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "[SP_TRAER_USUARIO_POR_NOMBRE]";
            sqlCommand.Parameters.AddWithValue("@nombre", txt_usuario.Text);
            DataTable dt_cliente = baseDeDatos.consulta_parametrizada(sqlCommand);

            if ((dt_cliente != null) && (dt_cliente.Rows.Count != 0))
            {
                sqlCommand.Parameters.Clear();
                return(dt_cliente);
            }
            else
            {
                sqlCommand.Parameters.Clear();
                MessageBox.Show("Usuario Inexistente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }