예제 #1
0
        /// <summary>
        /// 收货
        /// </summary>
        /// <returns></returns>
        public ActionResult ReceiveOrder()
        {
            int oid = WebHelper.GetQueryInt("oid");

            OrderInfo orderInfo = Orders.GetOrderByOid(oid);

            if (orderInfo == null || orderInfo.Uid != WorkContext.Uid)
            {
                return(AjaxResult("noorder", "订单不存在"));
            }

            if (orderInfo.OrderState != (int)OrderState.Sended)
            {
                return(AjaxResult("donotreceive", "订单当前不能收货"));
            }

            //收货
            Orders.ReceiveOrder(ref WorkContext.PartUserInfo, orderInfo, DateTime.Now, WorkContext.IP);
            //创建订单处理
            OrderActions.CreateOrderAction(new OrderActionInfo()
            {
                Oid         = oid,
                Uid         = WorkContext.Uid,
                RealName    = "本人",
                AdminGid    = 0,
                AdminGTitle = "非管理员",
                ActionType  = (int)OrderActionType.Receive,
                ActionTime  = DateTime.Now,
                ActionDes   = "您已经收货"
            });
            return(AjaxResult("success", oid.ToString()));
        }
예제 #2
0
        /// <summary>
        /// 取消订单
        /// </summary>
        public ActionResult CancelOrder()
        {
            int oid          = WebHelper.GetFormInt("oid");
            int cancelReason = WebHelper.GetFormInt("cancelReason");

            OrderInfo orderInfo = Orders.GetOrderByOid(oid);

            if (orderInfo == null || orderInfo.Uid != WorkContext.Uid)
            {
                return(AjaxResult("noorder", "订单不存在"));
            }

            if (!(orderInfo.OrderState == (int)OrderState.WaitPaying || (orderInfo.OrderState == (int)OrderState.Confirming && orderInfo.PayMode == 0)))
            {
                return(AjaxResult("donotcancel", "订单当前不能取消"));
            }

            //取消订单
            Orders.CancelOrder(ref WorkContext.PartUserInfo, orderInfo, WorkContext.Uid, DateTime.Now);
            //创建订单处理
            OrderActions.CreateOrderAction(new OrderActionInfo()
            {
                Oid        = oid,
                Uid        = WorkContext.Uid,
                RealName   = "本人",
                ActionType = (int)OrderActionType.Cancel,
                ActionTime = DateTime.Now,
                ActionDes  = "您取消了订单"
            });
            return(AjaxResult("success", oid.ToString()));
        }
예제 #3
0
        /// <summary>
        /// 订单信息
        /// </summary>
        /// <param name="oid">订单id</param>
        /// <returns></returns>
        public ActionResult OrderInfo(int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

            if (orderInfo == null)
            {
                return(PromptView("订单不存在"));
            }
            if (orderInfo.StoreId != WorkContext.StoreId)
            {
                return(PromptView("不能操作其它店铺的订单"));
            }

            OrderInfoModel model = new OrderInfoModel();

            model.OrderInfo        = orderInfo;
            model.RegionInfo       = Regions.GetRegionById(orderInfo.RegionId);
            model.UserInfo         = Users.GetUserById(orderInfo.Uid);
            model.UserRankInfo     = AdminUserRanks.GetUserRankById(model.UserInfo.UserRid);
            model.OrderProductList = AdminOrders.GetOrderProductList(oid);
            model.OrderActionList  = OrderActions.GetOrderActionList(oid);

            string[] sizeList = StringHelper.SplitString(WorkContext.MallConfig.ProductShowThumbSize);

            ViewData["size"]    = sizeList[sizeList.Length / 2];
            ViewData["referer"] = MallUtils.GetStoreAdminRefererCookie();
            return(View(model));
        }
예제 #4
0
        /// <summary>
        /// 订单信息
        /// </summary>
        /// <param name="oid">订单id</param>
        /// <returns></returns>
        public ActionResult OrderInfo(int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

            if (orderInfo == null)
            {
                return(PromptView("订单不存在"));
            }
            if (orderInfo.StoreId != WorkContext.StoreId)
            {
                return(PromptView("不能操作其它店铺的订单"));
            }

            OrderInfoModel model = new OrderInfoModel();

            model.OrderInfo        = orderInfo;
            model.RegionInfo       = Regions.GetRegionById(orderInfo.RegionId);
            model.UserInfo         = Users.GetUserById(orderInfo.Uid);
            model.UserRankInfo     = AdminUserRanks.GetUserRankById(model.UserInfo.UserRid);
            model.OrderProductList = AdminOrders.GetOrderProductList(oid);
            model.OrderActionList  = OrderActions.GetOrderActionList(oid);

            ViewData["referer"] = MallUtils.GetStoreAdminRefererCookie();
            return(View(model));
        }
예제 #5
0
        public ActionResult Index()
        {
            //var orderId = 2;
            //var order = new Order();
            List <Order> orders = new List <Order>();

            using (var orderActions = new OrderActions())
            {
                //order = orderActions.GetOrder(orderId);
                orders = orderActions.GetCompletedOrders();
            }

            var vm = new Models.HomeModel
            {
                DisplayName = base.DisplayName,
                Orders      = orders
            };

            if (Request.IsAuthenticated)
            {
                var user = User.Identity.Name;
            }

            return(View(vm));
        }
예제 #6
0
 private ChargeBeeApi()
 {
     Addon               = new AddonActions(this);
     Address             = new AddressActions(this);
     Card                = new CardActions(this);
     Comment             = new CommentActions(this);
     Coupon              = new CouponActions(this);
     CouponCode          = new CouponCodeActions(this);
     CreditNote          = new CreditNoteActions(this);
     Customer            = new CustomerActions(this);
     Estimate            = new EstimateActions(this);
     Event               = new EventActions(this);
     HostedPage          = new HostedPageActions(this);
     Invoice             = new InvoiceActions(this);
     Order               = new OrderActions(this);
     PaymentSource       = new PaymentSourceActions(this);
     Plan                = new PlanActions(this);
     PortalSession       = new PortalSessionActions(this);
     ResourceMigration   = new ResourceMigrationActions(this);
     SiteMigrationDetail = new SiteMigrationDetailActions(this);
     Subscription        = new SubscriptionActions(this);
     TimeMachine         = new TimeMachineActions(this);
     Transaction         = new TransactionActions(this);
     UnbilledCharge      = new UnbilledChargeActions(this);
 }
예제 #7
0
        /// <summary>
        /// 执行事件
        /// </summary>
        /// <param name="eventInfo">事件信息</param>
        public void Execute(object eventInfo)
        {
            EventInfo e = (EventInfo)eventInfo;

            //同步商品销量
            DateTime lastExecuteTime = EventLogs.GetEventLastExecuteTimeByKey(e.Key);

            if (lastExecuteTime.Date < DateTime.Now.Date)
            {
                DateTime  startTime = lastExecuteTime.Date;
                DateTime  endTime   = DateTime.Now.Date;
                DataTable dt        = OrderActions.GetOrderIdList(startTime, endTime, (int)OrderActionType.Complete);
                foreach (DataRow row in dt.Rows)
                {
                    int oid = TypeHelper.ObjectToInt(row["oid"]);
                    List <OrderProductInfo> orderProductList = Orders.GetOrderProductList(oid);
                    foreach (OrderProductInfo orderProductInfo in orderProductList)
                    {
                        Products.AddProductShadowSaleCount(orderProductInfo.Pid, orderProductInfo.RealCount);
                    }
                }
            }

            EventLogs.CreateEventLog(e.Key, e.Title, Environment.MachineName, DateTime.Now);
        }
예제 #8
0
        public IQueryable <OrderDetail> UpdateOrderDetail(int OrderId)
        {
            //String cartId = usersShoppingCart.GetCartId();
            using (OrderActions MyOrderActions = new OrderActions())
            {
                OrderActions.OrederDetailUpdates[] ODUpdates = new OrderActions.OrederDetailUpdates[OrderDetailList.Rows.Count];
                for (int i = 0; i < OrderDetailList.Rows.Count; i++)
                {
                    IOrderedDictionary rowValues = new OrderedDictionary();
                    rowValues = GetValues(OrderDetailList.Rows[i]);
                    ODUpdates[i].ProductId = Convert.ToInt32(rowValues["ProductId"]);

                    TextBox QtyShippedTextBox = new TextBox();
                    QtyShippedTextBox       = (TextBox)OrderDetailList.Rows[i].FindControl("QtyShippedBx");
                    ODUpdates[i].QtyShipped = Convert.ToInt16(QtyShippedTextBox.Text.ToString());

                    TextBox QtyCancelledTextBox = new TextBox();
                    QtyCancelledTextBox       = (TextBox)OrderDetailList.Rows[i].FindControl("QtyCancelledBx");
                    ODUpdates[i].QtyCancelled = Convert.ToInt16(QtyCancelledTextBox.Text.ToString());

                    TextBox CommentBox = new TextBox();
                    CommentBox           = (TextBox)OrderDetailList.Rows[i].FindControl("CommentBx");
                    ODUpdates[i].Comment = CommentBox.Text.ToString();
                }

                MyOrderActions.UpdateOrderDetailDatabase(OrderId, ODUpdates);
                OrderDetailList.DataBind();
                return(MyOrderActions.GetOrderDetailsItems(OrderId));
            }
        }
예제 #9
0
        /// <summary>
        /// 返回调用
        /// </summary>
        public ActionResult Return()
        {
            PluginSetInfo pluginSetInfo = PluginUtils.GetPluginSet();

            // 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
            // 登陆后在上面的导航栏里可能找到“B2C”,在二级导航栏里有“MD5密钥设置”
            // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了
            string key = pluginSetInfo.Key;

            int     v_oid       = WebHelper.GetRequestInt("v_oid");
            string  v_pstatus   = WebHelper.GetRequestString("v_pstatus");
            string  v_pstring   = WebHelper.GetRequestString("v_pstring");
            string  v_pmode     = WebHelper.GetRequestString("v_pmode");
            string  v_md5str    = WebHelper.GetRequestString("v_md5str");
            decimal v_amount    = TypeHelper.StringToDecimal(WebHelper.GetRequestString("v_amount"));
            string  v_moneytype = WebHelper.GetRequestString("v_moneytype");
            string  remark1     = WebHelper.GetRequestString("remark1");
            string  remark2     = WebHelper.GetRequestString("remark2");

            string str = v_oid + v_pstatus + v_amount + v_moneytype + key;

            str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "md5").ToUpper();

            if (str == v_md5str)
            {
                if (v_pstatus.Equals("20"))
                {
                    //支付成功
                    OrderInfo orderInfo = Orders.GetOrderByOid(v_oid);
                    if (orderInfo != null && orderInfo.PayMode == 1 && orderInfo.PaySN.Length == 0 && orderInfo.SurplusMoney > 0 && orderInfo.SurplusMoney <= v_amount)
                    {
                        Orders.PayOrder(v_oid, OrderState.Confirming, "", DateTime.Now);
                        OrderActions.CreateOrderAction(new OrderActionInfo()
                        {
                            Oid         = v_oid,
                            Uid         = orderInfo.Uid,
                            RealName    = "本人",
                            AdminGid    = 1,
                            AdminGTitle = "非管理员",
                            ActionType  = (int)OrderActionType.Pay,
                            ActionTime  = DateTime.Now,
                            ActionDes   = "你使用网银在线支付订单成功,支付银行为:" + v_pmode
                        });
                    }

                    return(RedirectToAction("payresult", "order", new RouteValueDictionary {
                        { "oid", orderInfo.Oid }
                    }));
                }
                else
                {
                    return(Content("支付失败"));
                }
            }
            else
            {
                return(Content("校验失败,数据可疑"));
            }
        }
예제 #10
0
		public OrderCommand(Order order, OrderActions action)
		{
			if (order == null)
				throw new ArgumentNullException(nameof(order));

			Order = order;
			Action = action;
		}
예제 #11
0
		public OrderFailCommand(OrderFail fail, OrderActions action)
		{
			if (fail == null)
				throw new ArgumentNullException("fail");

			Fail = fail;
			Action = action;
		}
