示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string cid     = "";
        Route  myRoute = RouteData.Route as Route;

        if (myRoute != null)
        {
            PageIdx = RouteData.Values["pageindex"] == null ? 1 : int.Parse(RouteData.Values["pageindex"].ToString());
            cid     = RouteData.Values["cid"].ToString();
        }
        else
        {
            cid     = Request.QueryString["cid"];
            PageIdx = Request.QueryString["pageindex"] == null ? 1 : int.Parse(Request.QueryString["pageindex"]);
        }

        if (cid == null)
        {
            Response.Redirect("/index");
        }
        unitname = "/catalog/" + cid;
        //List<Banner.MainData> banner1 = new List<Banner.MainData>();
        //if (Request.QueryString["kind"] == "preview")
        //    banner1 = Banner.DbHandle.Banner_Get_list(1, "preview");
        //else
        //    banner1 = Banner.DbHandle.Banner_Get_list(1);


        List <article.MainData> hotlist = new List <article.MainData>();

        hotlist = article.Web.Recommend_list(int.Parse(cid));
        Repeaterbanner.DataSource = hotlist;
        Repeaterbanner.DataBind();


        hotlist = article.DbHandle.Get_article_list(cid, "", PageSize, PageIdx);
        foreach (var t in hotlist)
        {
            Totalrow = t.TotalRows;
            break;
        }
        hot_list_detail.DataSource = hotlist;
        hot_list_detail.DataBind();
        hotlist.Clear();
        // hotlist = article.DbHandle.Get_article_list("1,2,3,4,5,6", "",5,1);
        pagetitle         = Unitlib.Get_title((List <Unitlib.MenuModel>)Session["webmenu"], int.Parse(cid));
        Session["active"] = Unitlib.Set_activeId((List <Unitlib.MenuModel>)Session["webmenu"], int.Parse(cid));
        Session["title"]  = pagetitle + "│" + Application["site_name"];
        Breadcrumb        = Unitlib.Get_Breadcrumb((List <Unitlib.MenuModel>)Session["webmenu"], int.Parse(cid));
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection baglanti = new SqlConnection(@"Data Source=SHYLQ\MSSQLSERVER1;Initial Catalog=dbKırtasiye;User ID=sa;Password=12345678");

            baglanti.Open();
            SqlDataAdapter dapt = new SqlDataAdapter("select * from viewBanners", baglanti);

            DataTable dt = new DataTable();

            dapt.Fill(dt);

            Repeaterbanner.DataSource = dt; //repeater'ın veri kaynağı dt'dir.
            Repeaterbanner.DataBind();      // Repeater'ı alacağın bilgilerle doldur.
            baglanti.Close();
        }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string cid     = "";
        Route  myRoute = RouteData.Route as Route;

        if (myRoute != null)
        {
            PageIdx = RouteData.Values["pageindex"] == null ? 1 : int.Parse(RouteData.Values["pageindex"].ToString());
            cid     = RouteData.Values["cid"].ToString();
        }
        else
        {
            cid     = Request.QueryString["cid"];
            PageIdx = Request.QueryString["pageindex"] == null ? 1 : int.Parse(Request.QueryString["pageindex"]);
        }

        if (cid == null)
        {
            Response.Redirect("/index");
        }
        unitname = "/catalog/" + cid;
        List <Banner.MainData> banner1 = new List <Banner.MainData>();

        if (Request.QueryString["kind"] == "preview")
        {
            banner1 = Banner.DbHandle.Banner_Get_list(1, "preview");
        }
        else
        {
            banner1 = Banner.DbHandle.Banner_Get_list(1);
        }
        Repeaterbanner.DataSource = banner1;
        Repeaterbanner.DataBind();
        banner1.Clear();

        List <article.MainData> hotlist = new List <article.MainData>();

        hotlist = article.DbHandle.Get_article_list(cid, "", PageSize, PageIdx);

        foreach (var p in hotlist)
        {
            Totalrow = p.TotalRows;
            break;
        }

        hot_list_detail.DataSource = hotlist;
        hot_list_detail.DataBind();
        hotlist.Clear();


        List <Unitlib.MenuModel> subMenu = (List <Unitlib.MenuModel>)Session["webmenu"];
        var data = subMenu.SelectMany(x => x.Detial).FirstOrDefault(c => c.Id == int.Parse(cid));

        if (data != null)
        {
            pagetitle += data.Title.ToString();
        }
        else
        {
            var p = subMenu.Find(x => x.Id == int.Parse(cid));
            if (p != null)
            {
                pagetitle += p.Title.ToString();
            }
        }
        Session["title"] = pagetitle + "│" + Application["site_name"];
    }