Esempio n. 1
0
    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();
    }
Esempio n. 2
0
        public static string Get_JoinData(string ord_code)
        {
            string htmldetail = "";
            string htmlstr;

            LessonLib.JoinData o = LessonLib.Web.Get_ord_JoinData(ord_code);

            htmlstr    = unity.classlib.GetTextString(HttpContext.Current.Server.MapPath(" /templates/Lessondata0.html"));
            htmldetail = unity.classlib.GetTextString(HttpContext.Current.Server.MapPath("/templates/classdetail.html"));
            htmlstr    = htmlstr.Replace("@subject@", o.LessonData.MainData.Subject);
            htmlstr    = htmlstr.Replace("@pic@", o.LessonData.MainData.Pic);
            htmlstr    = htmlstr.Replace("@totalprice@", o.OrderData.TotalPrice.ToString());
            htmlstr    = htmlstr.Replace("@classdate@", o.LessonData.StartDay.ToShortDateString() + "~" + o.LessonData.EndDay.ToShortDateString());
            htmlstr    = htmlstr.Replace("@address@", o.LessonData.Address);
            htmlstr    = htmlstr.Replace("@ord_code@", o.Ord_code);
            htmlstr    = htmlstr.Replace("@DeliveryPrice@", o.OrderData.ShipPrice.ToString());
            htmlstr    = htmlstr.Replace("@ordername@", o.OrderData.Ordname);
            htmlstr    = htmlstr.Replace("@ordermail@", o.OrderData.Ordemail);
            htmlstr    = htmlstr.Replace("@orderphone@", o.OrderData.Ordphone);
            htmlstr    = htmlstr.Replace("@shipname@", o.OrderData.Ordname);
            htmlstr    = htmlstr.Replace("@shipphone@", o.OrderData.Ordphone);
            htmlstr    = htmlstr.Replace("@shipaddress@", o.OrderData.Ordaddress);
            htmlstr    = htmlstr.Replace("@TotalPrice@", "NT$:" + o.OrderData.TotalPrice.ToString());
            htmlstr    = htmlstr.Replace("@paymode@", OrderLib.getPaymode(o.OrderData.Paymode));
            htmlstr    = htmlstr.Replace("@ShipPrice@", o.OrderData.ShipPrice.ToString());
            htmlstr    = htmlstr.Replace("@delivery_kind@", OrderLib.getdelivery_kind(o.OrderData.Delivery_kind));
            htmlstr    = htmlstr.Replace("@ticketname@", o.LessonData.MainData.Subject);
            htmlstr    = htmlstr.Replace("@StartDay@", o.LessonData.MainData.Lesson.StartDay.ToString("yyyy/MM/dd"));
            htmlstr    = htmlstr.Replace("@EndDay@", o.LessonData.MainData.Lesson.EndDay.ToString("yyyy/MM/dd"));
            htmlstr    = htmlstr.Replace("@Lessontime@", o.LessonData.MainData.Lesson.Lessontime);
            htmlstr    = htmlstr.Replace("@paymode@", OrderLib.getPaymode(o.OrderData.Paymode));
            htmlstr    = htmlstr.Replace("@paystatus@", OrderLib.get_ord_status(o.OrderData.Status));
            SpGatewayHelper.Models.TradeInfoLog log = OrderLib.Get_Tradelog(ord_code);
            string payinfo = "";

            if (log.Result.TradeNo != "")
            {
                payinfo += "<tr><td  colspan=\"4\">轉帳資訊:<br>";
                payinfo += "銀行代碼:" + log.Result.BankCode + "<br>";
                payinfo += "帳號:" + log.Result.CodeNo + "<br></td></tr>";
            }
            //  string payinfo = "";
            htmlstr = htmlstr.Replace("@payinfo@", payinfo);

            string temp  = "";
            string temp1 = "";

            foreach (article.LessonDetail d in o.LessonData.LessonDetail)
            {
                var data = o.JoinDetail.Find(y => y.LessonId == d.LessonId);

                // var data = o.LessonData.LessonDetail.FindAll  (y => y.LessonId == d.LessonId).Sum(c => d.Sellprice );
                //  var data = o.LessonData.LessonDetail.FindAll.Where(x => x.ID).Sum(c => c.price)
                if (data != null)
                {
                    temp1 += "<tr><td>" + o.LessonData.MainData.Subject + "</td>";
                    temp1 += "<td  colspan=\"2\">" + d.Description + "</td>";
                    temp1 += "<td  class='text-right'>";
                    temp1 += "NT$" + d.Sellprice + "</td></tr>";
                }
            }
            foreach (LessonLib.JoinDetail d in o.JoinDetail)
            {
                string QrCode = o.Ord_code + "-" + d.JoinId.ToString() + "-" + d.LessonId;
                string url    = "http://www.culturelaunch.net/lib/checkjoin.aspx?code=" + QrCode;
                temp += htmldetail;
                temp  = temp.Replace("@secno@", d.JoinId.ToString());
                temp  = temp.Replace("@ticketno@", QrCode);
                temp  = temp.Replace("@name@", d.Name.ToString());
                temp  = temp.Replace("@email@", d.Email.ToString());
                temp  = temp.Replace("@phone@", d.Phone.ToString());
                temp  = temp.Replace("@qrcode@", QrCode);
                temp  = temp.Replace("@orderno@", ord_code);
                QR_Encode qr = new QR_Encode();
                qr.BackColor = Color.White;
                qr.ForeColor = Color.Black;
                int i = qr.EncodeData(1, 0, true, -1, 5, url, HttpContext.Current.Server.MapPath("upload/" + QrCode + ".gif"), false, 255, 255);
                //Bitmap b = qr.GetBMP; //輸出至前端
                //Response.ContentType = "image/jpeg";
                //b.Save(Response.OutputStream, ImageFormat.Gif);
                //b.Dispose();
            }
            htmlstr = htmlstr.Replace("@detail@", temp1);
            htmlstr = htmlstr.Replace("@classdetail@", temp);
            return(htmlstr);
        }
Esempio n. 3
0
    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");
        }
    }
Esempio n. 4
0
    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");
        }
    }