Exemple #1
0
 protected void dlOrders_ItemCommand(object source, DataListCommandEventArgs e)
 {
     LinkButton arg = (LinkButton)e.CommandSource;
     if (arg.CommandName.Equals("Pay"))
     {
         int orderid = int.Parse(arg.CommandArgument.ToString());
         StoreEntities db = new StoreEntities();
         OrderHead order = db.OrderHeadSet.Single(x => x.ID.Equals(orderid));
         if (order.Status == "SUCCESS")
         {
             return;
         }
         SortedDictionary<string, string> Paramers = new SortedDictionary<string, string>();
         Paramers.Add("out_trade_no", orderid.ToString());
         Paramers.Add("subject", "订单ID:"+ order.ID.ToString());
         Paramers.Add("payment_type", "1");
         Paramers.Add("logistics_type", "EXPRESS");
         Paramers.Add("logistics_fee","0");
         Paramers.Add("logistics_payment", "SELLER_PAY");
         Paramers.Add("price", "0.01");
         Paramers.Add("quantity", "1");
         Service ali = new Service();
         string sHtmlText = ali.Create_partner_trade_by_buyer(Paramers);
         Response.Write(sHtmlText);
     }
 }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary<string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify = new Notify();
                bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码

                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
                    string trade_no = Request.QueryString["trade_no"];              //支付宝交易号
                    string order_no = Request.QueryString["out_trade_no"];	        //获取订单号
                    string total_fee = Request.QueryString["total_fee"];            //获取总金额
                    string subject = Request.QueryString["subject"];                //商品名称、订单名称
                    string body = Request.QueryString["body"];                      //商品描述、订单备注、描述
                    string buyer_email = Request.QueryString["buyer_email"];        //买家支付宝账号
                    string trade_status = Request.QueryString["trade_status"];      //交易状态

                    if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                    {

                        StoreEntities db = new StoreEntities();
                        int id = int.Parse(order_no);
                        OrderHead order = db.OrderHeadSet.Single(x=>x.ID.Equals(id));
                        order.Status = "SUCCESS";
                        db.SaveChanges();
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序
                    }
                    else
                    {
                        Response.Write("trade_status=" + Request.QueryString["trade_status"]);
                    }

                    //打印页面
                    Response.Write("验证成功<br />");
                    Response.Write("trade_no=" + trade_no);

                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    Response.Write("验证失败");
                }
            }
            else
            {
                Response.Write("无返回参数");
            }
        }
Exemple #3
0
 protected void btnCrateOrder_Click(object sender, EventArgs e)
 {
     StoreEntities db = new StoreEntities();
     OrderHead head = db.OrderHeadSet.CreateObject();
     head.Buyer = txtBuyer.Text.Trim();
     db.AddToOrderHeadSet(head);
     db.SaveChanges();
     lblOrderId.Text = head.ID.ToString();
     BindOrder();
 }
Exemple #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string ParaGID = (Request.QueryString["gid"] ?? "NaN").ToString();
         if (ParaGID != "NaN")
         {
             hfdGoodsID.Value = ParaGID;
             StoreEntities db = new StoreEntities();
             ValueOfPage.Add("DataSource", db);
             int Id = int.Parse(ParaGID);
             BindChangedList(Id);
         }
     }
 }
Exemple #5
0
 private void BindOrder()
 {
     StoreEntities db = new StoreEntities();
     this.dlOrders.DataSource = db.OrderHeadSet;
     this.dlOrders.DataBind();
 }
Exemple #6
0
 private List<ListItem> BuildDropListItem()
 {
     StoreEntities db = new StoreEntities();
     List<ListItem> lst = new List<ListItem>();
     var bs = blogic.GetRootBrand();
     int l = 0;
     foreach (Brand br in bs)
     {
         ListItem lt = new ListItem();
         lt.Text = br.BrandName;
         lt.Value = br.ID.ToString();
         lst.Add(lt);
         if (br.ChildBrandSet.Count != 0)
         {
             l += 1;
             InsertDropListItem(br, ref l, lst);
             l -= 1;
         }
     }
     return lst;
 }