Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string _key = "CD9Zyfb82BIFpnYY2JUppiF4a3f1FB1B";

        _key = "By8IMdyhhfeTTgACeHciAYe6bGrXc6bA";
        string _Vi = "jXbof2czX0r9FxBf";

        _Vi = "hiDG6VP3CrOA32bM";
        SpGatewayResponse spg = new SpGatewayResponse();

        spg.Key        = _key;
        spg.Vi         = _Vi;
        spg.Status     = Request["Status"];
        spg.MerchantId = Request["MerchantID"];
        spg.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);
        DataTable           dt     = new DataTable();
        string              strsql = @"update   tbl_OrderData   set paid= 'Y', status =2  where ord_code=@ord_code";
        NameValueCollection nvc    = new NameValueCollection
        {
            { "ord_code", ord_code }
        };

        DbControl.Data_add(strsql, nvc);

        strsql = @"select *  FROM      tbl_OrderData  where ord_code=@ord_code";
        dt     = DbControl.Data_Get(strsql, nvc);
        string ord_id = dt.Rows[0]["ord_id"].ToString();

        ord_tel    = dt.Rows[0]["ordphone"].ToString();
        ord_pay    = OrderLib.getPaymode(dt.Rows[0]["paymode"].ToString());
        ord_status = dt.Rows[0]["status"].ToString();
        ord_date   = DateTime.Parse(dt.Rows[0]["crtdat"].ToString()).ToString("yyyy/MM/dd");

        ord_totalprice = "$" + dt.Rows[0]["TotalPrice"].ToString();
        ord_name       = dt.Rows[0]["ordname"].ToString();

        ord_address = dt.Rows[0]["ordaddress"].ToString();
        ord_email   = dt.Rows[0]["email"].ToString();
        ord_tel     = dt.Rows[0]["ordphone"].ToString();


        ord_ship_name = dt.Rows[0]["ordname"].ToString();
        ord_ship_tel  = dt.Rows[0]["ordphone"].ToString();
        email         = dt.Rows[0]["email"].ToString();

        ord_ship_name = dt.Rows[0]["ordname"].ToString();

        strsql = @"select *  FROM    tbl_OrderDetail INNER JOIN
                            tbl_productData ON tbl_OrderDetail.p_id = tbl_productData.p_id where ord_id=@ord_id";
        nvc.Clear();
        nvc.Add("ord_id", ord_id);
        dt = DbControl.Data_Get(strsql, nvc);

        temp_product.DataSource = dt;
        temp_product.DataBind();
    }
Пример #2
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");
        }
    }