void FrmLancarNotasLoad(object sender, EventArgs e) { clientesEntity = new ClientesEntity(); notasEntity = new NotasEntity(); cboCliente.DataSource = clientesEntity.Get(); cboCliente.DisplayMember = "Nome"; cboCliente.ValueMember = "Id"; string[] colunas = { "Quantidade", "Código", "Unitário", "Total", "ID" }; Validation.CreateDtColumns(ref _dtItensPedido, colunas); if (Idnota > 0) { Nota nota = notasEntity.Get(Idnota).FirstOrDefault(); if (nota.Cliente == null || nota.Cliente.Id == 0) { chkClienteNaoDefinido.Checked = true; ChkClienteNaoDefinidoCheckedChanged(null, null); txtCliente.Text = nota.Cliente.Nome; } else { cboCliente.SelectedValue = nota.Cliente.Id; } foreach (var notaDetalhe in nota.NotasDetalhes) { int quantidade = notaDetalhe.Quantidade; string codigo = notaDetalhe.Codigo; decimal unitario = notaDetalhe.Valor; decimal total = notaDetalhe.Total; int idtipoproduto = notaDetalhe.TipoProduto.Id; string[] linha = { quantidade.ToString(), codigo, Validation.Currency(unitario), Validation.Currency(total), idtipoproduto.ToString() }; _dtItensPedido.Rows.Add(linha); _totalgeral += total; } lblTotal.Text = Validation.Currency(_totalgeral); } AtualizaGrid(); }
void FrmCadastroClientes_Load(object sender, EventArgs e) { clientesEntity = new ClientesEntity(); AtualizaList(); }