private void CadastroCotistaLoad() { DataTable Distribuidores = new BL_Distribuidor().DadosTable(); Distribuidores.DefaultView.Sort = "RAZAOSOCIAL"; cmbdistribuidor.DataSource = Distribuidores.DefaultView.ToTable(); cmbdistribuidor.DisplayMember = "RAZAOSOCIAL"; cmbdistribuidor.ValueMember = "CODIGO"; cmbdistribuidor.SelectedIndex = -1; DataTable Alocadores = new BL_Alocador().DadosTable(); Alocadores.DefaultView.Sort = "NOME"; cmbalocador.DataSource = Alocadores.DefaultView.ToTable(); cmbalocador.DisplayMember = "NOME"; cmbalocador.ValueMember = "ID"; cmbalocador.SelectedIndex = -1; }
private void BtnIncluir_Click(object sender, EventArgs e) { //Valida COD if (TextBoxCOD.Text.Length == 0) { MessageBox.Show("Favor informar o código"); TextBoxCOD.Focus(); return; } //Valida Operação if (CmbBoxOp.SelectedIndex == -1) { MessageBox.Show("Favor informar a operação"); CmbBoxOp.Focus(); return; } //Valida Valor if (TextBoxValor.Text.Length == 0 && CmbBoxOp.Text != "Resgate Total") { MessageBox.Show("Favor informar o valor da operação"); TextBoxValor.Focus(); return; } //Valida Conta se for Resgate if (TextBoxBanco.Text.Length == 0 && CmbBoxOp.Text != "Aplicação") { MessageBox.Show("Favor informar o banco"); TextBoxBanco.Focus(); return; } if (TextBoxAg.Text.Length == 0 && CmbBoxOp.Text != "Aplicação") { MessageBox.Show("Favor informar a Agencia"); TextBoxAg.Focus(); return; } if (TextBoxConta.Text.Length == 0 && CmbBoxOp.Text != "Aplicação") { MessageBox.Show("Favor informar a Conta"); TextBoxConta.Focus(); return; } if (TextBoxDCC.Text.Length == 0 && CmbBoxOp.Text != "Aplicação") { MessageBox.Show("Favor informar o Digito"); TextBoxDCC.Focus(); return; } DistribuidorAux = Distribuidores.FirstOrDefault(x => x.CNPJ.ToString() == CmbBoxDistribuidor.SelectedValue.ToString()); string NOME = DistribuidorAux.PREFIXOCEO + " " + TextBoxCOD.Text; long CPFCNPJ = DistribuidorAux.CNPJ; string OP; long CODFUND = Convert.ToInt64(CmbBoxFIQ.SelectedValue); decimal VALOR; string STATUS = "Pendente"; string CONTA; if (CmbBoxOp.Text == "Aplicação") { OP = "AP"; VALOR = Convert.ToDecimal(TextBoxValor.Text); } else if (CmbBoxOp.Text == "Resgate") { OP = "R"; VALOR = Convert.ToDecimal(TextBoxValor.Text); } else if (CmbBoxOp.Text == "Resgate por Cotas") { OP = "RC"; VALOR = Convert.ToDecimal(TextBoxValor.Text); } else { OP = "RT"; VALOR = 0; } if (OP != "AP") { long BANCO = Convert.ToInt16(TextBoxBanco.Text); long AGENCIA = Convert.ToInt64(TextBoxAg.Text); long CC = Convert.ToInt64(TextBoxConta.Text); long DIGITO = Convert.ToInt64(TextBoxDCC.Text); CONTA = BANCO.ToString() + " - " + AGENCIA.ToString() + " - " + CC.ToString() + " - " + DIGITO.ToString(); } else { CONTA = "VIA TED"; } DataGridBoletas.Rows.Add(new string[] { NOME, CPFCNPJ.ToString(), "", OP, Fundos.FirstOrDefault(x => x.CODFUND == CODFUND).NOME, CODFUND.ToString(), VALOR.ToString(), CONTA, STATUS }); //Limpar Dados do DataGrid CmbBoxFIQ.SelectedIndex = -1; CmbBoxFIQ.Text = ""; //Limpa CmbBoxOp.SelectedIndex = -1; //limpa dados boleta TextBoxCOD.Text = ""; TextBoxValor.Text = ""; //Limpa dados conta credito TextBoxBanco.Text = ""; TextBoxAg.Text = ""; TextBoxConta.Text = ""; }