/// <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(); }
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 + "】我们将尽快为您打包商品,请耐心等待: )"); } } } }
/// <summary> /// 删除订单 /// </summary> void DelOrder() { string oid = string.Empty; string uid = string.Empty; if (Request["oid"] != null && Request["oid"] != "") { oid = Common.Common.NoHtml(Request["oid"]); } if (Request["uid"] != null && Request["uid"] != "") { uid = Common.Common.NoHtml(Request["uid"]); } if (oid != null && oid != "" && uid != null && uid != "") { MSProductOrderDAL OrderDal = new MSProductOrderDAL(); if (OrderDal.UpdateOrderStateByUID(uid, oid)) { int orderquantity = 0; string mid = string.Empty; int quantity = 0; #region -更新库存 MSProductParaDAL paraDal = new MSProductParaDAL(); try { orderquantity = Convert.ToInt32(OrderDal.GetOrderDetailValueByOID("Quantity", oid).ToString()); } catch (Exception) { } if (orderquantity != null && orderquantity > 0) { try { mid = OrderDal.GetOrderDetailValueByOID("MID", oid).ToString(); } catch (Exception) { } } if (mid != null && mid != "") { try { quantity = Convert.ToInt32(paraDal.GetMSPParaValueByID("Stock", mid).ToString()); } catch (Exception) { } } #endregion if (quantity >= 0 && orderquantity > 0) { quantity = quantity + orderquantity; try { paraDal.UpdateStock(quantity, mid); } catch (Exception) { } } MSOrderLogDAL.AddMSOrderLog("订单【" + oid + "】已被客户【" + uid + "】OpenID-【" + strOpenID + "】取消,库存更新"); Response.Write("{\"success\":true}"); } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}"); } } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}"); } Response.End(); }
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 + // "元;在等待卖家发货,详情请进入我的订单查询!"); } } }