예제 #12
0
        /// <summary>
        /// 通知调用
        /// </summary>
        public ActionResult Notify()
        {
            SortedDictionary <string, string> paras = AlipayCore.GetRequestPost();

            if (paras.Count > 0)//判断是否有带返回参数
            {
                bool verifyResult = AlipayNotify.Verify(paras, Request.Form["notify_id"], Request.Form["sign"], AlipayConfig.SignType, AlipayConfig.Key, AlipayConfig.Code, AlipayConfig.VeryfyUrl, AlipayConfig.Partner);
                if (verifyResult && (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS")) //验证成功
                {
                    string   out_trade_no = Request.Form["out_trade_no"];                                                                  //商户订单号
                    string   tradeSN      = Request.Form["trade_no"];                                                                      //支付宝交易号
                    decimal  tradeMoney   = TypeHelper.StringToDecimal(Request.Form["total_fee"]);                                         //交易金额
                    DateTime tradeTime    = TypeHelper.StringToDateTime(Request.Form["gmt_payment"]);                                      //交易时间

                    List <OrderInfo> orderList = new List <OrderInfo>();
                    foreach (string oid in StringHelper.SplitString(StringHelper.SubString(out_trade_no, out_trade_no.Length - 10)))
                    {
                        OrderInfo orderInfo = Orders.GetOrderByOid(TypeHelper.StringToInt(oid));
                        orderList.Add(orderInfo);
                    }
                    decimal allSurplusMoney = 0M;
                    foreach (OrderInfo orderInfo in orderList)
                    {
                        allSurplusMoney += orderInfo.SurplusMoney;
                    }

                    if (orderList.Count > 0 && allSurplusMoney <= tradeMoney)
                    {
                        foreach (OrderInfo orderInfo in orderList)
                        {
                            if (orderInfo.SurplusMoney > 0 && orderInfo.OrderState == (int)OrderState.WaitPaying)
                            {
                                Orders.PayOrder(orderInfo.Oid, OrderState.Confirming, tradeSN, DateTime.Now);
                                OrderActions.CreateOrderAction(new OrderActionInfo()
                                {
                                    Oid        = orderInfo.Oid,
                                    Uid        = orderInfo.Uid,
                                    RealName   = "本人",
                                    ActionType = (int)OrderActionType.Pay,
                                    ActionTime = tradeTime,
                                    ActionDes  = "你使用支付宝支付订单成功,支付宝交易号为:" + tradeSN
                                });
                            }
                        }
                    }

                    return(Content("success"));
                }
                else//验证失败
                {
                    return(Content("fail"));
                }
            }
            else
            {
                return(Content("无通知参数"));
            }
        }
예제 #13
0
        /// <summary>
        /// 检查订单状态是否允许当前操作
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="action">操作</param>
        /// <returns>是否允许</returns>
        public static bool CheckAction <T>(T order, OrderActions action) where T : IOrderInfo
        {
            if (order.OrderStatus == OrderStatus.InProgress)
            {
                switch (action)
                {
                case OrderActions.BUYER_PAY:
                case OrderActions.BUYER_MODIFY_DELIVER_ADDRESS:
                case OrderActions.BUYER_MODIFY_PAYMENT_MODE:
                case OrderActions.BUYER_MODIFY_SHIPPING_MODE:
                case OrderActions.BUYER_CANCEL:
                case OrderActions.SELLER_CONFIRM_PAY:
                case OrderActions.SELLER_CLOSE_TRADE:
                case OrderActions.SELLER_MODIFY_TRADE:
                    return(order.PaymentStatus == PaymentStatus.NotYet);

                case OrderActions.BUYER_REFUND:
                    if (order.PaymentStatus != PaymentStatus.Prepaid)
                    {
                        return(false);
                    }
                    return(order.RefundStatus == RefundStatus.None);

                case OrderActions.BUYER_CANCEL_REFUND:
                case OrderActions.SELLER_REJECT_REFUND:
                case OrderActions.SELLER_ACCEPT_REFUND:
                    if (order.PaymentStatus != PaymentStatus.Prepaid)
                    {
                        return(false);
                    }
                    return(order.RefundStatus == RefundStatus.Requested);

                case OrderActions.BUYER_CONFIRM_GOODS:
                case OrderActions.SELLER_FINISH_TRADE:
                    if (order.ShippingStatus != ShippingStatus.Delivered)
                    {
                        return(false);
                    }
                    return(order.RefundStatus == RefundStatus.None);

                case OrderActions.SELLER_SEND_GOODS:
                    if (order.RefundStatus != RefundStatus.None)
                    {
                        return(false);
                    }
                    return((order.ShippingStatus == ShippingStatus.NotYet) || (order.ShippingStatus == ShippingStatus.Packing));

                case OrderActions.SELLER_PACK_GOODS:
                    if (order.RefundStatus != RefundStatus.None)
                    {
                        return(false);
                    }
                    return(order.ShippingStatus == ShippingStatus.NotYet);
                }
            }
            return(false);
        }
예제 #14
0
        public OrderCommand(Order order, OrderActions action)
        {
            if (order == null)
            {
                throw new ArgumentNullException("order");
            }

            Order  = order;
            Action = action;
        }
예제 #15
0
        public OrderFailCommand(OrderFail fail, OrderActions action)
        {
            if (fail == null)
            {
                throw new ArgumentNullException("fail");
            }

            Fail   = fail;
            Action = action;
        }
예제 #16
0
        /// <summary>
        /// 返回调用
        /// </summary>
        public ActionResult Return()
        {
            System.Web.HttpContext Context = System.Web.HttpContext.Current;

            //创建ResponseHandler实例
            ResponseHandler resHandler = new ResponseHandler(Context);

            resHandler.setKey(TenpayUtil.tenpay_key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                //支付结果
                string trade_state = resHandler.getParameter("trade_state");
                //交易模式,1即时到账,2中介担保
                string trade_mode = resHandler.getParameter("trade_mode");

                if ("1".Equals(trade_mode) && "0".Equals(trade_state))
                {
                    int      oid        = TypeHelper.StringToInt(resHandler.getParameter("out_trade_no"));        //商户订单号
                    string   tradeSN    = resHandler.getParameter("transaction_id");                              //财付通订单号
                    decimal  tradeMoney = TypeHelper.StringToDecimal(resHandler.getParameter("total_fee")) / 100; //金额,以分为单位
                    DateTime tradeTime  = DateTime.Now;                                                           //交易时间

                    OrderInfo orderInfo = Orders.GetOrderByOid(oid);
                    if (orderInfo != null && orderInfo.PayMode == 1 && orderInfo.PaySN.Length == 0 && orderInfo.SurplusMoney > 0 && orderInfo.SurplusMoney <= tradeMoney)
                    {
                        Orders.PayOrder(oid, OrderState.Confirming, tradeSN, DateTime.Now);
                        OrderActions.CreateOrderAction(new OrderActionInfo()
                        {
                            Oid         = oid,
                            Uid         = orderInfo.Uid,
                            RealName    = "本人",
                            AdminGid    = 1,
                            AdminGTitle = "非管理员",
                            ActionType  = (int)OrderActionType.Pay,
                            ActionTime  = tradeTime,
                            ActionDes   = "你使用财付通支付订单成功,财付通交易号为:" + tradeSN
                        });
                    }

                    return(RedirectToAction("payresult", "order", new RouteValueDictionary {
                        { "oid", orderInfo.Oid }
                    }));
                }
                else
                {
                    return(Content("财付通支付失败"));
                }
            }
            else
            {
                return(Content("认证签名失败"));
            }
        }
예제 #17
0
        public void PlaceLimitOrder(OrderActions action, double quantity, int tickType)
        {
            double?price = GetTick(tickType);

            if (!price.HasValue)
            {
                return;
            }

            PlaceLimitOrder(action, quantity, price.Value);
        }
예제 #18
0
        public bool CheckAction(OrderActions action)
        {
            bool result;

            if (this.OrderStatus == OrderStatus.Finished || this.OrderStatus == OrderStatus.Closed)
            {
                result = false;
            }
            else
            {
                switch (action)
                {
                case OrderActions.BUYER_PAY:
                case OrderActions.SUBSITE_SELLER_MODIFY_DELIVER_ADDRESS:
                case OrderActions.SUBSITE_SELLER_MODIFY_PAYMENT_MODE:
                case OrderActions.SUBSITE_SELLER_MODIFY_SHIPPING_MODE:
                case OrderActions.SELLER_CONFIRM_PAY:
                case OrderActions.SELLER_MODIFY_TRADE:
                case OrderActions.SELLER_CLOSE:
                case OrderActions.SUBSITE_SELLER_MODIFY_GIFTS:
                    result = (this.OrderStatus == OrderStatus.WaitBuyerPay);
                    break;

                case OrderActions.BUYER_CONFIRM_GOODS:
                case OrderActions.SELLER_FINISH_TRADE:
                    result = (this.OrderStatus == OrderStatus.SellerAlreadySent);
                    break;

                case OrderActions.SELLER_SEND_GOODS:
                    result = (this.OrderStatus == OrderStatus.BuyerAlreadyPaid || (this.OrderStatus == OrderStatus.WaitBuyerPay && this.Gateway == "hishop.plugins.payment.podrequest"));
                    break;

                case OrderActions.SELLER_REJECT_REFUND:
                    result = (this.OrderStatus == OrderStatus.BuyerAlreadyPaid || this.OrderStatus == OrderStatus.SellerAlreadySent);
                    break;

                case OrderActions.MASTER_SELLER_MODIFY_DELIVER_ADDRESS:
                case OrderActions.MASTER_SELLER_MODIFY_PAYMENT_MODE:
                case OrderActions.MASTER_SELLER_MODIFY_SHIPPING_MODE:
                case OrderActions.MASTER_SELLER_MODIFY_GIFTS:
                    result = (this.OrderStatus == OrderStatus.WaitBuyerPay || this.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                    break;

                case OrderActions.SUBSITE_CREATE_PURCHASEORDER:
                    result = (this.GroupBuyId > 0 && this.GroupBuyStatus == GroupBuyStatus.Success && this.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                    break;

                default:
                    result = false;
                    break;
                }
            }
            return(result);
        }
예제 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="OrderId"></param>
        /// <returns></returns>


        public IQueryable <OrderDetail> OpenOrderList_GetData([FriendlyUrlSegmentsAttribute(0)] int?OrderId)
        {
            if (OrderId != null)
            {
                OrderActions actions = new OrderActions();
                return(actions.GetOrderItems(OrderId));
            }
            else
            {
                return(null);
            }
        }
예제 #20
0
 /// <summary>
 /// 创建订单行为
 /// </summary>
 private void CreateOrderAction(int oid, OrderActionType orderActionType, string actionDes)
 {
     OrderActions.CreateOrderAction(new OrderActionInfo()
     {
         Oid        = oid,
         Uid        = WorkContext.Uid,
         RealName   = AdminUsers.GetUserDetailById(WorkContext.Uid).RealName,
         ActionType = (int)orderActionType,
         ActionTime = DateTime.Now,
         ActionDes  = actionDes
     });
 }
예제 #21
0
        public void PlaceLimitOrder(OrderActions action, double quantity, double price)
        {
            if (tickerContract == null || price <= 0)
            {
                return;
            }

            Order order = OrderFactory.CreateLimitOrder(action, quantity, price);

            order.Account = TradedAccount;
            clientSocket.placeOrder(nextValidOrderId++, tickerContract, order);
        }
예제 #22
0
        /// <summary>
        /// 返回调用
        /// </summary>
        public ActionResult Return()
        {
            SortedDictionary <string, string> paras = AlipayCore.GetRequestGet();

            if (paras.Count > 0)//判断是否有带返回参数
            {
                bool verifyResult = AlipayNotify.Verify(paras, Request.QueryString["notify_id"], Request.QueryString["sign"], AlipayConfig.SignType, AlipayConfig.Key, AlipayConfig.Code, AlipayConfig.VeryfyUrl, AlipayConfig.Partner);
                if (verifyResult && (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")) //验证成功
                {
                    string   out_trade_no = Request.QueryString["out_trade_no"];                                                                         //商户订单号
                    string   tradeSN      = Request.QueryString["trade_no"];                                                                             //支付宝交易号
                    decimal  tradeMoney   = TypeHelper.StringToDecimal(Request.QueryString["total_fee"]);                                                //交易金额
                    DateTime tradeTime    = TypeHelper.StringToDateTime(Request.QueryString["notify_time"]);                                             //交易时间

                    int       oid       = TypeHelper.StringToInt(StringHelper.SubString(out_trade_no, out_trade_no.Length - 10));
                    OrderInfo orderInfo = Orders.GetOrderByOid(oid);
                    if (orderInfo != null && orderInfo.PayMode == 1 && orderInfo.PaySN.Length == 0 && orderInfo.SurplusMoney > 0 && orderInfo.SurplusMoney <= tradeMoney)
                    {
                        Orders.PayOrder(oid, OrderState.Confirming, tradeSN, "alipay", "支付宝", DateTime.Now);
                        OrderActions.CreateOrderAction(new OrderActionInfo()
                        {
                            Oid         = oid,
                            Uid         = orderInfo.Uid,
                            RealName    = "本人",
                            AdminGid    = 1,
                            AdminGTitle = "非管理员",
                            ActionType  = (int)OrderActionType.Pay,
                            ActionTime  = tradeTime,
                            ActionDes   = "你使用支付宝支付订单成功,支付宝交易号为:" + tradeSN
                        });

                        //邮件通知客户
                        if (!string.IsNullOrWhiteSpace(orderInfo.Email))
                        {
                            Emails.SendOrderPayEmail(orderInfo.Email, "支付宝", tradeMoney.ToString(), orderInfo.OSN);
                        }
                    }

                    return(RedirectToAction("payresult", "order", new RouteValueDictionary {
                        { "oid", oid }
                    }));
                }
                else//验证失败
                {
                    return(Content("支付失败"));
                }
            }
            else
            {
                return(Content("支付失败"));
            }
        }
예제 #23
0
 public static Order CreateLimitOrder(OrderActions action, double quantity, double limitPrice)
 {
     return(new Order()
     {
         Action = action.ToString(),
         TotalQuantity = quantity,
         LmtPrice = limitPrice,
         OrderType = OrderTypes.LMT.ToString(),
         Tif = TimeInForce.GTC.ToString(),
         Transmit = true,
         OutsideRth = true
     });
 }
예제 #24
0
    public T GetOrderAction <T>() where T : OrderAction
    {
        OrderAction orderAction;

        if (OrderActions.TryGetValue(typeof(T).Name, out orderAction))
        {
            return((T)orderAction);
        }
        else
        {
            return(null);
        }
    }
예제 #25
0
        /// <summary>
        /// 通知调用
        /// </summary>
        public ActionResult Notify()
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

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

                if (verifyResult)                                                                                                              //验证成功
                {
                    if (verifyResult && (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS")) //验证成功
                    {
                        string   out_trade_no = Request.Form["out_trade_no"];                                                                  //商户订单号
                        string   tradeSN      = Request.Form["trade_no"];                                                                      //支付宝交易号
                        decimal  tradeMoney   = TypeHelper.StringToDecimal(Request.Form["total_fee"]);                                         //交易金额
                        DateTime tradeTime    = TypeHelper.StringToDateTime(Request.Form["gmt_payment"]);                                      //交易时间

                        int       oid       = TypeHelper.StringToInt(StringHelper.SubString(out_trade_no, out_trade_no.Length - 10));
                        OrderInfo orderInfo = Orders.GetOrderByOid(oid);
                        if (orderInfo != null && orderInfo.PayMode == 1 && orderInfo.PaySN.Length == 0 && orderInfo.SurplusMoney > 0 && orderInfo.SurplusMoney <= tradeMoney)
                        {
                            Orders.PayOrder(orderInfo.Oid, OrderState.Confirming, tradeSN, "alipay", "支付宝", DateTime.Now);
                            OrderActions.CreateOrderAction(new OrderActionInfo()
                            {
                                Oid        = orderInfo.Oid,
                                Uid        = orderInfo.Uid,
                                RealName   = "本人",
                                ActionType = (int)OrderActionType.Pay,
                                ActionTime = tradeTime,
                                ActionDes  = "你使用支付宝支付订单成功,支付宝交易号为:" + tradeSN
                            });
                        }

                        return(Content("success"));
                    }
                    else//验证失败
                    {
                        return(Content("fail"));
                    }
                }
                else
                {
                    return(Content("fail"));
                }
            }
            else
            {
                return(Content("无通知参数"));
            }
        }
예제 #26
0
        public bool CheckAction(OrderActions action)
        {
            if ((this.OrderStatus != Hidistro.Entities.Orders.OrderStatus.Finished) && (this.OrderStatus != Hidistro.Entities.Orders.OrderStatus.Closed))
            {
                switch (action)
                {
                case OrderActions.BUYER_PAY:
                case OrderActions.SUBSITE_SELLER_MODIFY_DELIVER_ADDRESS:
                case OrderActions.SUBSITE_SELLER_MODIFY_PAYMENT_MODE:
                case OrderActions.SUBSITE_SELLER_MODIFY_SHIPPING_MODE:
                case OrderActions.SELLER_CONFIRM_PAY:
                case OrderActions.SELLER_MODIFY_TRADE:
                case OrderActions.SELLER_CLOSE:
                case OrderActions.SUBSITE_SELLER_MODIFY_GIFTS:
                    return(this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.WaitBuyerPay);

                case OrderActions.BUYER_CONFIRM_GOODS:
                case OrderActions.SELLER_FINISH_TRADE:
                    return(this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.SellerAlreadySent);

                case OrderActions.SELLER_SEND_GOODS:
                    if (this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.BuyerAlreadyPaid)
                    {
                        return(true);
                    }
                    if (this.OrderStatus != Hidistro.Entities.Orders.OrderStatus.WaitBuyerPay)
                    {
                        return(false);
                    }
                    return(this.Gateway == "hishop.plugins.payment.podrequest");

                case OrderActions.SELLER_REJECT_REFUND:
                    return((this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.BuyerAlreadyPaid) || (this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.SellerAlreadySent));

                case OrderActions.MASTER_SELLER_MODIFY_DELIVER_ADDRESS:
                case OrderActions.MASTER_SELLER_MODIFY_PAYMENT_MODE:
                case OrderActions.MASTER_SELLER_MODIFY_SHIPPING_MODE:
                case OrderActions.MASTER_SELLER_MODIFY_GIFTS:
                    return((this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.WaitBuyerPay) || (this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.BuyerAlreadyPaid));

                case OrderActions.SUBSITE_CREATE_PURCHASEORDER:
                    if ((this.GroupBuyId <= 0) || (this.GroupBuyStatus != Hidistro.Entities.Promotions.GroupBuyStatus.Success))
                    {
                        return(false);
                    }
                    return(this.OrderStatus == Hidistro.Entities.Orders.OrderStatus.BuyerAlreadyPaid);
                }
            }
            return(false);
        }
예제 #27
0
        public ActionResult Details(int Id)
        {
            var order        = new Order();
            var orderActions = new OrderActions(_db);

            order = orderActions.GetOrder(Id);

            var vm = new Models.DetailsModel
            {
                DisplayName = base.DisplayName,
                Order       = order
            };

            return(View(vm));
        }
        public ManagerMainMenu(StoreAppContext context, IManagerRepoActions managerRepoActions, ILocationRepoActions locationRepoActions, IInventoryRepoActions inventoryRepoActions, IOrderRepoActions orderRepoActions, IBaseballBatRepoActions batRepoActions, Location location)
        {
            this.context              = context;
            this.managerRepoActions   = managerRepoActions;
            this.inventoryRepoActions = inventoryRepoActions;
            this.orderRepoActions     = orderRepoActions;
            this.batRepoActions       = batRepoActions;

            this.managerActions   = new ManagerActions(context, managerRepoActions);
            this.inventoryActions = new InventoryActions(context, inventoryRepoActions);
            this.orderActions     = new OrderActions(context, orderRepoActions);
            this.batActions       = new BaseballBatActions(context, batRepoActions);

            this.location = location;
        }
예제 #29
0
        public ActionResult Details(int Id)
        {
            var order = new Order();

            using (var orderActions = new OrderActions(orders.ToList()))
            {
                order = orderActions.GetOrder(Id);
            }

            var vm = new Models.DetailsModel
            {
                DisplayName = base.DisplayName,
                Order       = order
            };

            return(View(vm));
        }
예제 #30
0
        /// <summary>
        /// 订单动作列表
        /// </summary>
        public ActionResult OrderActionList()
        {
            int       oid       = WebHelper.GetQueryInt("oid");
            OrderInfo orderInfo = Orders.GetOrderByOid(oid);

            if (orderInfo == null || orderInfo.Uid != WorkContext.Uid)
            {
                return(PromptView("订单不存在"));
            }

            OrderActionListModel model = new OrderActionListModel();

            model.OrderInfo       = orderInfo;
            model.OrderActionList = OrderActions.GetOrderActionList(oid);

            return(View(model));
        }
예제 #31
0
        public CustomerMainMenu(StoreAppContext context, ICustomerRepoActions customerRepoActions, ILocationRepoActions locationRepoActions, IOrderRepoActions orderRepoActions, IInventoryRepoActions inventoryRepoActions, IBaseballBatRepoActions batRepoActions, Customer signedInCustomer, Location location)
        {
            this.context = context;

            this.customerActions  = new CustomerActions(context, customerRepoActions);
            this.locationActions  = new LocationActions(context, locationRepoActions);
            this.inventoryActions = new InventoryActions(context, inventoryRepoActions);
            this.orderActions     = new OrderActions(context, orderRepoActions);
            this.batActions       = new BaseballBatActions(context, batRepoActions);

            this.customerRepoActions  = customerRepoActions;
            this.locationRepoActions  = locationRepoActions;
            this.orderRepoActions     = orderRepoActions;
            this.inventoryRepoActions = inventoryRepoActions;
            this.batRepoActions       = batRepoActions;

            this.currLocation     = location;
            this.signedInCustomer = signedInCustomer;
        }
예제 #32
0
        private async Task RunAsync(CancellationToken cancellationToken)
        {
            // Generate a new PDF-based receipt, save it to Azure Blob storage, and update
            // the customer's order record with the path to the PDF.
            while (!cancellationToken.IsCancellationRequested)
            {
                Trace.TraceInformation("Checking Order Status");

                // Grab order id from the Azure Queue.
                var azureStorageMethods = new AzureStorageMethods();
                int orderId             = await azureStorageMethods.GetOrderIdFromQueue();

                if (orderId > 0)
                {
                    // We have received a new Order Id in the queue, requesting a generated Pdf receipt.
                    var order = new Order();
                    using (var orderActions = new OrderActions())
                    {
                        order = orderActions.GetOrder(orderId);

                        if (order != null && order.OrderId > 0)
                        {
                            var orderVm = DataMethods.MapOrderToViewModel(order);

                            var fileName = string.Format("ContosoSportsLeague-Store-Receipt-{0}.pdf", order.OrderId);
                            var receipt  = new GenerateReceiptPDF().CreatePdfReport(orderVm, fileName);
                            Trace.TraceInformation("PDF generated. Saving to blob storage...");
                            var receiptUri = azureStorageMethods.UploadPdfToBlob(receipt, fileName);

                            // Update the generated receipt Uri on the order:
                            orderActions.UpdateReceiptUri(order.OrderId, receiptUri);
                        }
                        else
                        {
                            // We couldn't find the order for the passed in Order Id. We should log this somewhere.
                            Trace.TraceError("Could not find the order record based off of the passed in Id: " + orderId.ToString() + ". Receipt PDF not generated.");
                        }
                    }
                }
                Trace.TraceInformation("Pausing for 5 seconds before next check.");
                System.Threading.Thread.Sleep(5000);
            }
        }
예제 #33
0
		private void RaiseOrderCommand(Order order, OrderActions action)
		{
			new OrderCommand(order, action).Process(this);
		}
예제 #34
0
파일: OrderInfo.cs 프로젝트: davinx/himedi
        public bool CheckAction(OrderActions action)
        {
            if ((this.OrderStatus != Hidistro.Entities.Sales.OrderStatus.Finished) && (this.OrderStatus != Hidistro.Entities.Sales.OrderStatus.Closed))
            {
                switch (action)
                {
                    case OrderActions.BUYER_PAY:
                    case OrderActions.SUBSITE_SELLER_MODIFY_DELIVER_ADDRESS:
                    case OrderActions.SUBSITE_SELLER_MODIFY_PAYMENT_MODE:
                    case OrderActions.SUBSITE_SELLER_MODIFY_SHIPPING_MODE:
                    case OrderActions.SELLER_CONFIRM_PAY:
                    case OrderActions.SELLER_MODIFY_TRADE:
                    case OrderActions.SELLER_CLOSE:
                    case OrderActions.SUBSITE_SELLER_MODIFY_GIFTS:
                        return (this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.WaitBuyerPay);

                    case OrderActions.BUYER_CONFIRM_GOODS:
                    case OrderActions.SELLER_FINISH_TRADE:
                        return (this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.SellerAlreadySent);

                    case OrderActions.SELLER_SEND_GOODS:
                        return (this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.BuyerAlreadyPaid);

                    case OrderActions.SELLER_REJECT_REFUND:
                        return ((this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.BuyerAlreadyPaid) || (this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.SellerAlreadySent));

                    case OrderActions.MASTER_SELLER_MODIFY_DELIVER_ADDRESS:
                    case OrderActions.MASTER_SELLER_MODIFY_PAYMENT_MODE:
                    case OrderActions.MASTER_SELLER_MODIFY_SHIPPING_MODE:
                    case OrderActions.MASTER_SELLER_MODIFY_GIFTS:
                        return ((this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.WaitBuyerPay) || (this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.BuyerAlreadyPaid));

                    case OrderActions.SUBSITE_CREATE_PURCHASEORDER:
                        return (((this.GroupBuyId > 0) && (this.GroupBuyStatus == Hidistro.Entities.Promotions.GroupBuyStatus.Success)) && (this.OrderStatus == Hidistro.Entities.Sales.OrderStatus.BuyerAlreadyPaid));
                }
            }
            return false;
        }