Example #1
0
        /// <summary>
        /// 审核通过客户订单
        /// </summary>
        /// <param name="id"></param>
        /// <param name="agentID"></param>
        /// <returns></returns>
        public JsonResult PayOrderAndAuthorizeClient(string id)
        {
            //订单支付及后台客户授权
            ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);

            if (order.Status == 0)
            {
                bool flag = ClientOrderBusiness.PayOrderAndAuthorizeClient(id, CurrentUser.UserID, -1, EnumOrderPayType.Cash);
                JsonDictionary.Add("Result", flag ? 1 : 0);

                if (flag)
                {
                    ClientBusiness.UpdateClientCache(order.ClientID);
                    ClearClientCache(order.ClientID);
                }
            }
            else
            {
                JsonDictionary.Add("Result", order.Status == 1 ? 1001 : 1002);
            }
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #2
0
        public ActionResult GoAlipayPay(string id)
        {
            string url = string.Empty;

            if (Session["ClientManager"] == null)
            {
                return(Redirect("/Home/Login"));
            }
            else
            {
                ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);
                if (order != null && !string.IsNullOrEmpty(order.OrderID))
                {
                    //订单未支付
                    if (order.Status == 0)
                    {
                        url = ToPayOrderUrl(order.UserQuantity, order.Years, order.OrderID, order.RealAmount.ToString(), 1);

                        return(Redirect(url));
                    }
                }
            }

            return(View());
        }
Example #3
0
        public JsonResult GetClientOrderDetail(string orderid)
        {
            var item = ClientOrderBusiness.GetClientOrderInfo(orderid);

            JsonDictionary.Add("Item", item);
            JsonDictionary.Add("Result", 1);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #4
0
        public JsonResult GetOrderInfo(string id)
        {
            int result = 0;

            if (!string.IsNullOrEmpty(id))
            {
                ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);
                if (order != null && !string.IsNullOrEmpty(order.OrderID))
                {
                    //订单已支付
                    if (order.Status == 0)
                    {
                        result = -2;
                    }
                    else
                    {
                        result = 1;
                        JsonDictionary.Add("type", order.Type);
                        JsonDictionary.Add("nowUserCount", CurrentClient.UserQuantity);
                        JsonDictionary.Add("nowEndTime", CurrentClient.EndTime.ToString("yyyy-MM-dd"));

                        if (order.Type == 1 || order.Type == 3)
                        {
                            JsonDictionary.Add("preUserCount", 0);
                            JsonDictionary.Add("preEndTime", CurrentClient.EndTime.AddYears(-order.Years).ToString("yyyy-MM-dd"));
                        }
                        else if (order.Type == 2)
                        {
                            JsonDictionary.Add("preUserCount", CurrentClient.UserQuantity - order.UserQuantity);
                            JsonDictionary.Add("preEndTime", CurrentClient.EndTime.ToString("yyyy-MM-dd"));
                        }
                    }
                }
                //订单不存在
                else
                {
                    result = -1;
                }
            }
            else
            {
                result = 2;
            }

            JsonDictionary.Add("result", result);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #5
0
        public JsonResult PayClientOrder(string id)
        {
            ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);

            if (order.PayStatus == 0 || order.PayStatus == 2)
            {
                bool flag = ClientOrderBusiness.PayClientOrder(id, (int)IntFactoryEnum.EnumClientOrderPay.Pay);
                JsonDictionary.Add("Result", flag ? 1 : 0);
            }
            else
            {
                JsonDictionary.Add("Result", 1001);
            }
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #6
0
        /// <summary>
        /// 修改客户订单支付金额
        /// </summary>
        /// <param name="id"></param>
        /// <param name="amount"></param>
        /// <returns></returns>
        public JsonResult UpdateOrderAmount(string id, string amount)
        {
            ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);

            if (order.Status == 0)
            {
                bool flag = ClientOrderBusiness.UpdateOrderAmount(id, decimal.Parse(amount));
                JsonDictionary.Add("Result", flag ? 1 : 0);
            }
            else
            {
                JsonDictionary.Add("Result", order.Status == 1 ? 1001 : 1002);
            }
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #7
0
        /// <summary>
        /// 关闭客户订单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult CloseClientOrder(string id)
        {
            ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);

            if (order.Status == 0)
            {
                bool flag = ClientOrderBusiness.UpdateClientOrderStatus(id, IntFactoryEnum.EnumClientOrderStatus.Delete);
                JsonDictionary.Add("Result", flag ? 1 : 0);
            }
            else
            {
                JsonDictionary.Add("Result", order.Status == 1 ? 1001 : 1002);
            }
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #8
0
        /// <summary>
        /// 获取客户订单信息
        /// </summary>
        /// <param name="id"></param>
        public int GetClientOrderInfo(ref string id)
        {
            ViewBag.OrderID = id ?? string.Empty;

            if (!string.IsNullOrEmpty(id))
            {
                ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);
                if (order != null && !string.IsNullOrEmpty(order.OrderID))
                {
                    //订单已支付
                    if (order.Status == 1)
                    {
                        return(-2);
                    }
                    else
                    {
                        ViewBag.RealAmount = decimal.Round(order.RealAmount, 2);
                    }
                }
                //订单不存在
                else
                {
                    return(-1);
                }
            }
            else
            {
                int pageCount           = 0;
                int totalCount          = 0;
                List <ClientOrder> list = ClientOrderBusiness.GetClientOrders(0, -1, string.Empty, string.Empty, CurrentUser.ClientID, int.MaxValue, 1, ref totalCount, ref pageCount);

                if (list.Count > 0)
                {
                    id = list[0].OrderID;
                    return(2);
                }
            }

            return(1);
        }
