예제 #1
0
        public CustomJsonResult Confirm(int operater, PayConfirmModel model)
        {
            CustomJsonResult result = new CustomJsonResult();

            using (TransactionScope ts = new TransactionScope())
            {
                OrderConfirmInfo yOrder = new OrderConfirmInfo();

                switch (model.OrderType)
                {
                case Enumeration.OrderType.PosMachineServiceFee:
                    #region  务费
                    var orderToServiceFee = CurrentDb.OrderToServiceFee.Where(m => m.Sn == model.OrderSn).FirstOrDefault();
                    //yOrder = BizFactory.Merchant.GetOrderConfirmInfoByServiceFee(orderToServiceFee);

                    result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "确认成功", yOrder);
                    #endregion
                    break;
                }

                CurrentDb.SaveChanges();
                ts.Complete();
            }

            return(result);
        }
        public OrderConfirmInfo GetOrderConfirmInfoByServiceFee(OrderToServiceFee orderToServiceFee)
        {
            OrderConfirmInfo yOrder = new OrderConfirmInfo();


            orderToServiceFee.ExpiryTime = this.DateTime.AddYears(1);

            yOrder.OrderId       = orderToServiceFee.Id;
            yOrder.OrderSn       = orderToServiceFee.Sn;
            yOrder.remarks       = orderToServiceFee.Remarks;
            yOrder.orderType     = orderToServiceFee.Type;
            yOrder.orderTypeName = orderToServiceFee.Type.GetCnName();

            //yOrder.confirmField.Add(new OrderField("订单编号", orderToServiceFee.Sn.NullToEmpty()));

            if (orderToServiceFee.Deposit > 0)
            {
                yOrder.confirmField.Add(new OrderField("押金", string.Format("{0}元", orderToServiceFee.Deposit.ToF2Price())));
            }
            yOrder.confirmField.Add(new OrderField("流量费", string.Format("{0}元", orderToServiceFee.MobileTrafficFee.ToF2Price())));
            yOrder.confirmField.Add(new OrderField("到期时间", orderToServiceFee.ExpiryTime.ToUnifiedFormatDate()));
            yOrder.confirmField.Add(new OrderField("支付金额", string.Format("{0}元", orderToServiceFee.Price.NullToEmpty())));


            #region 支持的支付方式
            int[] payMethods = new int[1] {
                1
            };

            foreach (var payWayId in payMethods)
            {
                var payWay = new PayWay();
                payWay.id = payWayId;
                yOrder.payMethod.Add(payWay);
            }
            #endregion

            return(yOrder);
        }
예제 #3
0
        public CustomJsonResult SubmitLllegalQueryScoreRecharge(int operater, OrderToLllegalQueryRecharge orderToLllegalQueryRecharge)
        {
            CustomJsonResult result = new CustomJsonResult();

            using (TransactionScope ts = new TransactionScope())
            {
                var clientUser = CurrentDb.SysClientUser.Where(m => m.Id == orderToLllegalQueryRecharge.UserId).FirstOrDefault();
                var merchant = CurrentDb.Merchant.Where(m => m.Id == clientUser.MerchantId).FirstOrDefault();
     
                orderToLllegalQueryRecharge.SalesmanId = merchant.SalesmanId ?? 0;
                orderToLllegalQueryRecharge.AgentId = merchant.AgentId ?? 0;

                orderToLllegalQueryRecharge.Type = Enumeration.OrderType.LllegalQueryRecharge;
                orderToLllegalQueryRecharge.TypeName = Enumeration.OrderType.LllegalQueryRecharge.GetCnName();
                orderToLllegalQueryRecharge.Status = Enumeration.OrderStatus.WaitPay;
                orderToLllegalQueryRecharge.SubmitTime = this.DateTime;
                orderToLllegalQueryRecharge.CreateTime = this.DateTime;
                orderToLllegalQueryRecharge.Creator = operater;
                CurrentDb.OrderToLllegalQueryRecharge.Add(orderToLllegalQueryRecharge);
                CurrentDb.SaveChanges();



                SnModel snModel = Sn.Build(SnType.OrderToLllegalQueryRecharge, orderToLllegalQueryRecharge.Id);

                orderToLllegalQueryRecharge.Sn = snModel.Sn;
                orderToLllegalQueryRecharge.TradeSnByWechat = snModel.TradeSnByWechat;
                orderToLllegalQueryRecharge.TradeSnByAlipay = snModel.TradeSnByAlipay;
                CurrentDb.SaveChanges();



                OrderConfirmInfo yOrder = new OrderConfirmInfo();


                yOrder.OrderId = orderToLllegalQueryRecharge.Id;
                yOrder.OrderSn = orderToLllegalQueryRecharge.Sn;
                yOrder.remarks = orderToLllegalQueryRecharge.Remarks;
                yOrder.orderType = orderToLllegalQueryRecharge.Type;
                yOrder.orderTypeName = orderToLllegalQueryRecharge.TypeName;

                // yOrder.confirmField.Add(new Entity.AppApi.OrderField("订单编号", orderToLllegalQueryRecharge.Sn.NullToEmpty()));
                yOrder.confirmField.Add(new Entity.AppApi.OrderField("积分", string.Format("{0}", orderToLllegalQueryRecharge.Score)));
                yOrder.confirmField.Add(new Entity.AppApi.OrderField("支付金额", string.Format("{0}元", orderToLllegalQueryRecharge.Price.NullToEmpty())));


                #region 支持的支付方式
                int[] payMethods = new int[1] { 1 };

                foreach (var payWayId in payMethods)
                {
                    var payWay = new PayWay();
                    payWay.id = payWayId;
                    yOrder.payMethod.Add(payWay);
                }
                #endregion


                ts.Complete();

                result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "提交成功", yOrder);
            }


            return result;
        }
        public CustomJsonResult Submit(int operater, bool isGetConfirmInfo, OrderToLllegalDealt orderToLllegalDealt, List <OrderToLllegalDealtDetails> orderToLllegalDealtDetails)
        {
            CustomJsonResult result = new CustomJsonResult();

            using (TransactionScope ts = new TransactionScope())
            {
                var clientUser = CurrentDb.SysClientUser.Where(m => m.Id == orderToLllegalDealt.UserId).FirstOrDefault();
                var merchant   = CurrentDb.Merchant.Where(m => m.Id == clientUser.MerchantId).FirstOrDefault();


                orderToLllegalDealt.SalesmanId = merchant.SalesmanId ?? 0;
                orderToLllegalDealt.AgentId    = merchant.AgentId ?? 0;
                orderToLllegalDealt.Type       = Enumeration.OrderType.LllegalDealt;
                orderToLllegalDealt.TypeName   = Enumeration.OrderType.LllegalDealt.GetCnName();
                orderToLllegalDealt.SubmitTime = this.DateTime;
                orderToLllegalDealt.CreateTime = this.DateTime;
                orderToLllegalDealt.Creator    = operater;
                orderToLllegalDealt.SumCount   = orderToLllegalDealtDetails.Count();
                orderToLllegalDealt.SumFine    = orderToLllegalDealtDetails.Sum(m => m.Fine);
                orderToLllegalDealt.SumPoint   = orderToLllegalDealtDetails.Sum(m => m.Point);



                orderToLllegalDealt.SumServiceFees = orderToLllegalDealtDetails.Sum(m => m.ServiceFee);
                orderToLllegalDealt.SumLateFees    = orderToLllegalDealtDetails.Sum(m => m.Late_fees);
                orderToLllegalDealt.Price          = orderToLllegalDealt.SumFine + orderToLllegalDealt.SumServiceFees + orderToLllegalDealt.SumLateFees;
                CurrentDb.OrderToLllegalDealt.Add(orderToLllegalDealt);
                CurrentDb.SaveChanges();

                SnModel snModel = Sn.Build(SnType.OrderToLllegalQueryRecharge, orderToLllegalDealt.Id);

                orderToLllegalDealt.Sn = snModel.Sn;
                orderToLllegalDealt.TradeSnByWechat = snModel.TradeSnByWechat;
                orderToLllegalDealt.TradeSnByAlipay = snModel.TradeSnByAlipay;
                CurrentDb.SaveChanges();


                foreach (var item in orderToLllegalDealtDetails)
                {
                    item.OrderId    = orderToLllegalDealt.Id;
                    item.Status     = Enumeration.OrderToLllegalDealtDetailsStatus.WaitPay;
                    item.CreateTime = this.DateTime;
                    item.Creator    = operater;

                    CurrentDb.OrderToLllegalDealtDetails.Add(item);
                    CurrentDb.SaveChanges();
                }



                OrderConfirmInfo yOrder = new OrderConfirmInfo();
                var bizProcessesAudit   = BizFactory.BizProcessesAudit.Add(operater, Enumeration.BizProcessesAuditType.OrderToLllegalDealt, orderToLllegalDealt.Id, Enumeration.AuditFlowV1Status.Submit);
                if (isGetConfirmInfo)
                {
                    orderToLllegalDealt.Status = Enumeration.OrderStatus.WaitPay;

                    yOrder.OrderId       = orderToLllegalDealt.Id;
                    yOrder.OrderSn       = orderToLllegalDealt.Sn;
                    yOrder.remarks       = orderToLllegalDealt.Remarks;
                    yOrder.orderType     = orderToLllegalDealt.Type;
                    yOrder.orderTypeName = orderToLllegalDealt.TypeName;



                    //yOrder.confirmField.Add(new Entity.AppApi.OrderField("订单编号", orderToLllegalDealt.Sn.NullToEmpty()));
                    yOrder.confirmField.Add(new Entity.AppApi.OrderField("车牌号码", orderToLllegalDealt.CarNo.NullToEmpty()));
                    yOrder.confirmField.Add(new Entity.AppApi.OrderField("违章", string.Format("{0}次", orderToLllegalDealt.SumCount)));
                    yOrder.confirmField.Add(new Entity.AppApi.OrderField("扣分", orderToLllegalDealt.SumPoint.NullToEmpty()));
                    yOrder.confirmField.Add(new Entity.AppApi.OrderField("罚款", orderToLllegalDealt.SumFine.NullToEmpty()));
                    yOrder.confirmField.Add(new Entity.AppApi.OrderField("支付金额", string.Format("{0}元", orderToLllegalDealt.Price.NullToEmpty())));


                    #region 支持的支付方式
                    int[] payMethods = new int[1] {
                        1
                    };

                    foreach (var payWayId in payMethods)
                    {
                        var payWay = new PayWay();
                        payWay.id = payWayId;
                        yOrder.payMethod.Add(payWay);
                    }
                    #endregion

                    BizFactory.BizProcessesAudit.ChangeStatusByAuditFlowV1(bizProcessesAudit.Id, Enumeration.AuditFlowV1Status.waitGoDealt, operater, null, "提交订单,等待支付");
                }
                else
                {
                    orderToLllegalDealt.Status = Enumeration.OrderStatus.Submitted;
                    BizFactory.BizProcessesAudit.ChangeStatusByAuditFlowV1(bizProcessesAudit.Id, Enumeration.AuditFlowV1Status.Submit, operater, null, "提交订单,等待取单");
                }

                orderToLllegalDealt.BizProcessesAuditId = bizProcessesAudit.Id;


                CurrentDb.SaveChanges();

                ts.Complete();

                result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "提交成功", yOrder);
            }


            return(result);
        }