예제 #1
0
        public void ExcutaOpeçao(Caixa caixa, ArrayList Cad, Registro registro)
        {
            try
            {
                Serializar <Credito> c = new Serializar <Credito>("1");
                Serializar <Debito>  d = new Serializar <Debito>("2");
                Cad.Clear();
                Cad.AddRange(c.RetornarArquivoXML());
                Cad.AddRange(d.RetornarArquivoXML());
            }
            catch (Exception)
            {
                MessageBox.Show("Erro desconhecido!");
            }

            caixa.CarregaGrid();
        }
 public void ExcutaOpeçao(Caixa caixa, ArrayList cad, Registro registro)
 {
     cad.RemoveAt(caixa.dgvDados.CurrentRow.Index);
     caixa.CarregaGrid();
 }
        public void ExcutaOpeçao(Caixa caixa, ArrayList Cad, Registro registro)
        {
            int dia = 0, mes = 0, ano = 0;

            ArrayList Temp = new ArrayList();

            if (caixa.checkMes.Checked)
            {
                switch (caixa.comboMes.SelectedIndex)
                {
                case 0:
                    mes = 01;

                    break;

                case 1:
                    mes = 02;

                    break;

                case 2:
                    mes = 03;

                    break;

                case 3:
                    mes = 04;

                    break;

                case 4:
                    mes = 05;

                    break;

                case 5:
                    mes = 06;

                    break;

                case 6:
                    mes = 07;

                    break;

                case 7:
                    mes = 08;

                    break;

                case 8:
                    mes = 09;

                    break;

                case 9:
                    mes = 10;

                    break;

                case 10:
                    mes = 11;

                    break;

                case 11:
                    mes = 12;

                    break;
                }
                for (int i = 0; i < Cad.Count; i++)
                {
                    if (((Movimentaçao)Cad[i]).Data.Month == mes)
                    {
                        Temp.Add(Cad[i]);
                    }
                }
                caixa.CarregaGrid(Temp);
            }
            else
            if (caixa.checkPeriodo.Checked)
            {
                DateTime Inicial = caixa.dtpInicial.Value;
                DateTime Final   = caixa.dtpFinal.Value;
                for (int i = 0; i < Cad.Count; i++)
                {
                    if (((Movimentaçao)Cad[i]).Data >= Inicial && ((Movimentaçao)Cad[i]).Data <= Final)
                    {
                        Temp.Add(Cad[i]);
                    }
                }

                caixa.CarregaGrid(Temp);
            }
        }
        public void ExcutaOpeçao(Caixa caixa, ArrayList Cad, Registro registro)
        {
            if (registro.txtValor.Text != "" && registro.txtDescriçao.Text != "" && registro.comboNatureza.SelectedIndex == 0 || registro.comboNatureza.SelectedIndex == 1)
            {
                if (registro.comboNatureza.SelectedIndex == 0)
                {
                    Credito x = new Credito();


                    try
                    {
                        x.Data  = registro.dtpData.Value;
                        x.Valor = Convert.ToDouble(registro.txtValor.Text);
                        if (x.Valor <= 0)
                        {
                            throw new DivideByZeroException();
                        }

                        x.Descriçao = registro.txtDescriçao.Text;
                        x.Natureza  = "Crédito";
                        Cad.Add(x);
                        caixa.CarregaGrid();
                        registro.Close();
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Favor conferir se os dados de entrada de valor são numéricos.");
                    }
                    catch (DivideByZeroException)
                    {
                        MessageBox.Show("Verifique se os valores são maiores que zero.");
                    }
                    catch (StackOverflowException)
                    {
                        MessageBox.Show("O valor é muito grande.");
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Erro desconhecido!");
                    }
                }
                else
                if (registro.comboNatureza.SelectedIndex == 1)
                {
                    Debito x = new Debito();

                    try
                    {
                        x.Data  = registro.dtpData.Value;
                        x.Valor = Convert.ToDouble(registro.txtValor.Text);
                        if (x.Valor <= 0)
                        {
                            throw new DivideByZeroException();
                        }

                        x.Descriçao = registro.txtDescriçao.Text;
                        x.Natureza  = "Débito";
                        Cad.Add(x);
                        caixa.CarregaGrid();
                        registro.Close();
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Favor conferir se os dados de entrada de valor são numéricos.");
                    }
                    catch (DivideByZeroException)
                    {
                        MessageBox.Show("Verifique se os valores são maiores que zero.");
                    }
                    catch (StackOverflowException)
                    {
                        MessageBox.Show("O valor é muito grande.");
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Erro desconhecido!");
                    }
                }
            }
        }
예제 #5
0
 public void ExcutaOpeçao(Caixa caixa, ArrayList Cad, Registro registro)
 {
     Cad.Sort(new minha_comparaçao());
     caixa.CarregaGrid();
 }