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; } }
private void BtnRegistrar_Click(object sender, EventArgs e) { CsEmpresaCommand csEmpresaCommand = new CsEmpresaCommand(); csEmpresaCommand.InsertObjTrans(CsEmpresa_Preencher()); MessageBox.Show("Cadastro Executado"); this.DialogResult = DialogResult.No; }
private CsEmpresa CsEmpresa_Fk_Preencher() { CsEmpresaCommand csEmpresaCommand = new CsEmpresaCommand(); return(csEmpresaCommand.SeacherNameEmpresa(" WHERE nome = @Nome ", CboxEmpresa.Text)[0]); }