Наследование: System.Web.UI.MasterPage
Пример #1
0
    protected void rpt_cursos_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        // Se busca el curso que se esta modificando
        int cCurso = 0;

        Int32.TryParse(e.CommandArgument.ToString(), out cCurso);
        CSEDataSet.CursoDataTable dt      = new CSEDataSet.CursoDataTable();
        CursoTableAdapter         adapter = new CursoTableAdapter();

        CSEDataSet.CursoRow row = null;
        if (adapter.FillBycCurso(dt, cCurso) > 0)
        {
            String mensaje = "";
            row = dt[0];

            // Se realiza el comando llamado
            if (e.CommandName == "Publicar")
            {
                row.iPublicado = !row.iPublicado;
                adapter.Update(row);
                if (row.iPublicado)
                {
                    mensaje = "Se ha publicado el curso especificado";
                }
                else
                {
                    mensaje = "El curso especificado ya no es público";
                }
            }
            else if (e.CommandName == "Subir")
            {
                subir_curso(cCurso);
                mensaje = "Se ha subido de posición el curso especificado";
            }
            else if (e.CommandName == "Bajar")
            {
                bajar_curso(cCurso);
                mensaje = "Se ha bajado de posición el curso especificado";
            }
            else if (e.CommandName == "Eliminar")
            {
                adapter.Delete(cCurso);
                mensaje = "Se ha eliminado el curso especificado";
            }

            if (mensaje != "")
            {
                Admin_MasterPage admin_master = (Admin_MasterPage)Master;
                ((Label)admin_master.FindControl("lbl_mensaje")).Text    = mensaje;
                ((Label)admin_master.FindControl("lbl_mensaje")).Visible = true;
            }
        }

        obtener_cursos();
    }
Пример #2
0
    protected void btn_agregar_Click(object sender, EventArgs e)
    {
        String mensaje = "";
        int cCurso = obtener_curso_querystring();

        // Se verifica si se esta agregando o modificando un curso.
        if (cCurso != 0)
        {
            // Se modifica el curso
            if (modificar_curso(cCurso, out mensaje))
            {
                mensaje = "El curso se ha modificado satisfactoriamente";
                Admin_MasterPage admin_master = (Admin_MasterPage)Master;
                ((Label)admin_master.FindControl("lbl_mensaje")).Text = mensaje;
                ((Label)admin_master.FindControl("lbl_mensaje")).Visible = true;
            }
            else
            {
                Admin_MasterPage admin_master = (Admin_MasterPage)Master;
                ((Label)admin_master.FindControl("lbl_mensaje")).Text = mensaje;
                ((Label)admin_master.FindControl("lbl_mensaje")).Visible = true;
            }
        }
        else
        {
            // Se agrega el curso nuev
            if (agregar_curso(out mensaje))
            {
                mensaje = "El curso se ha creado satisfactoriamente. Recuerde hacerlo público en el botón Publicar";
                mensaje = HttpUtility.UrlEncode(mensaje);
                Response.Redirect("~/Admin/AdministrarCursos.aspx?mensaje=" + mensaje);
            }
            else
            {
                Admin_MasterPage admin_master = (Admin_MasterPage)Master;
                ((Label)admin_master.FindControl("lbl_mensaje")).Text = mensaje;
                ((Label)admin_master.FindControl("lbl_mensaje")).Visible = true;
            }
        }

    }
Пример #3
0
    protected void btn_agregar_Click(object sender, EventArgs e)
    {
        String mensaje = "Se ha agregado el usuario exitosamente";

        try
        {
            MembershipUser newUser = Membership.CreateUser(txt_usuario.Text, txt_contrasena.Text, "*****@*****.**");

            txt_usuario.Text    = "";
            txt_contrasena.Text = "";
        }
        catch (Exception ex)
        {
            mensaje = "Se ha generado un error creando el usuario, por favor intentelo nuevamente";
            //throw ex;
        }

        Admin_MasterPage admin_master = (Admin_MasterPage)Master;

        ((Label)admin_master.FindControl("lbl_mensaje")).Text    = mensaje;
        ((Label)admin_master.FindControl("lbl_mensaje")).Visible = true;
    }
Пример #4
0
    protected void btn_modificar_Click(object sender, EventArgs e)
    {
        String mensaje = "Se han modificado los Tipos de Curso exitosamente";

        CSEDataSetTableAdapters.Tipo_cursoTableAdapter adapter = new CSEDataSetTableAdapters.Tipo_cursoTableAdapter();
        CSEDataSet.Tipo_cursoDataTable dt  = new CSEDataSet.Tipo_cursoDataTable();
        CSEDataSet.Tipo_cursoRow       row = null;

        if (adapter.FillByxCodigo(dt, "PETR") > 0)
        {
            row            = dt[0];
            row.xTipoCurso = txt_tipocurso1.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el Tipo de Curso 1, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el Tipo de Curso 1, por favor vuelva a intentarlo";
        }

        if (adapter.FillByxCodigo(dt, "COMP") > 0)
        {
            row            = dt[0];
            row.xTipoCurso = txt_tipocurso2.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el Tipo de Curso 2, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el Tipo de Curso 2, por favor vuelva a intentarlo";
        }

        if (adapter.FillByxCodigo(dt, "CONT") > 0)
        {
            row            = dt[0];
            row.xTipoCurso = txt_tipocurso3.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el Tipo de Curso 3, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el Tipo de Curso 3, por favor vuelva a intentarlo";
        }

        if (adapter.FillByxCodigo(dt, "PLAN") > 0)
        {
            row            = dt[0];
            row.xTipoCurso = txt_tipocurso4.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el Tipo de Curso 4, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el Tipo de Curso 4, por favor vuelva a intentarlo";
        }

        if (adapter.FillByxCodigo(dt, "OTR") > 0)
        {
            row            = dt[0];
            row.xTipoCurso = txt_tipocurso5.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el Tipo de Curso 5, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el Tipo de Curso 5, por favor vuelva a intentarlo";
        }

        Admin_MasterPage admin_master = (Admin_MasterPage)Master;

        ((Label)admin_master.FindControl("lbl_mensaje")).Text    = mensaje;
        ((Label)admin_master.FindControl("lbl_mensaje")).Visible = true;
    }
Пример #5
0
    protected void btn_modificar_Click(object sender, EventArgs e)
    {
        String mensaje = "Se han modificado las variables exitosamente";

        CSEDataSetTableAdapters.VariableTableAdapter adapter = new CSEDataSetTableAdapters.VariableTableAdapter();
        CSEDataSet.VariableDataTable dt  = new CSEDataSet.VariableDataTable();
        CSEDataSet.VariableRow       row = null;

        if (adapter.FillByxVariable(dt, "TLF") > 0)
        {
            row = dt[0];
            row.xInformacion = txt_telefono.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el teléfono, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el teléfono, por favor vuelva a intentarlo";
        }

        if (adapter.FillByxVariable(dt, "EMAIL") > 0)
        {
            row = dt[0];
            row.xInformacion = txt_email.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el email, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el email, por favor vuelva a intentarlo";
        }

        if (adapter.FillByxVariable(dt, "INFO_ADICIONAL") > 0)
        {
            row = dt[0];
            row.xInformacion = txt_info_adicional.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando la información adicional, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con la información adicional, por favor vuelva a intentarlo";
        }

        if (adapter.FillByxVariable(dt, "RIF") > 0)
        {
            row = dt[0];
            row.xInformacion = txt_rif.Text;
            if (adapter.Update(row) <= 0)
            {
                mensaje = "Ha ocurrido un error actualizando el Rif, por favor vuelva a intentarlo";
            }
        }
        else
        {
            mensaje = "Ha ocurrido un error con el Rif, por favor vuelva a intentarlo";
        }

        Admin_MasterPage admin_master = (Admin_MasterPage)Master;

        ((Label)admin_master.FindControl("lbl_mensaje")).Text    = mensaje;
        ((Label)admin_master.FindControl("lbl_mensaje")).Visible = true;
    }