예제 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                if (dataGridView1.Columns[e.ColumnIndex] is DataGridViewButtonColumn)
                {
                    Int32  id = Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString());
                    Boleto o  = BoletoBLL.get(id);
                    if (o.Recebido)
                    {
                        MessageBox.Show("Essa boleta já está quitada.");
                    }
                    else
                    {
                        o.Recebido     = true;
                        o.DataRecebido = DateTime.Now.Date;
                        BoletoBLL.save(ref o);

                        atuGrid();
                    }
                }
            }
        }
예제 #2
0
파일: Retorno.cs 프로젝트: oraculum/CEF
        private void btnLocalizar_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "";
            intQtde = 0;

            OpenFileDialog openFile = new OpenFileDialog();

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                txtFileRetorno.Text = openFile.FileName;
                int          nLoopCtr     = 1;
                int          intNossoNum  = 0;
                Boolean      blnBolNaoLoc = false;
                StreamReader sr           = new StreamReader(txtFileRetorno.Text);

                String[] fields = new String[3];

                while (true)
                {
                    string line = sr.ReadLine();
                    if (line == null)
                    {
                        break;
                    }

                    toolStripStatusLabel1.Text = "Processando linhas " + nLoopCtr.ToString();
                    Application.DoEvents();
                    nLoopCtr++;

                    fields = processLine(line);
                    if (fields[0] != null)
                    {
                        BolProcessada bp = new BolProcessada();
                        bp.NossoNum = fields[0];

                        intNossoNum += 1;
                        Boleto b = BoletoBLL.get(Int32.Parse(fields[0]));
                        if (b.ID > 0)
                        {
                            b.DataRecebido  = DateTime.Parse(fields[1]);
                            b.ValorRecebido = Decimal.Parse(fields[2]);
                            b.Recebido      = true;

                            BoletoBLL.save(ref b);

                            bp.Cliente   = b.Cliente.Nome;
                            bp.Valor     = b.Valor;
                            bp.ValorPago = b.ValorRecebido;
                        }
                        else
                        {
                            bp.Cliente   = "*** NOSSO NUMERO NÃO LOCALIZADO NO BANCO DE DADOS ***";
                            blnBolNaoLoc = true;
                        }

                        listBol.Add(bp);
                        toolStripStatusLabel1.Text = "Processando Nosso Num.: " + fields[0];
                    }
                }

                if (intQtde != intNossoNum)
                {
                    MessageBox.Show("Atenção: arq. retorno " + intQtde.ToString() +
                                    "/nNosso Num encontrados " + intNossoNum.ToString());
                }

                if (blnBolNaoLoc)
                {
                    MessageBox.Show("Existem boletas que não foram localizadas no banco de dados");
                }

                dataGridView1.DataSource = listBol;

                toolStripStatusLabel1.Text = "Processo finalizado. Total boletas " + intQtde;
            }
        }