protected void link_edit(object sender, System.EventArgs e) { MultiView1.ActiveViewIndex = 1; LinkButton obj = sender as LinkButton; Selected_id.Value = obj.CommandArgument; o = OrderLib.Get_ordData(Selected_id.Value); payStatus.SelectedValue = o.Status; MultiView1.ActiveViewIndex = 1; LessonLib.JoinData l = LessonLib.Web.Get_ord_JoinData(o.Ord_code); joindata.Visible = false; companyno.Text = o.Companyno; title.Text = o.Title; Repeater1.DataSource = o.OrderDetail; Repeater1.DataBind(); if (l.JoinDetail != null) { joindata.Visible = true; Lstatus.SelectedValue = l.JoinDetail[0].Status; } paymode.SelectedValue = o.Paymode; Btn_save.CommandArgument = "edit"; string strsql = "select * from Log_Sms where ord_code=@ord_code"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("ord_code", Selected_id.Value); DataTable dt = DbControl.Data_Get(strsql, nvc); Repeater2.DataSource = dt; Repeater2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["memberdata"] != null) { MemberLib.Mmemberdata m = (MemberLib.Mmemberdata)Session["memberdata"]; OrderLib.OrderData o = OrderLib.Get_ordData(Request.QueryString["ord_code"]); if (m.Memberid.ToString() == o.Memberid) { htmlstr = unity.classlib.GetTextString(Server.MapPath("/templates/orderdata.html")); htmlstr = htmlstr.Replace("@ord_code@", o.Ord_code); htmlstr = htmlstr.Replace("@ordername@", o.Ordname); htmlstr = htmlstr.Replace("@ordermail@", o.Ordemail); htmlstr = htmlstr.Replace("@orderphone@", o.Ordphone); htmlstr = htmlstr.Replace("@shipname@", o.Ordname); htmlstr = htmlstr.Replace("@shipphone@", o.Ordphone); htmlstr = htmlstr.Replace("@shipaddress@", o.Ordaddress); htmlstr = htmlstr.Replace("@TotalPrice@", "NT$:" + o.TotalPrice.ToString()); htmlstr = htmlstr.Replace("@paymode@", OrderLib.getPaymode(o.Paymode)); htmlstr = htmlstr.Replace("@ShipPrice@", o.ShipPrice.ToString()); htmlstr = htmlstr.Replace("@delivery_kind@", OrderLib.getdelivery_kind(o.Delivery_kind)); string detailstr = ""; foreach (var d in o.OrderDetail) { detailstr += "<tr><td>" + d.P_name + "</td><td>" + d.Price.ToString() + "</td><td>" + d.Num.ToString() + "</td><td>" + d.Amount.ToString() + "</td></tr>"; } htmlstr = htmlstr.Replace("@detail@", detailstr); } } }
protected void Button1_Click(object sender, EventArgs e) { o = OrderLib.Get_ordData(Selected_id.Value); string ord_code = o.Ord_code; string site_name = HttpContext.Current.Application["site_name"].ToString(); string filename = HttpContext.Current.Server.MapPath("/templates/letter.html"); DataTable dt = unity.classlib.Get_Message(14); LessonLib.JoinData l = LessonLib.Web.Get_ord_JoinData(o.Ord_code); string mailsubject = dt.Rows[0]["title"].ToString(); string mailbody = dt.Rows[0]["contents"].ToString(); mailsubject = mailsubject.Replace("@classname@", get_ld(o.Ord_code)); mailbody = mailbody.Replace("@classname@", get_ld(o.Ord_code)); mailbody = mailbody.Replace("@username@", o.Ordname); mailbody = mailbody.Replace("@url@", "<a href=\"http://www.culturelaunch.net/Class/" + l.LessonData.MainData.Id + "\">http://www.culturelaunch.net/Class/" + l.LessonData.MainData.Id + "</a>"); string textbody = unity.classlib.GetTextString(filename); mailbody = textbody.Replace("@mailbody@", mailbody); string msg = unity.classlib.SendsmtpMail(o.Ordemail, mailsubject, mailbody, "gmail"); outfile = "<script>alert('己送出');</script>"; }
protected void LinkButton2_Click(object sender, EventArgs e) { o = OrderLib.Get_ordData(Selected_id.Value); string ord_code = o.Ord_code; DataTable dt = unity.classlib.Get_Message(17); LessonLib.JoinData l = LessonLib.Web.Get_ord_JoinData(o.Ord_code); string smsbody = dt.Rows[0]["contents"].ToString(); smsbody = smsbody.Replace("@username@", l.OrderData.Ordname); // smsbody = smsbody.Replace("@date@", l.LessonData.StartDay.ToString ("MM月dd日") ); smsbody = smsbody.Replace("@classtime@", l.LessonData.Lessontime); smsbody = smsbody.Replace("@classname@", l.LessonData.MainData.Subject); classlib.Log_Sms log = classlib.Sendsms(l.OrderData.Ordphone, smsbody); string strsql = "update log_SMS set ord_code= @ord_code where msgid=@msgid"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("msgid", log.Msgid); nvc.Add("ord_code", o.Ord_code); DbControl.Data_add(strsql, nvc); outfile = "<script>alert('己送出');</script>"; }
protected void Page_Load(object sender, EventArgs e) { if (Session["ord_code"] != null) { ord_code = Session["ord_code"].ToString(); } if (Request.QueryString["ord_code"] != null) { ord_code = Request.QueryString["ord_code"]; } if (ord_code == "") { Response.End(); } ord_code = classlib.RemoveBadSymbol(ord_code); o = OrderLib.Get_ordData(ord_code); SpGatewayHelper.Models.TradeInfoLog log = OrderLib.Get_Tradelog(ord_code); string ord_id = o.Ord_id.ToString(); temp_product.DataSource = o.OrderDetail; temp_product.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) { if (Session["ord_code"] != null) { ord_code = Session["ord_code"].ToString(); } if (Request.QueryString["ord_code"] != null) { ord_code = Request.QueryString["ord_code"]; } if (ord_code == "") { Response.End(); } ord_code = classlib.RemoveBadSymbol(ord_code); o = OrderLib.Get_ordData(ord_code); SpGatewayHelper.Models.TradeInfoLog log = OrderLib.Get_Tradelog(ord_code); string strsql = ""; string ord_id = o.Ord_id.ToString(); temp_product.DataSource = o.OrderDetail; temp_product.DataBind(); if (o.Paymode == "1") { NameValueCollection nvc = new NameValueCollection { { "ord_code", ord_code } }; DataTable dt = new DataTable(); if (log.Status == "SUCCESS") { strsql = @"update tbl_OrderData set paid= 'Y', status =2 where ord_code=@ord_code"; DbControl.Data_add(strsql, nvc); dt.Dispose(); } else { Response.Redirect("/cardpayfiled"); } ord_status = log.Status; string site_name = HttpContext.Current.Application["site_name"].ToString(); string filename = HttpContext.Current.Server.MapPath("/templates/letter.html"); string mailbody = unity.classlib.GetTextString(filename); string atmmode = "<table><Tr><td colspan=2>您於「" + site_name + "」進行了信用卡交易,以下為您付款完成資訊</td></tr>"; atmmode += "<tr><td>訂單編號</td><td >" + ord_code + "</td></tr>"; atmmode += "<tr><td>訂單金額</td><td >NT$" + o.TotalPrice + "</td></tr>"; atmmode += "<tr><td>支付方式</td><td >信用卡一次付清</td></tr>"; atmmode += "<tr><td>刷卡結果</td><td >付款成功</td></tr></table>"; unity.classlib.SendsmtpMail(o.Ordemail, "信用卡付款完成通知信", mailbody.Replace("@mailbody@", atmmode), "gmail"); } LessonLib.JoinData L = LessonLib.Web.Get_ord_JoinData(Session["ord_code"].ToString()); if (L.JoinDetail != null) { Response.Redirect("/process-step4.aspx"); } }
public static JoinData Get_ord_JoinData(string ord_code) { string strsql = @"select * FROM tbl_Joindata where ord_code=@ord_code"; NameValueCollection nvc = new NameValueCollection { { "ord_code", ord_code } }; DataTable dt = DbControl.Data_Get(strsql, nvc); LessonLib.JoinData n = new LessonLib.JoinData(); OrderLib.OrderData o = OrderLib.Get_ordData(ord_code); n.Id = 0; if (dt.Rows.Count > 0) { n.Id = (int)dt.Rows[0]["joinid"]; n.Status = (string)dt.Rows[0]["status"]; n.TicketKind = (string)dt.Rows[0]["TicketKind"]; n.Articleid = (int)dt.Rows[0]["Articleid"]; n.Ord_code = (string)dt.Rows[0]["ord_code"]; n.OrderData = o; n.LessonData = DbHandle.Get_Lesson(n.Articleid.ToString()); strsql = @"select * FROM tbl_joindetail where joinid=@joinid"; nvc.Clear(); dt.Dispose(); nvc = new NameValueCollection { { "joinid", n.Id.ToString() } }; dt = DbControl.Data_Get(strsql, nvc); List <JoinDetail> detail = new List <JoinDetail>(); foreach (DataRow d in dt.Rows) { strsql = @"select * FROM tbl_joinlog where checkcode=@checkcode"; string checkcode = n.Ord_code + "-" + d["joinid"].ToString() + "-" + d["lessonid"].ToString(); nvc.Clear(); nvc = new NameValueCollection { { "checkcode", checkcode } }; DataTable c = DbControl.Data_Get(strsql, nvc); detail.Add(new JoinDetail { JoinId = (int)d["joinid"], Name = (string)d["username"], Phone = (string)d["phone"], Email = (string)d["email"], Amount = (int)d["Amount"], LessonId = (int)d["lessonid"], Secno = (int)d["secno"], Status = d["status"].ToString(), Unitname = d["Unitname"].ToString(), Postion = d["Postion"].ToString(), checkin = c.Rows.Count == 0 ? "":"Y" }); c.Dispose(); } n.JoinDetail = detail; } return(n); }
protected void Page_Load(object sender, EventArgs e) { OrderLib.OrderData o = new OrderLib.OrderData(); o = OrderLib.Get_ordData(Request.QueryString["ord_code"]); action = "https://inv.pay2go.com/API/invoice_issue"; //正式ID action = "https://cinv.pay2go.com/API/invoice_issue"; //測試ID MerchantID = ""; //正式ID MerchantID = "31117495"; //測試ID string _key = ""; _key = "8hWZNZjoHkNDTTgOXGYJI4Rc5k3OR7CO"; string _Vi = ""; _Vi = "oaAyJlX2BcpSuj8m"; DateTime gtm = new DateTime(1970, 1, 1); //宣告一個GTM時間出來 DateTime utc = DateTime.UtcNow.AddHours(8); //宣告一個目前的時間 int timeStamp = Convert.ToInt32(((TimeSpan)utc.Subtract(gtm)).TotalSeconds); int TaxAmt = 0; string ItemName = ""; string ItemCount = ""; string ItemUnit = ""; string ItemPrice = ""; string ItemAmt = ""; string ItemTaxType = ""; int i = 0; foreach (var p in o.OrderDetail) { ItemName += i == 0 ? p.P_name : "|" + p.P_name; ItemCount += i == 0 ? p.Num.ToString() : "|" + p.Num.ToString(); ItemUnit += i == 0 ? "個" : "|個"; ItemPrice += i == 0 ? p.Price.ToString() : "|" + p.Price.ToString(); TaxAmt += Convert.ToInt16(Math.Ceiling(p.Amount * 0.05)); ItemAmt += i == 0 ? p.Amount.ToString() : "|" + p.Amount.ToString(); ItemTaxType += i == 0 ? "1" : "|1"; i++; } var pay2goInfo = new pay2goInfo() { RespondType = "JSON", TimeStamp = timeStamp.ToString(), Version = "1.4", BuyerName = o.Ordname, BuyerAddress = o.Shipaddress, BuyerEmail = o.Ordemail, BuyerPhone = o.Ordphone, MerchantOrderNo = timeStamp.ToString(),//o.Ord_code , Category = "B2C", TaxType = "1", TaxRate = 5, Amt = o.TotalPrice - TaxAmt, TaxAmt = TaxAmt, TotalAmt = o.TotalPrice, CarrierType = "", CarrierNum = Server.HtmlDecode(""), LoveCode = "", PrintFlag = "Y", ItemName = ItemName, ItemCount = ItemCount, ItemUnit = ItemUnit, ItemPrice = ItemPrice, ItemAmt = ItemAmt, ItemTaxType = ItemTaxType, Comment = "TEST,備註說明", Status = "1", CreateStatusTime = "" }; var postData = MyHelper.ToDictionary(pay2goInfo); var cryptoHelper = new CryptoHelper(_key, _Vi); var aesString = cryptoHelper.GetAesString(postData); aes = aesString; Sha = cryptoHelper.GetSha256String(aesString); string URI = action; string myParameters = "MerchantID_=" + MerchantID + "&PostData_=" + aes; using (WebClient wc = new WebClient()) { wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; string HtmlResult = wc.UploadString(URI, myParameters); JObject restoredObject = JsonConvert.DeserializeObject <JObject>(HtmlResult); JObject result = JsonConvert.DeserializeObject <JObject>(restoredObject["Result"].ToString()); Response.Write(HtmlResult); string strsql = @"INSERT INTO InvoiceNumner(InvoiceTransNo, MerchantOrderNo, TotalAmt, InvoiceNumber, RandomNum, CheckCode, CreateTime, BarCode, QRcodeL, QRcodeR) VALUES (@InvoiceTransNo, @MerchantOrderNo, @TotalAmt, @InvoiceNumber, @RandomNum, @CheckCode, @CreateTime, @BarCode, @QRcodeL, @QRcodeR)"; NameValueCollection nvc = new NameValueCollection { { "CheckCode", result["CheckCode"].ToString() }, { "MerchantOrderNo", result["MerchantOrderNo"].ToString() }, { "InvoiceNumber", result["InvoiceNumber"].ToString() }, { "TotalAmt", result["TotalAmt"].ToString() }, { "InvoiceTransNo", result["InvoiceTransNo"].ToString() }, { "RandomNum", result["RandomNum"].ToString() }, { "CreateTime", result["CreateTime"].ToString() }, { "BarCode", result["BarCode"].ToString() }, { "QRcodeL", result["QRcodeL"].ToString() }, { "QRcodeR", result["QRcodeR"].ToString() } }; if (result != null) { DbControl.Data_add(strsql, nvc); } //Dictionary<string, string> results = ((IDictionary<string, JToken>)(JObject)parsed["moretests"]).ToDictionary(pair => pair.Key, pair => (string)pair.Value); Response.Write(restoredObject["Status"]); Response.Write(restoredObject["Message"]); } }
protected void Page_Load(object sender, EventArgs e) { string _key = "CD9Zyfb82BIFpnYY2JUppiF4a3f1FB1B"; string _Vi = "jXbof2czX0r9FxBf"; //_key = "By8IMdyhhfeTTgACeHciAYe6bGrXc6bA"; //_Vi = "hiDG6VP3CrOA32bM"; SpGatewayResponse spg = new SpGatewayResponse { Key = _key, Vi = _Vi, Status = Request["Status"], MerchantId = Request["MerchantID"], TradeInfo = Request["TradeInfo"] }; spg.SaveLog(); spg.AddAtmlog(); if (Session["ord_code"] != null) { ord_code = Session["ord_code"].ToString(); } if (Request.QueryString["ord_code"] != null) { ord_code = Request.QueryString["ord_code"]; } if (ord_code == "") { Response.End(); } ord_code = classlib.RemoveBadSymbol(ord_code); SpGatewayHelper.Models.TradeInfoLog log = OrderLib.Get_Tradelog(ord_code); ord_status = log.Status; BankCode = log.Result.BankCode; CodeNo = log.Result.CodeNo; ExpireDate = log.Result.ExpireDate + " " + log.Result.ExpireTime; OrderLib.OrderData o = OrderLib.Get_ordData(ord_code); string ord_id = o.Ord_id.ToString(); string site_name = HttpContext.Current.Application["site_name"].ToString(); string filename = HttpContext.Current.Server.MapPath("/templates/letter.html"); string mailbody = unity.classlib.GetTextString(filename); string atmmode = "<table><Tr><td colspan=2>您於「" + site_name + "」進行了ATM 轉帳交易,以下為您轉帳資訊</td></tr>"; atmmode += "<tr><td>訂單編號</td><td>" + log.Result.MerchantOrderNo + "</td></tr>"; atmmode += "<tr><td>銀行代碼</td><td>" + BankCode + "</td></tr>"; atmmode += "<tr><td>帳號</td><td >" + CodeNo + "</td></tr>"; atmmode += "<tr><td>金額</td><td >NT$" + log.Result.Amt + "</td></tr>"; atmmode += "<tr><td>有效期限</td><td>" + ExpireDate + "</td></tr></table>"; unity.classlib.SendsmtpMail(o.Ordemail, "ATM匯款帳號通知信", mailbody.Replace("@mailbody@", atmmode), "gmail"); if (o.OrderDetail != null) { Response.Redirect("/completed.aspx"); Response.End(); } LessonLib.JoinData L = LessonLib.Web.Get_ord_JoinData(Session["ord_code"].ToString()); if (L.JoinDetail != null) { Response.Redirect("/process-step4.aspx"); } }