public void GetAllClientes() { IBLLCliente _BLLCliente = new BLLCliente(); List <Cliente> _ListCliente = new List <Cliente>(); _ListCliente = _BLLCliente.MostrarClientes(); System.Diagnostics.Debug.Write(_ListCliente[0].IDCliente); }
/// <summary> /// Metodo para mostrar los clientes de la base de datos en el datagridview /// </summary> public void MostrarClientes() { IBLLCliente _BLLCliente = new BLLCliente(); dgvClientes.AutoGenerateColumns = false; dgvClientes.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; try { dgvClientes.DataSource = _BLLCliente.MostrarClientes(); } catch (Exception er) { StringBuilder msg = new StringBuilder(); msg.AppendFormat("Message {0}\n", er.Message); msg.AppendFormat("Source {0}\n", er.Source); msg.AppendFormat("InnerException {0}\n", er.InnerException); msg.AppendFormat("StackTrace {0}\n", er.StackTrace); msg.AppendFormat("TargetSite {0}\n", er.TargetSite); _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString()); MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }