コード例 #1
0
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            M_OrderList orderMod = orderBll.SelReturnModel(Mid);
            M_Order_Exp expMod   = new M_Order_Exp();

            if (!string.IsNullOrEmpty(orderMod.ExpressNum))
            {
                expMod = expBll.SelReturnModel(Convert.ToInt32(orderMod.ExpressNum));
            }
            expMod.ExpNo = ExpNo_T.Text.Trim();
            //expMod.CompType = ExpComp_DP.SelectedValue;
            //if (expMod.CompType.Equals("Other ")) { expMod.ExpComp = ExpOther_T.Text; }
            //else { expMod.ExpComp = ExpComp_DP.SelectedValue; }
            if (expMod.ID > 0)
            {
                expBll.UpdateByID(expMod);
            }
            else
            {
                expMod.OrderID = orderMod.id;
                expMod.UserID  = orderMod.Userid;
                expMod.ID      = expBll.Insert(expMod);
            }
            orderMod.StateLogistics = 1;
            orderMod.ExpressNum     = expMod.ID.ToString();
            orderBll.UpdateByID(orderMod);
            if (Email_Chk.Checked)
            {
                EventDeal.SendOrderEmailByType(orderMod.id, "exp");
            }
            function.Script(this, "parent.window.location= parent.location;");
        }