Example #9
0
        /// <summary>
        /// 获取客户订单信息
        /// </summary>
        /// <param name="id"></param>
        public void GetClientOrderInfo(string id)
        {
            ViewBag.Years             = 1;
            ViewBag.RealAmount        = "0,00";
            ViewBag.ClientOrdersCount = 0;//客户订单数
            ViewBag.OrderID           = id ?? string.Empty;

            if (!string.IsNullOrEmpty(id))
            {
                ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);
                if (order != null && !string.IsNullOrEmpty(order.OrderID))
                {
                    //订单已支付
                    if (order.Status == 1)
                    {
                        ViewBag.OrderID = "-2";
                    }
                    else
                    {
                        ViewBag.Years        = order.Years;
                        ViewBag.UserQuantity = order.UserQuantity;
                        ViewBag.RealAmount   = decimal.Round(order.RealAmount, 2);
                    }
                }
                else //订单不存在
                {
                    ViewBag.OrderID = "-1";
                }
            }
            else
            {
                int pageCount           = 0;
                int totalCount          = 0;
                List <ClientOrder> list = ClientOrderBusiness.GetClientOrders(0, -1, string.Empty, string.Empty, CurrentUser.AgentID, CurrentUser.ClientID, int.MaxValue, 1, ref totalCount, ref pageCount);

                ViewBag.ClientOrdersCount = list.Count;
            }
        }
Example #10
0
        /// <summary>
        /// 接受支付宝扣款通知
        /// </summary>
        public void 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)//验证成功
                {
                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表

                    //商户订单号
                    string out_trade_no = Request.Form["out_trade_no"];

                    //支付宝交易号

                    string trade_no = Request.Form["trade_no"];

                    //交易状态
                    string trade_status = Request.Form["trade_status"];


                    if (Request.Form["trade_status"] == "TRADE_FINISHED")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
                    }
                    else if (Request.Form["trade_status"] == "TRADE_SUCCESS")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //付款完成后,支付宝系统发送该交易状态通知

                        //获取订单详情
                        ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(out_trade_no);
                        if (order != null && !string.IsNullOrEmpty(order.OrderID))
                        {
                            decimal total_fee = decimal.Parse(Request.Form["total_fee"]);
                            if (order.RealAmount == total_fee)
                            {
                                //订单支付及后台客户授权
                                bool flag = ClientOrderBusiness.PayOrderAndAuthorizeClient(order.OrderID, string.Empty, 1, IntFactoryEnum.EnumOrderPayType.AliPay);

                                if (flag)
                                {
                                    ClientBusiness.UpdateClientCache(order.ClientID);
                                    Response.Write("success");  //请不要修改或删除
                                }
                            }
                        }
                    }
                }
            }
        }