コード例 #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
ファイル: process-step2.aspx.cs プロジェクト: kuan0904/x-cms
    protected void Page_Load(object sender, EventArgs e)
    {
        article.MainData MainData = new article.MainData();
        MainData = HttpContext.Current.Session["MainData"] as article.MainData;
        List <article.Lecturer> Lecturer = new List <article.Lecturer>();

        if (MainData != null)
        {
            subject          = MainData.Subject;
            Session["title"] = subject + "│" + Application["site_name"];
            pic = MainData.Pic;
            Session["image"] = Session["websiteurl"] + pic;
            List <article.Lesson>       lesson       = new List <article.Lesson>();
            List <article.LessonDetail> lessondetail = new List <article.LessonDetail>();
            if (MainData.Lesson.Id > 0)
            {
                startday     = MainData.Lesson.StartDay == null ? "" : MainData.Lesson.StartDay.ToString("yyyy/MM/dd");
                endday       = MainData.Lesson.EndDay.ToString("yyyy/MM/dd");
                address      = MainData.Lesson.Address;
                contents     = MainData.Contents;
                lessondetail = MainData.Lesson.LessonDetail;
                //Repeater2.DataSource = lessondetail;
                //Repeater2.DataBind();
                lessontime = MainData.Lesson.Lessontime;
                Lecturer   = article.DbHandle.Get_Lecturer_list(MainData.Lesson.Lecturer);
            }

            keywords  = article.Web.Get_Keyword_link(MainData.Keywords);
            viewcount = MainData.Viewcount.ToString();
            tags      = article.Web.Get_category_link(MainData.Id);

            Session["description"] = unity.classlib.noHTML(contents);
            Session["keywords"]    = MainData.Keywords;

            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;
            }
        }
        string[] joinnum  = Request.Form["joinnum"].Split(',');
        string[] lessonid = Request.Form["lessonid"].Split(',');
        int      i        = 0;

        foreach (string s in joinnum)
        {
            if (joinnum[i] != "0")
            {
                article.LessonDetail ItemData = (article.LessonDetail)LessonLib.DbHandle.Get_LessonClass(int.Parse(lessonid[i]));
                classdata.Add(new article.LessonDetail
                {
                    Id          = (int)ItemData.Id,
                    Description = (string)ItemData.Description,
                    Price       = (int)ItemData.Price,
                    Sellprice   = (int)ItemData.Sellprice,
                    Limitnum    = int.Parse(joinnum[i])
                });
                int j = 0;
                for (j = 1; j <= int.Parse(joinnum[i]); j++)
                {
                    joindata.Add(new LessonLib.JoinData
                    {
                        Id = int.Parse(lessonid[i])
                    });
                }
                totalnum   += int.Parse(joinnum[i]);
                totalprice += (int)ItemData.Sellprice * int.Parse(joinnum[i]);
            }
            i++;
        }

        Repeater1.DataSource = classdata;
        Repeater1.DataBind();
        //Repeater2.DataSource = joindata;
        //Repeater2.DataBind();
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lessonid  = Request.QueryString["lessonid"];
        Articleid = Request.QueryString["Articleid"];
        Route myRoute = RouteData.Route as Route;

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


        List <article.Lecturer> Lecturer = new List <article.Lecturer>();

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

            Session["title"] = MainData.Subject + "│" + Application["site_name"];
            Session["image"] = Session["websiteurl"] + MainData.Pic;
            List <article.Lesson> lesson = new List <article.Lesson>();

            if (MainData.Lesson.Id > 0)
            {
                lessondetail = MainData.Lesson.LessonDetail.Find(c => c.LessonId == int.Parse(lessonid));
                num          = lessondetail.Limitnum - LessonLib.Web.Get_JoinNum(Articleid, lessonid);
                Lecturer     = article.DbHandle.Get_Lecturer_list(MainData.Lesson.Lecturer);

                if (DateTime.Compare(DateTime.Today, MainData.Lesson.EndDay) > 0)
                {
                    status = "活動已結束";
                }
                else if (DateTime.Compare(DateTime.Today, lessondetail.Strdat) < 0)
                {
                    status = "報名未開始";
                }
                else if (MainData.Status != "Y")
                {
                    status = "無效課程資料";
                }
                else if (DateTime.Compare(DateTime.Today, lessondetail.Enddat) > 0)
                {
                    status = "報名己截止";
                }
                else if (num > 0)
                {
                    status = "";
                }
                else
                {
                    status = "額滿";
                }
            }

            keywords  = article.Web.Get_Keyword_link(MainData.Keywords);
            viewcount = MainData.Viewcount.ToString();
            tags      = article.Web.Get_category_link(MainData.Id);

            Session["description"] = unity.classlib.noHTML(MainData.Contents);
            Session["keywords"]    = MainData.Keywords;


            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;
            }
        }
    }
コード例 #5
0
ファイル: detail.aspx.cs プロジェクト: kuan0904/x-cms
    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 ":"";
            }
        }
    }