public static article.LessonDetail Get_LessonClass(int id) { NameValueCollection nvc = new NameValueCollection(); string strsql = "select * from tbl_lesson_class "; strsql += "where lessonId =@id"; nvc.Add("id", id.ToString()); DataTable dt = DbControl.Data_Get(strsql, nvc); article.LessonDetail MainData = new article.LessonDetail(); int i = 0; for (i = 0; i < dt.Rows.Count; i++) { MainData.Id = (int)dt.Rows[i]["articleId"]; MainData.Price = (int)dt.Rows[i]["Price"]; MainData.Description = (string)dt.Rows[i]["description"]; MainData.Sellprice = (int)dt.Rows[i]["Sellprice"]; MainData.Limitnum = (int)dt.Rows[i]["limitnum"]; MainData.LessonId = (int)dt.Rows[i]["lessonId"]; } dt.Dispose(); return(MainData); }
public static LessonData Get_Lesson(string id) { NameValueCollection nvc = new NameValueCollection(); string strsql = "select * from tbl_Lesson "; strsql += "where articleId =@id"; nvc.Add("id", id); DataTable dt = DbControl.Data_Get(strsql, nvc); LessonLib.LessonData MainData = new LessonLib.LessonData(); List <article.LessonDetail> detail = new List <article.LessonDetail>(); int i = 0; for (i = 0; i < dt.Rows.Count; i++) { MainData.Id = (int)dt.Rows[i]["articleId"]; MainData.StartDay = (DateTime )dt.Rows[i]["startday"]; MainData.EndDay = (DateTime)dt.Rows[i]["Endday"]; MainData.Address = (string)dt.Rows[i]["Address"]; MainData.Lessontime = (string)dt.Rows[i]["Lessontime"]; MainData.MainData = article.DbHandle.Get_article(MainData.Id); MainData.LecturerData = article.DbHandle.Get_Lecturer_list(MainData.MainData.Lesson.Lecturer);; } strsql = "select * from tbl_lesson_class where articleId =@id"; dt = DbControl.Data_Get(strsql, nvc); foreach (DataRow d in dt.Rows) { article.LessonDetail Deta = new article.LessonDetail(); Deta.LessonId = (int)d["lessonId"]; Deta.Price = (int)d["price"]; Deta.Sellprice = (int)d["sellprice"]; Deta.Limitnum = (int)d["limitnum"]; Deta.Description = (string )d["description"]; Deta.Id = MainData.Id; detail.Add(Deta); } MainData.LessonDetail = detail; dt.Dispose(); return(MainData); }
public static LessonDetail Get_Lesson(int id) { NameValueCollection nvc = new NameValueCollection(); string strsql = @"SELECT * FROM tbl_lesson_class INNER JOIN tbl_lesson ON tbl_lesson_class.articleId = tbl_lesson.articleId where lessonId =LessonId "; nvc.Add("id", id.ToString()); DataTable dt = DbControl.Data_Get(strsql, nvc); LessonDetail detail = new LessonDetail(); if (dt.Rows.Count > 0) { detail.Id = (int)dt.Rows[0]["articleId"]; detail.Description = dt.Rows[0]["Description"].ToString(); detail.Limitnum = (int)dt.Rows[0]["Limitnum"]; detail.Sort = (int)dt.Rows[0]["sort"]; } dt.Dispose(); return(detail); }
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_Load(object sender, EventArgs e) { string repay = Request.QueryString["repay"]; string ord_code = ""; if (repay != null && repay != "") { ord_code = MySecurity.DecryptAES256(repay); Session["ord_code"] = ord_code; } OrderLib.OrderData o = OrderLib.Get_ordData(Session["ord_code"].ToString()); LessonLib.JoinData L = LessonLib.Web.Get_ord_JoinData(Session["ord_code"].ToString()); action = "https://core.spgateway.com/MPG/mpg_gateway"; //正式ID MerchantID = "MS357549208"; //正式ID string _key = "CD9Zyfb82BIFpnYY2JUppiF4a3f1FB1B"; string _Vi = "jXbof2czX0r9FxBf"; if (Request.Url.Host.IndexOf("localhost") != -1) { action = "https://ccore.spgateway.com/MPG/mpg_gateway";//測試ID MerchantID = "MS34344182"; _key = "By8IMdyhhfeTTgACeHciAYe6bGrXc6bA"; _Vi = "hiDG6VP3CrOA32bM"; } string _ItemDesc = ""; foreach (var obj in o.OrderDetail) { _ItemDesc += obj.P_name + ","; } List <article.Lesson> lesson = new List <article.Lesson>(); article.LessonDetail lessondetail = new article.LessonDetail(); if (L.JoinDetail != null) { lessondetail = L.LessonData.MainData.Lesson.LessonDetail.Find(c => c.LessonId == L.JoinDetail[0].LessonId); _ItemDesc = L.LessonData.MainData.Subject + "-" + lessondetail.Description; } int CREDIT = 0; int VACC = 0; string CustomerURL = "https://www.culturelaunch.net/back"; if (o.Paymode == "1") { CREDIT = 1; CustomerURL = "https://www.culturelaunch.net/completed"; } else if (o.Paymode == "2") { VACC = 1; CustomerURL = "https://www.culturelaunch.net/atm"; } var tradeInfo = new TradeInfo() { MerchantID = MerchantID, RespondType = "JSON", TimeStamp = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds.ToString(), Version = "1.5", Amt = o.TotalPrice, ItemDesc = _ItemDesc, //InstFlag="3,6", Email = o.Ordemail, EmailModify = 0, LoginType = 0, MerchantOrderNo = Session["ord_code"].ToString(), TradeLimit = 180, //CVS=1, //ExpireDate=DateTime.Now.ToString("yyyyMMdd"), VACC = VACC, BARCODE = 0, CREDIT = CREDIT, CreditRed = 0, WEBATM = 0, ReturnURL = "https://www.culturelaunch.net/completed", NotifyURL = "https://www.culturelaunch.net/log/receive.ashx", CustomerURL = CustomerURL }; var postData = tradeInfo.ToDictionary(); var cryptoHelper = new CryptoHelper(_key, _Vi); var aesString = cryptoHelper.GetAesString(postData); aes = aesString; Sha = cryptoHelper.GetSha256String(aesString); //ViewData["TradeInfo"] = aesString; // ViewData["TradeSha"] = cryptoHelper.GetSha256String(aesString); }
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; } } }