Esempio n. 1
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtNombre.Text) || string.IsNullOrEmpty(txtRaiz.Text) || String.IsNullOrEmpty(txtHijo.Text))
                {
                    throw new Exception(Mensajes.CamposVacios);
                }
                //if (item.Nombre == txtNombre.Text || item.Comando == txtComando.Text)
                //    throw new Exception(Mensajes.NingunCambio);

                item = new Modulos()
                {
                    IDModulo = (txtHijo.Text == "") ? 0 : Convert.ToInt32(txtHijo.Text),
                    Comando  = txtRaiz.Text,
                    Nombre   = txtNombre.Text,
                    Estado   = chEstado.Checked,
                };
                if (!metodo.Grabar(item))
                {
                    throw new Exception(metodo.Error);
                }

                XtraMessageBox.Show("Engraving done successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Mostrar();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }