protected void Page_Init(object sender, EventArgs e) { if (Session["webmenu"] == null) { object menu = Unitlib.Get_menu(); Session["webmenu"] = menu; } }
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)); }
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) { packageid = Request["packageid"]; Route myRoute = RouteData.Route as Route; if (myRoute != null) { packageid = RouteData.Values["id"].ToString(); } if (packageid == null || packageid == "") { Response.Write("<script>alert('資料有誤');</script>"); Response.End(); } List <productController.Package> gd = new List <productController.Package>(); productController.Package pd = new productController.Package(); pd.Packageid = int.Parse(packageid); gd = productController.GetPackageList(pd); string pic = ""; foreach (var g in gd) { if (g.Status != "Y") { Response.Write("<script>alert('此商品並無販售');history.back();</script>"); Response.End(); } productname = g.Packagename; description = g.Description; ship_price = g.Shippingfee; shippingKind = g.ShippingKind; DESCRIPTION = g.Description; freeship = g.Freeship; Repeater1.DataSource = g.PackageItem; Repeater1.DataBind(); pic = g.PackageItem[0].Pic; ReMark = g.ReMark; Refunds = g.Refunds; } Session["title"] = productname + "│" + Application["site_name"]; Session["image"] = Session["websiteurl"] + pic; Session["description"] = unity.classlib.noHTML(description); Session["keywords"] = productname; s = Unitlib.Get_UnitData(37, ""); }
protected void Btn_save_Click(object sender, System.EventArgs e) { //----------------------------------------------------------------------- if (Btn_save.CommandArgument == "add") { strsql = " insert into tbl_category( parentid, classId, sort, status, title, createdate, createuserid,kind,pagename) values "; strsql += "(@parentid, @classId, @sort, @status, @title, getdate(), '" + Session["userid"].ToString() + "',@kind,@pagename) "; } else { strsql = "update tbl_category set parentid=@parentid,sort=@sort,status=@status, title=@title"; strsql += ",kind=@kind,pagename=@pagename where categoryid =@categoryid"; } SqlConnection conn = new SqlConnection(classlib.dbConnectionString); SqlCommand cmd = new SqlCommand(); conn.Open(); cmd = new SqlCommand(strsql, conn); cmd.Parameters.Add("parentid", SqlDbType.NVarChar).Value = DropDownList2.SelectedValue; cmd.Parameters.Add("classId", SqlDbType.NVarChar).Value = classid; cmd.Parameters.Add("sort", SqlDbType.NVarChar).Value = sort.Text; cmd.Parameters.Add("status", SqlDbType.NVarChar).Value = status.SelectedValue; cmd.Parameters.Add("title", SqlDbType.NVarChar).Value = class_name.Text; cmd.Parameters.Add("kind", SqlDbType.NVarChar).Value = kind.SelectedValue; cmd.Parameters.Add("pagename", SqlDbType.NVarChar).Value = pagename.Text; if (Btn_save.CommandArgument == "add") { } else { cmd.Parameters.Add("categoryid", SqlDbType.VarChar).Value = Selected_id.Value; } cmd.ExecuteNonQuery(); cmd.Dispose(); conn.Close(); MultiView1.ActiveViewIndex = 0; cleaninput(); selectSQL(); Session["webmenu"] = Unitlib.Get_menu(); }
protected void Page_Load(object sender, EventArgs e) { int unitid = 0; string pagename = ""; Route myRoute = RouteData.Route as Route; if (myRoute != null) { unitid = RouteData.Values["id"] == null ? 0 :int.Parse(RouteData.Values["id"].ToString()); pagename = RouteData.Values["pagename"] == null ? "1" : RouteData.Values["pagename"].ToString(); } Unitlib.MainData MainData = new Unitlib.MainData(); MainData = Unitlib.Get_UnitData(unitid, pagename); contents = MainData.Contents; unitname = MainData.Subject; Session["title"] = unitname + "│" + Application["site_name"]; }
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(); }
protected void Page_Init(object sender, EventArgs e) { unitid = Request.QueryString["unitid"]; unitname = Unitlib.Get_UnitName(int.Parse(unitid)); }
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; } } }
public object Getwebmenu() { return(Unitlib.Get_menu()); // string result = JsonConvert.SerializeObject(hotlist); }
protected void Page_Load(object sender, EventArgs e) { Articleid = Request.QueryString["Articleid"]; Route myRoute = RouteData.Route as Route; if (myRoute != null) { Articleid = RouteData.Values["Articleid"].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) { status = MainData.Status; Session["title"] = MainData.Subject + "│" + Application["site_name"]; 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>"; if (MainData.Lesson.Id > 0) { //lessondetail = MainData.Lesson.LessonDetail; //if ( DateTime.Compare(DateTime.Today, MainData.Lesson.EndDay) <= 0) // lessondetail = MainData.Lesson.LessonDetail.Find(x => x.Flag == "Y"); Repeater2.DataSource = MainData.Lesson.LessonDetail.FindAll(x => x.Flag == "Y"); Repeater2.DataBind(); //} //else //{ // Repeater3.DataSource = MainData.Lesson.LessonDetail; // Repeater3.DataBind(); //} Lecturer = article.DbHandle.Get_Lecturer_list(MainData.Lesson.Lecturer); Repeater1.DataSource = Lecturer; Repeater1.DataBind(); } 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; article.DbHandle.Add_views(MainData.Id); List <article.Category> cate = new List <article.Category>(); cate = (List <article.Category>)article.DbHandle.Get_article_category(MainData.Id); foreach (var a in cate) { List <Unitlib.MenuModel> subMenu = (List <Unitlib.MenuModel>)Session["webmenu"]; var data = subMenu.SelectMany(x => x.Detial).FirstOrDefault(c => c.Id == a.CategoryId); if (data != null) { var p = subMenu.Find(x => x.Id == data.ParentId); if (p != null) { pageunit += "<li class=\"active\"><a href=\"/catalog/" + p.Id.ToString() + "\">" + p.Title.ToString() + "</a></li>"; } pageunit += "<li class=\"active\"><a href=\"/catalog/" + data.Id.ToString() + "\">" + data.Title.ToString() + "</a></li>"; } break; } } s = Unitlib.Get_UnitData(37, ""); }
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 ":""; } } }