Пример #1
0
 private void BtnFiltrar_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         int count = Int32.Parse(ValLinhas.Text);
         idiomas = idiomaDAO.FindByCountAndFilter(count, ValIdioma.Text.ToString(), ValDescricao.Text.ToString());
         DataIdiomas.Rows.Clear();
         if (idiomas != null)
         {
             for (int i = 0; i < idiomas.Count; i++)
             {
                 DataIdiomas.Rows.Add();
                 DataIdiomas.Rows[i].Cells[0].Value           = idiomas[i].Langu;
                 DataIdiomas.Rows[i].Cells[0].ReadOnly        = true;
                 DataIdiomas.Rows[i].Cells[0].Style.BackColor = Color.LightSlateGray;
                 DataIdiomas.Rows[i].Cells[1].Value           = idiomas[i].Denominacao;
                 DataIdiomas.Rows[i].Cells[1].ReadOnly        = true;
                 DataIdiomas.Rows[i].Cells[1].Style.BackColor = Color.LightGray;
             }
         }
         this.Cursor = Cursors.Default;
     }
     catch (Exception ex)
     {
         this.Cursor = Cursors.Default;
         MessageBoxEx.Show(this, ex.Message, "Erro Pesquisa Idiomas",
                           MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        public DlgFormIdiomas()
        {
            try
            {
                InitializeComponent();

                this.Cursor = Cursors.WaitCursor;

                Image  image  = Image.FromFile(iconSystem);
                Bitmap bitmap = new Bitmap(image);
                this.Icon = Icon.FromHandle(bitmap.GetHicon());

                image            = Image.FromFile(actionDown);
                BtnColapse.Image = image;
                image            = Image.FromFile(actionOK);
                BtnOK.Image      = image;
                image            = Image.FromFile(actionFilter);
                BtnFiltrar.Image = image;
                image            = Image.FromFile(actionClose);
                BtnSair.Image    = image;

                SplitDlgFilter.Panel1Collapsed = true;
                SplitDlgFilter.Panel2Collapsed = false;
                idiomaDAO = new IdiomaDAO();

                idiomas = idiomaDAO.FindByCountAndFilter(50, "", "");
                if (idiomas != null)
                {
                    for (int i = 0; i < idiomas.Count; i++)
                    {
                        DataGridViewRow row = (DataGridViewRow)DataIdiomas.Rows[0].Clone();
                        row.Cells[0].Value           = idiomas[i].Langu;
                        row.Cells[0].ReadOnly        = true;
                        row.Cells[0].Style.BackColor = Color.LightSlateGray;
                        row.Cells[1].Value           = idiomas[i].Denominacao;
                        row.Cells[1].ReadOnly        = true;
                        row.Cells[1].Style.BackColor = Color.LightGray;
                        DataIdiomas.Rows.Add(row);
                    }
                }
                this.Cursor    = Cursors.Default;
                this.CodIdioma = "";
                ValIdioma.Clear();
                ValDescricao.Clear();
                ValLinhas.Text = "50";

                DataIdiomas.AllowUserToAddRows = false;
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(this, ex.Message, "Erro Pesquisa Idiomas",
                                  MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }