コード例 #1
0
        /// <summary>
        /// 订单收货
        /// </summary>
        void ReceiveOrder()
        {
            string oid = string.Empty;

            if (Request["oid"] != null && Request["oid"] != "")
            {
                oid = Common.Common.NoHtml(Request["oid"]);
            }
            if (oid != null && oid != "")
            {
                MSProductOrderDAL OrderDal = new MSProductOrderDAL();
                if (OrderDal.UpdateOrderState("isReceive", oid))
                {
                    string buyName = string.Empty;
                    try
                    {
                        buyName = OrderDal.GetOrderValueByID("BuyName", oid).ToString();
                        if (strOpenID == null || strOpenID == "")
                        {
                            string         customerid  = OrderDal.GetOrderDetailValueByOID("CustomerID", oid).ToString();
                            MSCustomersDAL CustomerDal = new MSCustomersDAL();
                            try
                            {
                                strOpenID = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode("VYIGO");
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first", "尊敬的" + buyName));
                        paramList.Add(new TemplateMessageParam("OrderSn", oid));
                        paramList.Add(new TemplateMessageParam("OrderStatus", "已收货"));
                        paramList.Add(new TemplateMessageParam("Remark",
                                                               "请关注公众号【vgo2013】进入“服务中心进行查询”查看完整信息"));
                        wx.SendTemplateMessage(strOpenID, "wmrxCKRq1hG3cHR0BXsuUnNq1chcbVosqYLqlsBBRCc",
                                               "http://www.vgo2013.com/PalmShop/ShopCode/CustomerOrder.aspx?receive=1",
                                               paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("提示客户订单【" + oid +
                                                    "】已确认收货,发送模板消息到客户OpenID【" + strOpenID + "】");
                    }
                    catch (Exception)
                    {
                    }
                    Response.Write("{\"success\":true}");
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}");
                }
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}");
            }
            Response.End();
        }
コード例 #2
0
        public override void OnPaySucceed(AliWapPayCallBackInfo info)
        {
            ExceptionLog log = new ExceptionLog();

            log.Message = string.Format("订单号:{0},支付宝交易号:{1}",
                                        info.out_trade_no, info.trade_no);
            ExceptionLogDAL.InsertExceptionLog(log);

            if (info.result.ToLower() == "success")
            {
                oid   = info.out_trade_no;
                payid = info.trade_no;

                MSProductOrderDAL ptitleDal = new MSProductOrderDAL();
                int paystate = 0;
                try
                {
                    paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.out_trade_no).ToString());
                }
                catch (Exception)
                {
                }
                if (paystate == 0)
                {
                    bool updatepayway   = ptitleDal.UpdateOrderPayWay(info.out_trade_no, "alipay");
                    bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.out_trade_no, "1");
                    MSOrderLogDAL.AddMSOrderLog("订单【" + info.out_trade_no + "】支付成功,支付方式:支付宝支付");
                    if (updatepayway == true && updateOrderNum == true)
                    {
                        string countcost = string.Empty; string pid = string.Empty; string pname = string.Empty;
                        #region -获取用户数据
                        string strOpenID = string.Empty; string customerid = string.Empty;
                        try
                        {
                            customerid = ptitleDal.GetOrderValueByID("CustomerID", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        if (customerid != null && customerid != "")
                        {
                            MSCustomersDAL CustomerDal = new MSCustomersDAL();
                            try
                            {
                                strOpenID = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                        #endregion
                        #region -获取产品信息
                        try
                        {
                            countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            pid = ptitleDal.GetOrderDetailValueByOID("PID", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        if (pid != null && pid != "")
                        {
                            MSProductDAL ProductDal = new MSProductDAL();
                            pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString();
                        }
                        #endregion
                        string      strSiteCode = GetSiteCode();
                        WXConfigDAL dal         = new WXConfigDAL();

                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first",
                                                               "我们已收到您的货款,订单号为:" + info.out_trade_no +
                                                               ";我们将尽快为您打包商品,请耐心等待: )"));
                        paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元"));
                        paramList.Add(new TemplateMessageParam("orderProductName", pname));
                        paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!"));
                        wx.SendTemplateMessage(strOpenID, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA",
                                               "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.out_trade_no,
                                               paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + strOpenID + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )");
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 订单提交
        /// </summary>
        void submitOrder()
        {
            string ordernum = string.Empty; int imgcount = 0;
            string img1 = string.Empty; string img2 = string.Empty;
            string openid = string.Empty; string userid = string.Empty;

            if (Session["OpenID"] != null && Session["OpenID"].ToString() != "")
            {
                openid = Session["OpenID"].ToString();
            }
            if (openid != null && openid != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                try
                {
                    userid = customerDal.GetCustomerValueByOpenID("ID", openid).ToString();
                }
                catch (Exception)
                {
                }
            }
            #region -------------获取请求值------------
            try
            {
                ordernum = Request.Form.Get("ordernum").ToString();
            }
            catch (Exception)
            {
                ordernum = "";
            }
            #endregion
            try
            {
                imgcount = Request.Files.Count;
            }
            catch (Exception)
            {
            }
            if (imgcount == 2)
            {
                img1 = UploadImg(0, "printimg", ordernum);
                img2 = UploadImg(1, "shareimg", ordernum);
                if (userid == null || userid == "" && ordernum != null && ordernum != "")
                {
                    MSProductOrderDAL orderDal = new MSProductOrderDAL();
                    userid = orderDal.GetOrderValueByID("CustomerID", ordernum).ToString();
                }
                if (ordernum != null && ordernum != "")
                {
                    MSPhotoSubmit    photoModel = new MSPhotoSubmit();
                    MSPhotoSubmitDAL photoDal   = new MSPhotoSubmitDAL();
                    photoModel.OrderNum = ordernum;
                    photoModel.Img1     = img1;
                    photoModel.Img2     = img2;
                    photoModel.UID      = userid;
                    photoModel.ID       = Guid.NewGuid().ToString("N").ToUpper();
                    if (!photoDal.AddPhotoSubmit(photoModel))
                    {
                        errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
                    }
                    else
                    {
                        errormsg = JQDialog.alertOKMsgBox(3, "操作成功,请等待审核!", "PrintImgOrder.aspx", "succeed");
                    }
                }
                else
                {
                    errormsg = JQDialog.alertOKMsgBoxGoBack(3, "请输入正确的订单!", false);
                }
            }
            else
            {
                errormsg = JQDialog.alertOKMsgBoxGoBack(3, "请选择您要打印的照片和分享的照片!", false);
            }
        }
コード例 #4
0
        /// <summary>
        /// 提交订单
        /// </summary>
        void submitOrder()
        {
            string oid = string.Empty; string cid = string.Empty; string cname = string.Empty;

            #region -获取页面请求值
            try
            {
                oid = Request.Form.Get("ordernum").ToString();
            }
            catch (Exception)
            {
                oid = "";
            }
            try
            {
                cname = Request.Form.Get("cname").ToString();
            }
            catch (Exception)
            {
                cname = "";
            }
            try
            {
                cid = Request.Form.Get("cid").ToString();
            }
            catch (Exception)
            {
                cid = "";
            }
            #endregion
            strSiteCode = "VYIGO"; string customerid = string.Empty; string openid = string.Empty;
            if (oid != null && oid != "" && cid != null && cid != "")
            {
                MSOrderLogistics    olModel  = new MSOrderLogistics();
                MSOrderLogisticsDAL olDal    = new MSOrderLogisticsDAL();
                MSProductOrderDAL   OrderDal = new MSProductOrderDAL();
                olModel.ID = cid; olModel.OID = oid; olModel.CName = cname;

                customerid = OrderDal.GetOrderValueByID("CustomerID", oid).ToString();

                if (customerid != null && customerid != "")
                {
                    MSCustomersDAL customerDal = new MSCustomersDAL();
                    openid = customerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                }

                if (olDal.AddOrderLogistics(olModel) && OrderDal.UpdateOrderState("IsSend", oid))
                {
                    string buyName = string.Empty;
                    try
                    {
                        buyName = OrderDal.GetOrderValueByID("BuyName", oid).ToString();
                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first", "亲,宝贝已经启程了,好想快点来到你身边"));
                        paramList.Add(new TemplateMessageParam("delivername", cname));
                        paramList.Add(new TemplateMessageParam("ordername", cid));
                        paramList.Add(new TemplateMessageParam("remark",
                                                               "请关注公众号【vgo2013】进入“快点我”查看完整物流信息"));
                        SendTemplateMessageReturnObj temobj = wx.SendTemplateMessage(openid,
                                                                                     "k4eMeEtKReeDvDRFAf8-Li9FuuHkaFPP1xQI6t3Jomo",
                                                                                     "http://www.vgo2013.com/PalmShop/ShopCode/CopyOrder.aspx?oid=" + oid,
                                                                                     paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("提示客户订单【" + oid + "】已经发货,发送模板消息到客户OpenID【" + openid + "】");
                        bool flag = true;
                        if (flag)
                        {
                        }
                    }
                    catch { }

                    errormsg = JQDialog.alertOKMsgBox(3, "操作成功!", "OrderDelivery.aspx", "succeed");
                }
                else
                {
                    errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
                }
            }
            else
            {
                errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
            }
        }
コード例 #5
0
        public override void OnPaySucceed(WXJSAPIPayNotifyInfo info)
        {
            ExceptionLog log = new ExceptionLog();

            log.Message = string.Format("Openid:{0},订单号:{1},附加消息:{2}",
                                        info.OpenId, info.OutTradeNo, info.Attach);
            ExceptionLogDAL.InsertExceptionLog(log);

            MSProductOrderDAL ptitleDal = new MSProductOrderDAL();
            int paystate = 0;

            try
            {
                paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.OutTradeNo).ToString());
            }
            catch (Exception)
            {
            }
            if (paystate == 0)
            {
                bool updatepayway   = ptitleDal.UpdateOrderPayWay(info.OutTradeNo, "wxpay");
                bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.OutTradeNo, "1");
                MSOrderLogDAL.AddMSOrderLog("订单【" + info.OutTradeNo + "】支付成功,支付方式:微支付");
                if (updatepayway == true && updateOrderNum == true)
                {
                    string countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString();
                    string strSiteCode = "VYIGO";
                    string pid = string.Empty; string pname = string.Empty;

                    #region -获取产品信息
                    try
                    {
                        countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString();
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        pid = ptitleDal.GetOrderDetailValueByOID("PID", info.OutTradeNo).ToString();
                    }
                    catch (Exception)
                    {
                    }
                    if (pid != null && pid != "")
                    {
                        MSProductDAL ProductDal = new MSProductDAL();
                        pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString();
                    }
                    #endregion

                    WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                    List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                    paramList.Add(new TemplateMessageParam("first", "我们已收到您的货款,订单号为:" +
                                                           info.OutTradeNo + ";我们将尽快为您打包商品,请耐心等待: )"));
                    paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元"));
                    paramList.Add(new TemplateMessageParam("orderProductName", pname));
                    paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!"));
                    wx.SendTemplateMessage(info.OpenId, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA",
                                           "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.OutTradeNo,
                                           paramList.ToArray(), "");
                    MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + info.OpenId + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )");
                    //JQDialog.SendWeiXinMsg(strSiteCode, info.OpenId,
                    //                       "您的订单号【" + info.OutTradeNo + "】已于" +
                    //                       DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") +
                    //                       "付款成功,支付金额:" + countcost +
                    //                       "元;在等待卖家发货,详情请进入我的订单查询!");
                }
            }
        }