private void CsEmpresa_Preencher() { CsEmpresaCommand csEmpresaCommand = new CsEmpresaCommand(); CsCollectionEmpresa csCollectionEmpresa = csEmpresaCommand.SeacherNameEmpresa(null, null); try { foreach (CsEmpresa item in csCollectionEmpresa) { CboxEmpresa.Items.Add(item.Nome); } } catch (IndexOutOfRangeException) { MessageBox.Show("Não há dados registrados em empresa."); } catch (Exception exception) { MessageBox.Show("Não foi possivel preencher empresa, detalhes: " + exception.Message); } finally { CboxEmpresa.SelectedIndex = 0; } }
public CsCollectionEmpresa CsEmpresaParametroColecao_Returno(CommandType commandType, string oleDbCommand, string where, string name) { csEmpresa = new CsEmpresa(); csCollectionEmpresa = new CsCollectionEmpresa(); csCommand = new CsCommand(); csCommand.ParameterCollection_Clear(); if (!(String.IsNullOrEmpty(name))) { csCommand.ParameterCollection_Add("@Name", name); } DataTable dataTable = csCommand.ExecuteCommandConsult(commandType, oleDbCommand); foreach (DataRow linha in dataTable.Rows) { csCollectionEmpresa.Add(csEmpresa.CsEmpresaDataGridView(linha)); } return(csCollectionEmpresa); }