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();
            }
        }
Ejemplo n.º 2
0
    public static Grupo ActualizarGrupo(string nombre, string idEvento, string id)
    {
        Grupo  objGrupoModelo    = GrupoBLL.SelectCantActual(Convert.ToInt32(idEvento));
        int    cantidadActual    = objGrupoModelo.IdEvento;
        Evento objEvento         = EventoBLL.SelectById(Convert.ToInt32(idEvento));
        int    cantidadPermitida = objEvento.CantidadGrupos;

        if (cantidadActual <= cantidadPermitida)
        {
            GrupoBLL.Update(nombre, idEvento, Convert.ToInt32(id));
            Grupo objGrupo = GrupoBLL.SelectById(Convert.ToInt32(id));
            return(objGrupo);
        }
        else
        {
            Grupo objGrupo = new Grupo();
            objGrupo.Nombre = "NO";
            return(objGrupo);
        }
    }