コード例 #1
0
ファイル: FrmIdioma.cs プロジェクト: acegictb/acegi
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (IsInsert)
                {
                    for (int i = 0; i < DataIdioma.Rows.Count; i++)
                    {
                        if (DataIdioma.Rows[i].Selected)
                        {
                            UtilObject.DeleteSelected(DataIdioma);
                        }
                    }
                }
                else
                {
                    DialogResult result = MessageBoxEx.Show(DataIdioma, "Deseja excluir registros!", "Confirmação",
                                                            MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (result == DialogResult.Yes)
                    {
                        this.Cursor = Cursors.WaitCursor;
                        IList <Idioma> ids = new List <Idioma>();

                        for (int i = 0; i < DataIdioma.Rows.Count; i++)
                        {
                            if (DataIdioma.Rows[i].Selected)
                            {
                                Idioma idioma = idiomaDAO.FindByLangu(DataIdioma.Rows[i].Cells[1].Value.ToString());
                                if (idioma != null)
                                {
                                    idiomaDAO.Delete(idioma);
                                }
                            }
                        }

                        UtilObject.DeleteSelected(DataIdioma);

                        this.principal.exibirMessage(actionOK, "Idioma(s) excluido com sucesso...", "S");
                        this.Cursor = Cursors.Default;
                    }
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBoxEx.Show(DataIdioma, ex.Message, "Erro Idiomas",
                                  MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            DataIdioma.Focus();
        }
コード例 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            IdiomaDAO dao = new IdiomaDAO();

            dao.Delete(idiomaSelecionado);
        }