예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        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 = "/emba/" + cid;
        List <Banner.MainData> banner1 = new List <Banner.MainData>();

        if (Request.QueryString["kind"] == "preview")
        {
            banner1 = Banner.DbHandle.Banner_Get_list(5, "preview");
        }
        else
        {
            banner1 = Banner.DbHandle.Banner_Get_list(5);
        }

        Repeater1.DataSource = banner1;
        Repeater1.DataBind();
        banner1.Clear();
        List <article.MainData> hotlist = new List <article.MainData>();

        hotlist = article.DbHandle.Get_article_list(cid, "", PageSize, PageIdx, "postday", "Y", DateTime.Today.ToString("yyyy-MM-dd"), "all");
        foreach (var p in hotlist)
        {
            Totalrow = p.TotalRows;
            break;
        }

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

        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));
    }
예제 #2
0
파일: list.aspx.cs 프로젝트: kuan0904/x-cms
    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));
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Unitlib.WebsiteData m = new Unitlib.WebsiteData();


        Articleid = Request.QueryString["Articleid"];
        Route myRoute = RouteData.Route as Route;

        if (myRoute != null)
        {
            Articleid = RouteData.Values["Articleid"].ToString();
        }

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

        if (Articleid != null)
        {
            MainData = article.DbHandle.Get_article(int.Parse(Articleid));
        }
        else if (Session["MainData"] != null)
        {
            MainData = HttpContext.Current.Session["MainData"] as article.MainData;
        }

        if (MainData != null)
        {
            if (MainData.kind == "Y" || MainData.kind == "L")
            {
                Response.Redirect("/Class/" + MainData.Id);
            }
            subject  = MainData.Subject;
            subtitle = MainData.SubTitle;
            if (subtitle != "")
            {
                subtitle = "<blockquote><p>" + subtitle + "</p></blockquote>";
            }
            Session["title"] = subject + "│" + Application["site_name"];
            pic = MainData.Pic.IndexOf("/") < 0 ? "/webimages/article/" + MainData.Pic : MainData.Pic;
            Session["image"] = Session["websiteurl"] + pic;
            pic      = "<a href=\"" + pic + "\">" + "<img class=\"image-full modal-image size-full\" src=\"" + pic + "\" width=\"1350\" height=\"900\" /></a>";
            postday  = MainData.PostDay.ToString("yyyy/MM/dd");
            contents = MainData.Contents;
            keywords = article.Web.Get_Keyword_link(MainData.Keywords);
            Session["description"] = unity.classlib.noHTML(contents);
            Session["keywords"]    = MainData.Keywords;
            flag = MainData.Flag;
            if (MainData.YoutubeUrl != "")
            {
                Match regexMatch = Regex.Match(MainData.YoutubeUrl, "^[^v]+v=(.{11}).*",
                                               RegexOptions.IgnoreCase);
                string          v    = regexMatch.Groups[1].Value;
                FatchU2BUtility util = new FatchU2BUtility(MainData.YoutubeUrl);
                pic = " <iframe width = \"853\" height = \"480\" src = \"https://www.youtube.com/embed/" + v + "\" frameborder = \"0\" allow = \"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen ></iframe >";
            }
            viewcount = MainData.Viewcount.ToString();
            tags      = article.Web.Get_category_link(MainData.Id);
            author    = article.Web.Get_author_link(MainData.Author);
            ItemData  = article.DbHandle.Get_article_item(MainData.Id);
            foreach (var s in ItemData)
            {
                contents += "<h2>" + s.Title + "</h2>";
                contents += s.Contents;
            }
            article.DbHandle.Add_views(MainData.Id);

            List <article.MainData> hotlist = new List <article.MainData>();
            hotlist = article.DbHandle.Get_article_list("", "", 5, 1);

            if (MainData.NextRead != "" && MainData.NextRead != null)
            {
                List <article.MainData> nextlist = new List <article.MainData>();
                string[] nextread = MainData.NextRead.Split(',');

                int i = 0;
                foreach (string n in nextread)
                {
                    nextlist = article.DbHandle.Get_article_list("", n.Trim(), 1, 1);
                    if (nextlist.Count != 0)
                    {
                        var itemToRemove = hotlist.Find(r => r.Id == nextlist[0].Id);
                        if (itemToRemove != null)
                        {
                            hotlist.Remove(itemToRemove);
                        }
                        hotlist.Insert(i, nextlist.FirstOrDefault());
                        i++;
                    }
                    nextlist.Clear();
                }
            }
            extended_list.DataSource = hotlist;
            extended_list.DataBind();

            DataTable           dt;
            string              strsql = "select* from tbl_article_file where  status <> 'D' and  (articleid =@articleid or tempid=@articleId) and kind='F' order by sort";
            NameValueCollection nvc    = new NameValueCollection();
            nvc.Add("articleid", MainData.Id.ToString());
            dt = DbControl.Data_Get(strsql, nvc);
            if (dt.Rows.Count > 0)
            {
                Repeater_file.DataSource = dt;
                Repeater_file.DataBind();
            }
            dt.Dispose();
            nvc.Clear();

            List <article.Category> cate = new List <article.Category>();
            cate = (List <article.Category>)article.DbHandle.Get_article_category(MainData.Id);
            foreach (var a in cate)
            {
                cid               = a.CategoryId.ToString();
                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));
                Breadcrumb        = Unitlib.Get_Breadcrumb((List <Unitlib.MenuModel>)Session["webmenu"], int.Parse(cid));
                break;
            }

            if (Session["memberdata"] != null && Session["memberdata"].ToString() != "")
            {
                MemberLib.Mmemberdata o = (MemberLib.Mmemberdata)Session["memberdata"];
                iscollection = MemberLib.Member.Is_collection(o.Memberid.ToString(), MainData.Id.ToString()) == "Y"? " active ":"";
            }
        }
    }