コード例 #1
0
 private void btnGrava_Click(object sender, EventArgs e)
 {
     if (rbtSeparar.Checked == true)
     {
         DALConexao  cx     = new DALConexao(DadosDaConexao.StringDeConexao);
         BLLVenda    bll    = new BLLVenda(cx);
         ModeloVenda modelo = bll.CarregaModeloFatura(Convert.ToInt32(txtCodVenda.Text));
         modelo.CodEquipe   = Convert.ToInt32(txtCodEquipe.Text);
         modelo.NomeEquipe  = txtNomeEquipe.Text;
         modelo.DataIni     = DateTime.Now;
         modelo.VenCod      = Convert.ToInt32(txtCodVenda.Text);
         modelo.ValorSepara = Convert.ToDouble(txtValor.Text);
         bll.AlterarS(modelo);
         btnCancel_Click(sender, e);
         this.AtualizaCabecalhoDGCompra();
         txtCodVenda.Text = null;
     }
     if (rbtSeparados.Checked == true && ckbDivide.Checked == false)
     {
         DALConexao  cx     = new DALConexao(DadosDaConexao.StringDeConexao);
         BLLVenda    bll    = new BLLVenda(cx);
         ModeloVenda modelo = bll.CarregaModeloFatura(Convert.ToInt32(txtCodVenda.Text));
         modelo.DataFim = DateTime.Now;
         bll.AlterarSf(modelo);
         btnCancel_Click(sender, e);
         this.AtualizaCabecalhoDGSeparados();
         txtCodVenda.Text = null;
     }
 }
コード例 #2
0
 private void txtCodVenda_Leave(object sender, EventArgs e)
 {
     try
     {
         if (Convert.ToInt32(txtCodVenda.Text) > 0)
         {
             DALConexao  cx     = new DALConexao(DadosDaConexao.StringDeConexao);
             BLLVenda    bll    = new BLLVenda(cx);
             ModeloVenda modelo = bll.CarregaModeloFatura(Convert.ToInt32(txtCodVenda.Text));
             txtCodVenda.Text    = modelo.VenCod.ToString();
             txtNomeCliente.Text = modelo.VenNome.ToString();
             txtCodEquipe.Text   = modelo.CodEquipe.ToString();
             txtNomeEquipe.Text  = modelo.NomeEquipe.ToString();
             txtValor.Text       = modelo.VenTotalgeral.ToString();
             txtNomeEquipe.Focus();
         }
     }catch (Exception erro)
     {
         MessageBox.Show(erro.Message);
     }
 }