Exemplo n.º 1
0
 private void PopulaDados()
 {
     this.Cursor = Cursors.WaitCursor;
     DataCatCambio.Rows.Clear();
     catCambios = catCambioDAO.FindAll();
     for (int i = 0; i < catCambios.Count; i++)
     {
         DataCatCambio.Rows.Add();
         DataCatCambio.Rows[i].Cells[0].Value           = catCambios[i].Kurst;
         DataCatCambio.Rows[i].Cells[0].ReadOnly        = true;
         DataCatCambio.Rows[i].Cells[0].Style.BackColor = Color.LightSlateGray;
         DataCatCambio.Rows[i].Cells[1].Value           = catCambios[i].Descricao;
         if (this.IsEdit)
         {
             DataCatCambio.Rows[i].Cells[1].ReadOnly        = false;
             DataCatCambio.Rows[i].Cells[1].Style.BackColor = Color.White;
         }
         else
         {
             DataCatCambio.Rows[i].Cells[1].ReadOnly        = true;
             DataCatCambio.Rows[i].Cells[1].Style.BackColor = Color.LightGray;
         }
     }
     DataCatCambio.AllowUserToAddRows = false;
     this.Cursor = Cursors.Default;
     DataCatCambio.Focus();
 }
Exemplo n.º 2
0
        private void BtnFiltro_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                IList <CategoriaCambio> categorias = catCambioDAO.FindByCategoriaDescricao(ValCategoria.Text.ToString(),
                                                                                           ValDescricao.Text.ToString());

                if (categorias != null && categorias.Count > 0)
                {
                    DataCatCambio.Rows.Clear();
                    for (int i = 0; i < categorias.Count; i++)
                    {
                        DataCatCambio.Rows.Add();
                        DataCatCambio.Rows[i].Cells[0].Value           = categorias[i].Kurst;
                        DataCatCambio.Rows[i].Cells[0].ReadOnly        = true;
                        DataCatCambio.Rows[i].Cells[0].Style.BackColor = Color.LightSlateGray;
                        DataCatCambio.Rows[i].Cells[1].Value           = categorias[i].Descricao;
                        if (this.IsEdit)
                        {
                            DataCatCambio.Rows[i].Cells[1].ReadOnly        = false;
                            DataCatCambio.Rows[i].Cells[1].Style.BackColor = Color.White;
                        }
                        else
                        {
                            DataCatCambio.Rows[i].Cells[1].ReadOnly        = true;
                            DataCatCambio.Rows[i].Cells[1].Style.BackColor = Color.LightGray;
                        }
                    }
                    DataCatCambio.Focus();
                }

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBoxEx.Show(this, ex.Message, "Erro Categoria cambio",
                                  MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }