Ejemplo n.º 1
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtNombre.Text))
            {
                XtraMessageBox.Show(Mensajes.CamposVacios, "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            var metodo = new GrupoBLL();
            var Result = true;

            if (item == null)
            {
                if (!metodo.Grabar(
                        new Grupo
                {
                    Nombre = txtNombre.Text,
                    Estado = (chEstado.Checked) ? "A" : "E",
                }
                        ))
                {
                    Result = false;
                }
            }
            else
            {
                item.Nombre = txtNombre.Text;
                item.Estado = (chEstado.Checked) ? "A" : "E";

                if (!metodo.Update(item))
                {
                    Result = false;
                }
            }

            if (!Result)
            {
                XtraMessageBox.Show(metodo.error, "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                function();
            }
        }