Beispiel #1
0
        private void BtnFilter_Click(object sender, EventArgs e)
        {
            DlgFormPaises DlgFilter = new DlgFormPaises();
            Point         point     = new Point(this.principal.Location.X + 100, this.principal.Location.Y + 100);

            DlgFilter.Location      = point;
            DlgFilter.StartPosition = FormStartPosition.Manual;
            DlgFilter.ShowDialog();
            if (DlgFilter.CodPais != "")
            {
                Pais pais = paisDAO.FindByLand(DlgFilter.CodPais);
                if (pais != null)
                {
                    ValPais.Text = pais.Land;
                }
            }
        }
Beispiel #2
0
        private void DataPais_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Pais pais = paisDAO.FindByLand(DataPais.Rows[e.RowIndex].Cells[0].Value.ToString());

                if (pais != null)
                {
                    ValPais.Text   = pais.Land;
                    ValCodIso.Text = pais.PaisIso;
                    ValIdioma.Text = pais.Langu;
                    ValNome.Text   = pais.Nome;
                    if (pais.Idioma != null)
                    {
                        Idioma idioma = idiomaDAO.FindByID(pais.Idioma.Id);
                        if (idioma != null)
                        {
                            ValIdioma.Text = idioma.Langu;
                        }
                    }

                    splitPais.Panel1Collapsed = true;
                    splitPais.Panel2Collapsed = false;

                    if (this.IsEdit || this.IsInsert)
                    {
                        ValPais.Enabled   = true;
                        ValCodIso.Enabled = true;
                        ValIdioma.Enabled = true;
                        ValNome.Enabled   = true;

                        if (IsEdit)
                        {
                            BtnSave.Enabled   = true;
                            ValPais.Enabled   = false;
                            ValCodIso.Enabled = false;
                            BtnSave.Enabled   = true;
                            ValNome.Focus();
                        }
                        if (IsInsert)
                        {
                            BtnSave.Enabled = true;
                            ValPais.Focus();
                        }
                    }
                    else
                    {
                        ValPais.Enabled   = false;
                        ValCodIso.Enabled = false;
                        ValIdioma.Enabled = false;
                        ValNome.Enabled   = false;
                    }

                    BtnEdit.Visible   = false;
                    BtnVoltar.Visible = true;
                    BtnDelete.Enabled = false;
                    BtnNew.Enabled    = false;
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(this, ex.Message, "Erro Paises",
                                  MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }