コード例 #1
0
ファイル: TipoCurso.cs プロジェクト: maziesmith/CSEWeb
    public static String Obtener_nombre(String codigo)
    {
        String nombre = "";

        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, codigo) > 0)
        {
            nombre = dt[0].xTipoCurso;
        }

        return(nombre);
    }
コード例 #2
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;
    }