public void WeiXinNotify() { ResultNotify resultNotify = new ResultNotify(); WxPayData notifyData = resultNotify.GetNotifyData(); LogUtil.Log("微信支付返回接口接收:", notifyData.ToXml()); if (notifyData.GetValue("return_code") != null && (notifyData.GetValue("return_code").ToString() == "SUCCESS") && notifyData.GetValue("out_trade_no") != null && notifyData.GetValue("transaction_id") != null) { string paycode = notifyData.GetValue("out_trade_no").ToString(); decimal fee = StringUtils.GetDbDecimal(notifyData.GetValue("total_fee")) / 100; VWPayOrderEntity payentity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode); if (payentity.Id > 0 && payentity.Status == 0)//未支付完成 { payentity.PayTime = DateTime.Now; payentity.PayPrice = fee; payentity.ExternalCode = notifyData.GetValue("transaction_id").ToString(); payentity.Status = 1; //先更新业务网站收款记录 if (payentity.SysType == (int)SystemType.B2B || payentity.SysType == (int)SystemType.B2BMobile) { VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(payentity.SysOrderCode)); if (_order.Status == (int)OrderStatus.WaitPay) { if (OrderBLL.Instance.PayFinishedForOrder(StringUtils.GetDbLong(payentity.SysOrderCode), fee) > 0) { ///业务网站状态更新后更新支付总表 PayOrderBLL.Instance.RecivedPaySuccess(payentity); } } } } } }
public VWOrderEntity GetVWOrderByTempCode(long tempcode) { VWOrderEntity _vworder = new VWOrderEntity(); IList <VWOrderDetailEntity> _listproduct = OrderDetailPreTempDA.Instance.GetOrderDetailsByCode(tempcode, 1); //IList<OrderDetailPreTempEntity> _listproduct = OrderDetailPreTempBLL.Instance.GetOrderPreTempByCode(tempcode, 1); _vworder.Details = _listproduct; OrderCommonBLL.Instance.GetTransFeeForOrder(_vworder); //IList<VWOrderDetailEntity> listdetail = new List<VWOrderDetailEntity>(); //foreach (OrderDetailPreTempEntity Preentity in _listproduct) //{ // VWOrderDetailEntity vwdetail = new VWOrderDetailEntity(); // vwdetail.OrderDetailId = Preentity.p; // vwdetail.ProductDetailId = Preentity.ProductDetailId; // vwdetail.ProductId = Preentity.ProductId; // vwdetail.Num = Preentity.Num; // listdetail.Add(vwdetail); //} _vworder.PreOrderCode = tempcode; _vworder.OrderType = (int)OrderType.OnLine; _vworder.NeedDeliver = 1; _vworder.PayPrice = 0; return(_vworder); }
public VWOrderEntity GetTransFeeForOrder(VWOrderEntity _order) { //decimal _ActPrice = 0; //decimal _discountfee = 0; int num = 0; decimal _totalmarketprice = 0; decimal _totalprice = 0; if (_order.Details != null && _order.Details.Count > 0) { foreach (VWOrderDetailEntity _entity in _order.Details) { //if (_entity.TransFeeType == (int)TransFeeType.Free || _entity.TransFeeType == (int)TransFeeType.PayBehind) //{ // hasfree = true; //} //_totalmarketprice += _entity.MarketPrice * _entity.Num; _totalprice += _entity.ActualPrice * _entity.Num; num += _entity.Num; } } _order.TransFee = 0; _order.TotalPrice = _totalprice; _order.TotalMarketPrice = _totalmarketprice; //折扣 _order.PreDisCountPrice = _order.TotalPrice + _order.TransFee; _order.ActPrice = _order.PreDisCountPrice; _order.AllNum = num; return(_order); }
public Dictionary <int, VWOrderEntity> GetVWOrdersByTempCode(long tempcode) { Dictionary <int, VWOrderEntity> listsdic = new Dictionary <int, VWOrderEntity>();//产品字典 IList <VWOrderDetailEntity> _listproduct = OrderDetailPreTempDA.Instance.GetOrderDetailsByCode(tempcode, -1); if (_listproduct != null && _listproduct.Count > 0) { foreach (VWOrderDetailEntity entity in _listproduct) { if (entity.Status > 0) { if (!listsdic.ContainsKey(entity.CGMemId)) { listsdic[entity.CGMemId] = new VWOrderEntity(); listsdic[entity.CGMemId].IsAhmTake = entity.IsAhmTake; } listsdic[entity.CGMemId].Details.Add(entity); } else { if (!listsdic.ContainsKey(0))//下架产品列表 { listsdic[0] = new VWOrderEntity(); } listsdic[0].Details.Add(entity); } } } return(listsdic); }
public VWOrderEntity GetTransFeeDisCount(IList <OrderDetailPreTempEntity> _list) { VWOrderEntity _order = new VWOrderEntity(); //decimal _ActPrice = 0; //decimal _discountfee = 0; int num = 0; decimal _totalmarketprice = 0; decimal _totalprice = 0; if (_list != null && _list.Count > 0) { foreach (OrderDetailPreTempEntity _entity in _list) { //if (_entity.TransFeeType == (int)TransFeeType.Free || _entity.TransFeeType == (int)TransFeeType.PayBehind) //{ // hasfree = true; //} _totalmarketprice += _entity.MarketPrice * _entity.Num; _totalprice += _entity.ActualPrice * _entity.Num; num += _entity.Num; } } _order.TransFee = 0; _order.TotalPrice = _totalprice; _order.TotalMarketPrice = _totalmarketprice; //折扣 _order.PreDisCountPrice = _order.TotalPrice + _order.TransFee; _order.ActPrice = _order.PreDisCountPrice; _order.AllNum = num; return(_order); }
/// <summary> /// 预订单 /// </summary> /// <returns></returns> public ActionResult PreOrder() { long _preordercode = QueryString.LongIntSafeQ("code"); int _jishi = QueryString.IntSafeQ("js"); if (_jishi == (int)JiShiSongEnum.JiShi) { XuQiuPreOrderMethod(_preordercode); } else { ///可正常销售的产品 IList <OrderDetailPreTempEntity> _listproduct = OrderDetailPreTempBLL.Instance.GetOrderPreTempByCode(_preordercode, 1); //不能正常销售的产品 IList <OrderDetailPreTempEntity> _listproductless = OrderDetailPreTempBLL.Instance.GetOrderPreTempByCode(_preordercode, 0); ViewBag.ProductList = _listproduct; ViewBag.ProductListLess = _listproductless; ViewBag.MemId = member.MemId; ViewBag.PreOrderCode = _preordercode; VWOrderEntity _order = OrderCommonBLL.Instance.GetTransFeeDisCount(_listproduct); ViewBag.Order = _order; IntegralEntity _entity = IntegralBLL.Instance.GetIntegralByMemId(memid); ViewBag.Integral = _entity; } ViewBag.JiShiSong = _jishi; return(View()); }
/// <summary> /// 生成订单 /// </summary> /// <param name="products"></param> /// <param name="memid"></param> /// <returns></returns> public string CreateOrder(VWOrderEntity order, OrderAddressEntity _address, OrderBillBasicEntity _billentity) { Random rd = new Random(); order.Code = StringUtils.GetDbLong(XTCodeBLL.Instance.GetCodeFromProc(XTCodeType.OrderDayNo) + rd.Next(100, 999).ToString()); order.OrderVisualCode = order.Code; order.CreateTime = DateTime.Now; order.Status = (int)OrderStatus.WaitPay; return(OrderDA.Instance.CreateOrder(order, _address, _billentity)); }
/// <summary> /// 收货 /// </summary> /// <returns></returns> public string Recepit() { long _ordercode = FormString.LongIntSafeQ("ordercode"); int _result = OrderBLL.Instance.UpdateOrderByCode(_ordercode, (int)OrderStatus.Finished); if (_result > 0) { VWOrderEntity _entity = OrderBLL.Instance.GetVWOrderByCode(_ordercode); return(JsonJC.ObjectToJson(_entity)); } return(null); }
public VWOrderEntity GetOrderByMemId(long code, int memid) { VWOrderEntity _order = OrderDA.Instance.GetVWOrderByCode(code, memid); if (_order != null && _order.Id > 0) { //_order.AccepterProvinceName = GYProvinceBLL.Instance.GetGYProvinceByCode(_order.AccepterProvinceId.ToString()).Name; //_order.AccepterCityName = GYProvinceBLL.Instance.GetGYProvinceByCode(_order.AccepterCityId.ToString()).Name; _order.Details = OrderDetailBLL.Instance.GetDetailsByOrderCode(code, "", -1); } return(_order); }
public VWOrderEntity GetVWOrderByCode(Int64 code) { VWOrderEntity _order = OrderDA.Instance.GetVWOrderByCode(code); if (_order != null && _order.Id > 0 && _order.AccepterProvinceId > 0 && _order.AccepterCityId > 0) { //_order.AccepterProvinceName = GYProvinceBLL.Instance.GetGYProvinceByCode(_order.AccepterProvinceId.ToString()).Name; _order.AccepterCityName = GYCityBLL.Instance.GetGYCityByCode(_order.AccepterCityId.ToString()).Name; _order.Details = OrderDetailBLL.Instance.GetDetailsByOrderCode(_order.Code, "", -1); } return(_order); }
/// <summary> /// 订单详情 /// </summary> /// <returns></returns> public ActionResult OrderDetails() { long _ordercode = QueryString.LongIntSafeQ("ordercode"); int _orderDetailId = QueryString.IntSafeQ("orderDetailId"); VWOrderEntity _entity = OrderBLL.Instance.GetVWOrderByCode(_ordercode); IList <OrderDetailEntity> _detailEntitys = OrderDetailBLL.Instance.GetOrderDetailAllByOrder(_entity.MemId, _ordercode, false); OrderBillBasicEntity _billEntity = OrderBillBasicBLL.Instance.GetBillBasicByOrderCode(_ordercode); VWMemberEntity mem = BLL.MemberDB.MemberBLL.Instance.GetVWMember(_entity.MemId); string _status = EnumShow.Instance.GetEnumDes((OrderStatus)_entity.Status); ViewBag.entity = _entity; ViewBag.VWMem = mem; ViewBag.detailEntity = _detailEntitys; ViewBag.status = _status; ViewBag.billEntity = _billEntity; return(View()); }
public string CreateOrderList(Dictionary <int, VWOrderEntity> orderlist, OrderAddressEntity _address, OrderBillBasicEntity _billentity) { Random rd = new Random(); string vbatchno = XTCodeBLL.Instance.GetCodeFromProc(XTCodeType.OrderDayNo) + rd.Next(1, 9).ToString(); int suborderi = 0; foreach (int orderkey in orderlist.Keys) { suborderi++; VWOrderEntity order = orderlist[orderkey]; order.Code = StringUtils.GetDbLong(vbatchno + suborderi.ToString().PadLeft(2, '0')); order.OrderVisualCode = StringUtils.GetDbLong(vbatchno); order.CreateTime = DateTime.Now; order.Status = (int)OrderStatus.XuQiuSubmit; OrderDA.Instance.CreateOrderXuQiu(order, _address, _billentity); } return(vbatchno); }
public string CreateOrderByCart() { ResultObj result = new ResultObj(); long _ordercode = FormString.LongIntSafeQ("ordercode"); long _cartcode = FormString.LongIntSafeQ("cartcode"); OrderAddressEntity _address = new OrderAddressEntity(); _address = OrderAddressBLL.Instance.GetOrderAddressByOrderCode(_ordercode); OrderBillBasicEntity _billentity = new OrderBillBasicEntity(); _billentity = OrderBillBasicBLL.Instance.GetBillBasicByOrderCode(_ordercode); VWOrderEntity _vworder = OrderDetailPreTempBLL.Instance.GetVWOrderByTempCode(_cartcode); OrderEntity _orderentity = OrderBLL.Instance.GetOrderByCode(_ordercode); if (_address != null && _address.Id > 0 && _billentity != null && _billentity.Id > 0 && _vworder != null && _vworder.ActPrice > 0) { _vworder.MemId = _orderentity.MemId; _vworder.MemLevel = _orderentity.MemLevel; _vworder.IsStore = _orderentity.IsStore; _vworder.Integral = 0; _vworder.IntegralFee = 0; string newordercode = OrderBLL.Instance.CreateOrder(_vworder, _address, _billentity); OrderCreateLogEntity log = new OrderCreateLogEntity(); log.OldOrderCode = _ordercode; log.PreTempCode = _cartcode; log.CreateManId = memid; log.NewOrderCode = StringUtils.GetDbLong(newordercode); OrderCreateLogBLL.Instance.AddOrderCreateLog(log); result.Status = (int)SuperMarket.Model.CommonStatus.Success; } else { result.Status = (int)SuperMarket.Model.CommonStatus.Fail; } return(JsonJC.ObjectToJson(result)); }
/// <summary> /// 阿里支付通知 /// </summary> public void PayAliPayNotify() { SortedDictionary <string, string> sPara = GetRequestPost(); LogUtil.Log("订单付款回调接口,订单号:", ""); if (sPara.Count > 0)//判断是否有带返回参数 { alipayNotify aliNotify = new alipayNotify(); bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); //验证消息是否是支付宝发出的合法消息 if (verifyResult) //验证成功 { LogUtil.Log("订单付款回调成功:", ""); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.Form["out_trade_no"]; //支付宝交易号 string trade_no = Request.Form["trade_no"]; LogUtil.Log("订单付款回调成功:", out_trade_no); LogUtil.Log("订单付款回调成功:", trade_no); //交易状态 //&trade_no = 2016101021001004470296721955 string trade_status = Request.Form["trade_status"]; // string buyer_email = Request.Form["buyer_email"]; //lgzh306%40126.com string buyer_id = Request.Form["buyer_id"]; //2088602184028472 string exterface = Request.Form["exterface"]; //create_direct_pay_by_user string is_success = Request.Form["is_success"]; //T string notify_id = Request.Form["notify_id"]; //RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6 string notify_time = Request.Form["notify_time"]; //2016-10-10+15%3A48%3A34 string notify_type = Request.Form["notify_type"]; //trade_status_sync string payment_type = Request.Form["payment_type"]; //1 string seller_email = Request.Form["seller_email"]; //20718505%40qq.com string seller_id = Request.Form["seller_id"]; //2088421564177650 string subject = Request.Form["subject"]; //111 string total_fee = Request.Form["total_fee"]; //0.01 PayAliResultEntity _entity = new PayAliResultEntity(); _entity.Buyeremail = buyer_email; _entity.Buyerid = buyer_id; _entity.CreateTime = DateTime.Now; _entity.HasDeal = 0; _entity.Issuccess = is_success; _entity.Notifytime = notify_time; _entity.Notifytype = notify_type; _entity.Outtradeno = out_trade_no; _entity.Paymenttype = payment_type; _entity.Selleremail = seller_email; _entity.Sellerid = seller_id; _entity.Subject = subject; _entity.Totalfee = total_fee; _entity.Tradeno = trade_no; _entity.Tradestatus = trade_status; LogUtil.Log("订单付款回调成功:", JsonJC.ObjectToJson(_entity)); PayAliResultBLL.Instance.AddPayAliResult(_entity); //http://pay.ddbbqp.com/return_url.aspx?buyer_email=lgzh306%40126.com&buyer_id=2088602184028472&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6¬ify_time=2016-10-10+15%3A48%3A34¬ify_type=trade_status_sync&out_trade_no=test20161010092017&payment_type=1&seller_email=20718505%40qq.com&seller_id=2088421564177650&subject=111&total_fee=0.01&trade_no=2016101021001004470296721955&trade_status=TRADE_SUCCESS&sign=4d4f0c35e95f4dce7c34c1ff70e321fd&sign_type=MD5 LogUtil.Log("订单付款回调成功:", "222222"); if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS") { LogUtil.Log("订单付款回调成功:", "33333333333"); //判断该笔订单是否在商户网站中已经做过处理 VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(out_trade_no)); if (_order.Status == (int)OrderStatus.WaitPay) { LogUtil.Log("订单付款回调成功:", "44444444"); AssetReChargeEntity _asset = new AssetReChargeEntity(); _asset.Amt = StringUtils.GetDbDecimal(_entity.Totalfee); _asset.BankCode = buyer_id; _asset.CardNo = buyer_email; _asset.TranSerialNum = trade_no; _asset.CreateTime = DateTime.Now; _asset.MemId = _order.MemId; _asset.IpAddress = IPAddress.IP; _asset.PayType = 1; LogUtil.Log("订单付款回调成功:", "555555"); if (OrderBLL.Instance.PayFinished(StringUtils.GetDbLong(out_trade_no), _asset) > 0) { EmailSendBLL.Instance.OrderRemind(out_trade_no); LogUtil.Log("订单付款成功,订单号:", out_trade_no.ToString()); } else { LogUtil.Log("订单付款成功更新失败,订单号:", out_trade_no.ToString()); } } //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 } else { LogUtil.Log("订单付款成功更新失败,订单号:", out_trade_no.ToString() + " 订单状态:" + Request.QueryString["trade_status"]); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else { LogUtil.Log("订单付款支付验证失败", "111"); } } }
/// <summary> /// 阿里支付结果 /// </summary> /// <returns></returns> public ActionResult PayAliPayResult() { SortedDictionary <string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { alipayNotify aliNotify = new alipayNotify(); bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); //验证消息是否是支付宝发出的合法消息 if (verifyResult) //验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; // string buyer_email = Request.QueryString["buyer_email"]; //lgzh306%40126.com string buyer_id = Request.QueryString["buyer_id"]; //2088602184028472 string exterface = Request.QueryString["exterface"]; //create_direct_pay_by_user string is_success = Request.QueryString["is_success"]; //T string notify_id = Request.QueryString["notify_id"]; //RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6 string notify_time = Request.QueryString["notify_time"]; //2016-10-10+15%3A48%3A34 string notify_type = Request.QueryString["notify_type"]; //trade_status_sync string payment_type = Request.QueryString["payment_type"]; //1 string seller_email = Request.QueryString["seller_email"]; //20718505%40qq.com string seller_id = Request.QueryString["seller_id"]; //2088421564177650 string subject = Request.QueryString["subject"]; //111 string total_fee = Request.QueryString["total_fee"]; //0.01 //http://pay.ddbbqp.com/return_url.aspx?buyer_email=lgzh306%40126.com&buyer_id=2088602184028472&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6¬ify_time=2016-10-10+15%3A48%3A34¬ify_type=trade_status_sync&out_trade_no=test20161010092017&payment_type=1&seller_email=20718505%40qq.com&seller_id=2088421564177650&subject=111&total_fee=0.01&trade_no=2016101021001004470296721955&trade_status=TRADE_SUCCESS&sign=4d4f0c35e95f4dce7c34c1ff70e321fd&sign_type=MD5 if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS") { //判断该笔订单是否在商户网站中已经做过处理 VWPayOrderEntity payentity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(out_trade_no); if (payentity.Id > 0 && payentity.Status == 0)//未支付完成 { PayAliResultEntity _entity = new PayAliResultEntity(); _entity.Buyeremail = buyer_email; _entity.Buyerid = buyer_id; _entity.CreateTime = DateTime.Now; _entity.HasDeal = 0; _entity.Issuccess = is_success; _entity.Notifytime = notify_time; _entity.Notifytype = notify_type; _entity.Outtradeno = out_trade_no; _entity.Paymenttype = payment_type; _entity.Selleremail = seller_email; _entity.Sellerid = seller_id; _entity.Subject = subject; _entity.Totalfee = total_fee; _entity.Tradeno = trade_no; _entity.Tradestatus = trade_status; LogUtil.Log("订单付款回调成功:", JsonJC.ObjectToJson(_entity)); PayAliResultBLL.Instance.AddPayAliResult(_entity); payentity.PayTime = DateTime.Now; payentity.PayPrice = StringUtils.GetDbDecimal(total_fee); payentity.ExternalCode = trade_no; payentity.Status = 1; //先更新业务网站收款记录 int result = PayOrderBLL.Instance.RecivedPaySuccess(payentity); if (payentity.SysType == (int)SystemType.B2B || payentity.SysType == (int)SystemType.B2BMobile) { VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(payentity.SysOrderCode)); if (_order.Status == (int)OrderStatus.WaitPay) { if (OrderBLL.Instance.PayFinishedForOrder(StringUtils.GetDbLong(payentity.SysOrderCode), payentity.PayPrice) > 0) { ///业务网站状态更新后更新支付总表 EmailSendBLL.Instance.OrderRemind(out_trade_no); LogUtil.Log("订单付款成功,订单号:", out_trade_no.ToString()); } } } return(Redirect("/Pay/PaySuccess")); } else if (payentity.Id > 0 && payentity.Status == 1) { return(Redirect("/Pay/PaySuccess")); } else { return(Redirect("/Pay/PayError")); } //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 } else { Response.Write("trade_status=" + Request.QueryString["trade_status"]); } Response.Write("支付成功<br />"); return(Redirect("/Pay/PayError")); //打印页面 //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { //string out_trade_no = Request.QueryString["out_trade_no"]; //VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(out_trade_no)); //if (_order.Status == (int)OrderStatus.WaitDeal|| _order.Status == (int)OrderStatus.WaitDeliver) //{ // return Redirect("/Pay/PaySuccess"); //} Response.Write("支付验证失败"); } } else { Response.Write("无返回参数"); } return(View()); }
/// <summary> /// 生成真实订单 /// </summary> /// <returns></returns> public string CreateOrder() { ResultObj _result = new ResultObj(); int _resultstatus = (int)CommonStatus.Fail; long _preordercode = FormString.LongIntSafeQ("preordercode"); int _addressid = FormString.IntSafeQ("addressid"); //int _paytype = FormString.IntSafeQ("paytype"); int _systype = FormString.IntSafeQ("systype"); if (_systype == 0) { _systype = (int)SystemType.B2B; } string _remark = FormString.SafeQ("remark"); string acceptername = FormString.SafeQ("acceptername"); int province = FormString.IntSafeQ("province"); int city = FormString.IntSafeQ("city"); string address = FormString.SafeQ("address", 500); string mobilephone = FormString.SafeQ("mobilephone"); int jifen = FormString.IntSafeQ("jifen"); int memcouponid = FormString.IntSafeQ("memcouponid"); int expressid = FormString.IntSafeQ("expressid"); int ordertype = FormString.IntSafeQ("ordertype", -1); if (jifen % 100 != 0) { jifen = jifen / 100 * 100; } if (jifen > 0 && !AssetBLL.Instance.CheckIntegralEnough(memid, jifen)) { jifen = 0; } int billtype = FormString.IntSafeQ("billtype"); OrderBillBasicEntity _billentity = new OrderBillBasicEntity(); _billentity.BillType = billtype; if (billtype == (int)BillType.Normal) { string title = FormString.SafeQ("billtitle", 200); _billentity.CompanyName = title; } else if (billtype == (int)BillType.VAT) { _billentity.BillId = FormString.IntSafeQ("billvatid"); MemBillVATEntity _mementity = MemBillVATBLL.Instance.GetMemBillVAT(memid); //if (_mementity.Status != 1) //{ // resultstatus = (int)CommonStatus.BillVATNoCheck; // _result.Status = resultstatus; // return JsonJC.ObjectToJson(_result); //} _billentity.ReceiverName = FormString.SafeQ("billvatrename"); _billentity.ReceiverPhone = FormString.SafeQ("billvatrephone"); _billentity.ReceiverProvince = FormString.IntSafeQ("billvatreprovince"); _billentity.ReceiverCity = FormString.IntSafeQ("billvatrecity"); _billentity.ReceiverAddress = FormString.SafeQ("billvatreaddress", 300); _billentity.CompanyName = _mementity.CompanyName; _billentity.CompanyPhone = _mementity.CompanyPhone; _billentity.CompanyCode = _mementity.CompanyCode; _billentity.CompanyBank = _mementity.CompanyBank; _billentity.CompanyAddress = _mementity.CompanyAddress; _billentity.BankAccount = _mementity.BankAccount; _billentity.Status = _mementity.Status; } VWOrderEntity _vworder = OrderDetailPreTempBLL.Instance.GetVWOrderByTempCode(_preordercode); if (ordertype != -1) { _vworder.OrderType = ordertype; } _vworder.OrderStyle = (int)OrderStyleEnum.Normal; _vworder.DisCountFee = _vworder.DisCountFee; decimal tempprice = _vworder.PreDisCountPrice - _vworder.DisCountFee; if (tempprice > 1) { decimal jifenamt = OrderCommonBLL.Instance.GetJiFenAmt(jifen); _vworder.Integral = jifen; _vworder.IntegralFee = jifenamt; tempprice = tempprice - jifenamt; } else { _vworder.Integral = 0; _vworder.IntegralFee = 0; } if (memcouponid > 0) { MemCouponsEntity couponen = MemCouponsBLL.Instance.GetCouponByMemCouponId(memid, memcouponid); if (couponen != null && couponen.Id == memcouponid && couponen.EndTime > DateTime.Now) { DicCouponsEntity dicen = couponen.DicCoupons; if (dicen.CouponType == (int)CouponTypeEnum.Money && dicen.MinimumReqAmount < tempprice) { _vworder.MemCouponsId = memcouponid; _vworder.CouponsFee = dicen.CouponValue; tempprice = tempprice - dicen.CouponValue; } } } _vworder.ActPrice = tempprice; //_vworder.PayType = _paytype; _vworder.ExpressCom = expressid; _vworder.Remark = _remark; _vworder.MemId = memid; _vworder.MemLevel = member.MemGrade; _vworder.IsStore = member.IsStore; //if (_paytype == (int)PayType.OutLine) //{ // _vworder.PayConfirmCode = StringUtils.GetRandomString(12); //} //if (billtype == 1) //{ // _vworder.BillType = (int)BillType.Normal; //} //else if (billtype == 2) //{ // _vworder.BillType = (int)BillType.VAT; //} OrderAddressEntity _address = new OrderAddressEntity(); _address.CityId = city; _address.AccepterName = acceptername; _address.ProvinceId = province; _address.Address = address; _address.MobilePhone = mobilephone; //_vworder.AcceptAddress = _address; if (_vworder.ActPrice >= 1) { List <int> listpdids = new List <int>(); string productdetails = ""; if (_vworder != null && _vworder.Details != null && _vworder.Details.Count > 0) { foreach (VWOrderDetailEntity ordetailentity in _vworder.Details) { listpdids.Add(ordetailentity.ProductDetailId); productdetails += "|" + ordetailentity.ProductDetailId.ToString() + "_" + ordetailentity.Num.ToString(); } if (productdetails != "") { productdetails = productdetails.TrimStart('|'); if (ProductStyleBLL.Instance.ProductsEnough(productdetails)) { string ordercode = OrderBLL.Instance.CreateOrder(_vworder, _address, _billentity); if (!string.IsNullOrEmpty(ordercode)) { //IList<OrderDetailEntity> _listproduct = OrderDetailBLL.Instance.GetOrderDetailAllByOrder(memid, StringUtils.GetDbLong(ordercode), false); //foreach (OrderDetailEntity _entity in _listproduct) //{ // productdetails += "|" + _entity.ProductDetailId.ToString() + "_" + _entity.Num.ToString(); //} if (productdetails != "") { if (ProductStyleBLL.Instance.ProductsToOrder(productdetails) > 0) { VWShoppingCartInfo ShoppingCartentity = ShoppingCartProcessor.GetShoppingCart(); ShoppingCartProcessor.RemoveCartItems(ShoppingCartentity, listpdids); //if (_vworder.PayType == (int)PayType.WeChat) //{ _result.Obj = ordercode; //} //else //{ // _result.Obj = ordercode; //} _result.Status = (int)CommonStatus.Success; return(JsonJC.ObjectToJson(_result)); } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } else { _result.Status = (int)CommonStatus.Success; _result.Obj = ordercode; return(JsonJC.ObjectToJson(_result)); } } } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } } } _result.Status = (int)CommonStatus.Fail; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); }