using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Class_Links db = new Class_Links();
            DataTable dt = new DataTable();
            if (int.Parse(Session["UserTypeID"].ToString()) == 1)
            {
                dt = db.dbOut("SELECT        TOP (100) PERCENT linkID, LinkDescript, linkL, permis, LinkSortNum, IsAdminLink  FROM            tblLinks  WHERE        (IsAdminLink = 1)  ORDER BY LinkSortNum");
            }
            else if (int.Parse(Session["UserTypeID"].ToString()) == 2)
            {
                dt = db.dbOut("SELECT        TOP (100) PERCENT linkID, LinkDescript, linkL, permis, LinkSortNum, IsUserWebSit  FROM            tblLinks  WHERE        (IsUserWebSit = 1)  ORDER BY LinkSortNum");
            }
            else if (int.Parse(Session["UserTypeID"].ToString()) == 3)
            {
                dt = db.dbOut("SELECT TOP (100) PERCENT linkID, LinkDescript, linkL, LinkSortNum, IsGuset   FROM   tblLinks   WHERE        (IsGuset = 1)  ORDER BY LinkSortNum");
            }
            else
            {
                dt = db.dbOut("SELECT linkID, LinkDescript, linkL, withOutLogin, LinkSortNum  FROM tblLinks  WHERE   (IsAllShow = 1) ORDER BY LinkSortNum");
            }
            Grd_Links.DataSource = dt;
            Grd_Links.DataBind();
        }
        catch
        {
            Class_Links db = new Class_Links();
            DataTable dt = new DataTable();
            dt = db.dbOut("SELECT linkID, LinkDescript, linkL, withOutLogin, LinkSortNum  FROM tblLinks  WHERE   (IsAllShow = 1) ORDER BY LinkSortNum");
            Grd_Links.DataSource = dt;
            Grd_Links.DataBind();
        }

    }
}