コード例 #2
0
ファイル: getOrderInfo.aspx.cs プロジェクト: zoomlacms/web054
        protected void AddOrder_Btn_Click(object sender, EventArgs e)
        {
            //1,生成订单,2,关联购物车中商品为已绑定订单
            M_UserInfo mu     = SnsHelper.GetLogin();
            DataTable  cartDT = SelByCartID(B_Cart.GetCartID(), mu.UserID, ProClass, ids);//需要购买的商品

            if (cartDT.Rows.Count < 1)
            {
                function.WriteErrMsg("You have not yet chosen the goods");
            }
            //------检测End
            //按店铺生成订单
            DataTable          storeDT   = cartDT.DefaultView.ToTable(true, "StoreID");
            List <M_OrderList> orderList = new List <M_OrderList>();//用于生成临时订单,统计计算(Disuse)

            foreach (DataRow dr in storeDT.Rows)
            {
                M_OrderList Odata = new M_OrderList();
                Odata.Ordertype = OrderHelper.GetOrderType(ProClass);

                Odata.OrderNo = GetOrderNo();
                Odata.StoreID = Convert.ToInt32(dr["StoreID"]);
                cartDT.DefaultView.RowFilter = "StoreID=" + Odata.StoreID;
                DataTable storeCartDT = cartDT.DefaultView.ToTable();


                Odata.Promoter     = TipID;
                Odata.Invoiceneeds = DataConverter.CLng(Request.Form["invoice_rad"]);//是否需开发票
                //Odata.Invoice = Odata.Invoiceneeds == 0 ? "" : InvoTitle_T.Text + "||" + Invoice_T.Text;
                Odata.Rename       = mu.UserName;
                Odata.AddUser      = mu.UserName;;
                Odata.Userid       = mu.UserID;
                Odata.Ordermessage = Server.HtmlEncode((Request.Form["orderMsg"] ?? ""));// ORemind_T.Text;//订货留言
                //-----金额计算
                Odata.Balance_price  = GetTotalMoney(storeCartDT);
                Odata.Freight        = 0;
                Odata.Ordersamount   = Odata.Balance_price + Odata.Freight; //订单金额
                Odata.AllMoney_Json  = orderCom.GetTotalJson(storeCartDT);  //附加需要的虚拟币
                Odata.Specifiedprice = Odata.Ordersamount;                  //订单金额;
                Odata.OrderStatus    = (int)M_OrderList.StatusEnum.Normal;  //订单状态
                Odata.Paymentstatus  = (int)M_OrderList.PayEnum.NoPay;      //付款状态
                                                                            //Odata.Integral = DataConverter.CLng(Request.QueryString["jifen"]);
                                                                            //Odata.ExpTime = exptime_hid.Value;
                M_Grade countryMod = B_GradeOption.GetGradeOption(Convert.ToInt32(Request.Form["country"]));
                M_Grade stateMod   = B_GradeOption.GetGradeOption(Convert.ToInt32(Request.Form["state"]));
                Odata.Money_rate = 0;

                Odata.Receiver  = Request.Form["FullName"];
                Odata.Phone     = Request.Form["phone"];
                Odata.MobileNum = Request.Form["phone"];
                Odata.Email     = Request.Form["email"];
                Odata.Diqu      = countryMod.GradeName;
                Odata.Shengfen  = stateMod.GradeName;
                Odata.Chengshi  = Request.Form["city"];
                Odata.Jiedao    = Request.Form["address"];
                Odata.ZipCode   = Request.Form["zip"];



                Odata.id = orderBll.insert(Odata);
                CopyToCartPro(mu, storeCartDT, Odata.id);
                orderList.Add(Odata);
                //orderCom.SendMessage(Odata, null, "ordered");
                //-----联系人
                B_Order_Contact conBll = new B_Order_Contact();
                M_Order_Contact conMod = new M_Order_Contact();

                conMod.OrderID  = Odata.id;
                conMod.FullName = Request.Form["fullname"];
                conMod.Email    = Request.Form["email"];
                conMod.Address  = Request.Form["address"];
                conMod.City     = Request.Form["city"];
                conMod.State    = stateMod.GradeName;
                conMod.Country  = countryMod.GradeName;
                conMod.Zip      = Request.Form["zip"];
                conMod.Phone    = Request.Form["phone"];
                conMod.Remark   = "";
                conBll.Insert(conMod);
            }
            //cartBll.DelByids(ids);//客户希望保留购物车中信息
            //-----------------订单生成后处理
            M_Payment payMod = payBll.CreateByOrder(orderList);

            //优惠券,编号与密码
            if (!string.IsNullOrEmpty(Coupon_Num.Text))
            {
                B_Ex_Coupon cupBll = new B_Ex_Coupon();
                string      code   = Coupon_Num.Text.Trim();
                //string pwd = Coupon_Pwd.Text.Trim();
                //M_Arrive avMod = SnsHelper.AV_SelModel(code);
                //M_Arrive_Result retMod = SnsHelper.CheckArrive(code, pwd, payMod.MoneyPay);
                //if (retMod.enabled)
                //{
                //    payMod.MoneyPay = retMod.money;
                //    payMod.ArriveMoney = retMod.amount;
                //    payMod.ArriveDetail = "优惠券号:" + code + ",密码:" + pwd;
                //    SnsHelper.Use_Arrive(avMod, "支付单[" + payMod.PayNo + "]使用,优惠金额:" + retMod.amount.ToString("F2"));
                //}
                //else { function.WriteErrMsg(retMod.err); }
                M_Arrive_Result retMod = cupBll.CheckArrive(code, payMod.MoneyPay);
                if (retMod.enabled)
                {
                    payMod.MoneyPay     = retMod.money;
                    payMod.ArriveMoney  = retMod.amount;
                    payMod.ArriveDetail = "优惠券号:" + code;
                }
            }
            payMod.MoneyReal = payMod.MoneyPay;
            payMod.Remark    = cartDT.Rows.Count > 1 ? "[" + cartDT.Rows[0]["ProName"] as string + "]等" : cartDT.Rows[0]["ProName"] as string;
            payMod.PaymentID = payBll.Add(payMod);
            //取消下面注释激活下单立即发送邮件
            EventDeal.SendOrderEmailByType(orderList[0].id, "order", SiteConfig.SiteInfo.WebmasterEmail);
            Response.Cookies["agree_save"].Value   = Request.Form["agree_save_chk"];
            Response.Cookies["agree_save"].Expires = DateTime.Now.AddYears(1);
            Response.Redirect("/PayOnline/Orderpay.aspx?PayNo=" + payMod.PayNo);
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     platMod = new B_PayPlat().SelModelByClass(M_PayPlat.Plat.PayPal);
     try
     {
         if (CheckSign())
         {
             string payno  = executedPayment.transactions[0].invoice_number;
             double amount = DataConvert.CDouble(executedPayment.transactions[0].related_resources[0].sale.amount.total);
             PaySuccess(payno, amount);
             //-----------------
             payMod   = payBll.SelModelByPayNo(payno);
             orderMod = orderBll.SelModelByOrderNo(payMod.PaymentNum.Trim(','));
             M_Order_Contact conMod = new B_Order_Contact().SelModelByOid(orderMod.id);
             PayNo_L.Text   = payMod.PayNo;
             OrderNo_L.Text = orderMod.OrderNo;
             Amount_L.Text  = payMod.MoneyPay.ToString("F2");
             Email_L.Text   = conMod.Email;
             DBCenter.DelByWhere("ZL_Cart", "CartId=@cartid", new List <SqlParameter>()
             {
                 new SqlParameter("cartid", B_Cart.GetCartID(Context))
             });
             EventDeal.SendOrderEmailByType(orderMod.id, "payed", SiteConfig.SiteInfo.WebmasterEmail);
             EventDeal.SendOrderEmailByType(orderMod.id, "payed");
         }
         else
         {
             ZLLog.L(ZLEnum.Log.pay, "[" + PayPlat + "]签名验证失败,返回:" + ServerReturn);
             function.WriteErrMsg("Validation failed, information mismatch");
         }
     }
     catch (Exception ex)
     {
         Log("[" + PayPlat + "]出错,原因:" + ex.Message + ",返回:" + ServerReturn);
         success_div.Visible = false;
         fail_div.Visible    = true;
         //------------------------------------
         payMod = payBll.SelModelByPayNo(Request["payno"]);
         if (payMod == null)
         {
             function.WriteErrMsg("order does not exist");
         }
         if (payMod.Status != (int)M_Payment.PayStatus.NoPay)
         {
             function.WriteErrMsg("The order has been paid and cannot be repeated");
         }
         orderMod            = orderBll.SelModelByOrderNo(payMod.PaymentNum.Trim(','));
         Fail_PayNo_L.Text   = payMod.PayNo;
         Fail_OrderNo_L.Text = orderMod.OrderNo;
         Fail_Amount_L.Text  = payMod.MoneyPay.ToString("F2");
         //------------------------------------
         //if (string.IsNullOrEmpty(payMod.code))
         //{
         //    string cartId = B_Cart.GetCartID(Context);
         //    B_Cart cartBll = new B_Cart();
         //    B_CartPro cpBll = new B_CartPro();
         //    DataTable cartDT = cpBll.SelByOrderID(orderMod.id);
         //    foreach (DataRow cartDR in cartDT.Rows)
         //    {
         //        M_Cart cartMod = new M_Cart().GetModelFromReader(cartDR);
         //        cartMod.userid = 10000;
         //        cartMod.Cartid = cartId;
         //        cartMod.ProAttr = DataConvert.CStr(cartDR["Attribute"]);
         //        cartBll.insert(cartMod);
         //    }
         //    DBCenter.UpdateSQL(payMod.TbName,"Code='1'", "PaymentID=" + payMod.PaymentID);
         //}
         //function.WriteErrMsg("Error:Unfinished payment");
     }
 }
コード例 #4
0
 protected void SendMail_Click(object sender, EventArgs e)
 {
     EventDeal.SendOrderEmailByType(Mid, ((Button)sender).CommandName);
     Response.Redirect(Request.RawUrl);
 }