Esempio n. 1
0
        /// <summary>
        /// 产品信息提交
        /// </summary>
        /// <returns></returns>
        public int ProductDetailEdit()
        {
            int     _productId       = FormString.IntSafeQ("productId");
            int     _productDetailId = FormString.IntSafeQ("productDetailId");
            int     _productType     = FormString.IntSafeQ("productType");
            int     _status          = FormString.IntSafeQ("status");
            int     _saleNum         = FormString.IntSafeQ("saleNum");
            decimal _tradePrice      = FormString.DecimalSafeQ("tradePrice");
            decimal _price           = FormString.DecimalSafeQ("price");

            int _stockNum = FormString.IntSafeQ("stockNum");

            ProductDetailEntity entity = new ProductDetailEntity();

            entity.ProductId   = _productId;
            entity.Id          = _productDetailId;
            entity.ProductType = _productType;
            entity.Status      = _status;
            entity.SaleNum     = _saleNum;
            entity.TradePrice  = _tradePrice;
            entity.Price       = _price;

            entity.StockNum = _stockNum;
            //if (_productType == (int)ProductType.SpecialPrice)
            //{
            //    entity.StockNum = _stockNum;
            //}
            //else if (_productType == (int)ProductType.Normal)
            //{
            //    entity.StockNum = 999999;
            //}
            int _result = ProductDetailBLL.Instance.AddProductDetail(entity);

            return(_result);
        }
Esempio n. 2
0
        /// <summary>
        /// 添加退款信息
        /// </summary>
        /// <returns></returns>
        public string AddPayReback()
        {
            ResultObj           obj           = new ResultObj();
            long                _batchno      = FormString.LongIntSafeQ("batchno");
            int                 _refundid     = FormString.IntSafeQ("refundid");
            long                _ordercode    = FormString.LongIntSafeQ("ordercode");
            string              _tradecode    = FormString.SafeQ("tradecode");
            decimal             _rebackfee    = FormString.DecimalSafeQ("rebackfee");
            string              _returnreason = FormString.SafeQ("returnreason", 1000);
            OrderEntity         orderentity   = OrderBLL.Instance.GetOrderByCode(_ordercode);
            FinanceRefundEntity Refundentity  = FinanceRefundBLL.Instance.GetFinanceRefund(_refundid);

            if (orderentity.ActPrice - orderentity.ReBackFee >= _rebackfee && Refundentity.RebackFee >= _rebackfee)
            {
                PayRebackEntity entity = new PayRebackEntity();
                entity.BatchNo         = _batchno;
                entity.OrderCode       = _ordercode;
                entity.TradeNoLog      = _tradecode;
                entity.RebackFee       = _rebackfee;
                entity.Remack          = _returnreason;
                entity.RebackTime      = DateTime.Now;
                entity.CreateTime      = DateTime.Now;
                entity.FinanceRefundId = _refundid;

                int _result = PayRebackBLL.Instance.AddPayReback(entity);
                if (_result > 0)
                {
                    obj.Status = (int)CommonStatus.Success;
                }
                else
                {
                    obj.Status = _result;
                }
            }
            else
            {
                obj.Status = (int)CommonStatus.AddPayRebackBig;
            }
            //int _result = OrderBLL.Instance.UpdateOrderRebackFee(_ordercode,_rebackfee);

            return(JsonJC.ObjectToJson(obj));
        }
        public string PayRebackSubmit()
        {
            ResultObj                    _obj         = new ResultObj();
            string                       paycode      = FormString.SafeQ("paycode");
            string                       rebackremark = FormString.SafeQ("rebackremark");
            decimal                      rebackprice  = FormString.DecimalSafeQ("rebackprice");
            VWPayOrderEntity             order        = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode);
            IList <PayOrderRebackEntity> rebacklist   = PayOrderRebackBLL.Instance.GetRebackByPayCode(paycode);
            decimal                      hasreback    = 0;

            if (rebacklist != null && rebacklist.Count > 0)
            {
                foreach (PayOrderRebackEntity reback in rebacklist)
                {
                    hasreback += reback.RebackPrice;
                }
            }
            if (order.PayPrice - hasreback >= rebackprice)//金额满足退款条件(退款金额<=付款金额)
            {
                PayOrderRebackEntity reback = new PayOrderRebackEntity();
                reback.ExternalCode = order.ExternalCode;
                reback.PayMethod    = order.PayMethod;
                reback.PayOrderCode = order.PayOrderCode;
                reback.TotalPrice   = order.PayPrice;
                reback.RebackPrice  = rebackprice;
                reback.RebackRemark = rebackremark;
                reback.Status       = 0;
                reback.SysOrderCode = order.SysOrderCode;
                reback.SysType      = order.SysType;
                PayOrderRebackEntity rebackadd = PayOrderRebackBLL.Instance.AddPayOrderReback(reback);
                if (reback.PayMethod == (int)PayType.WeChat)
                {
                    string result = Refund.Run(reback);
                    _obj.Status = (int)CommonStatus.Success;
                }
                else if (reback.PayMethod == (int)PayType.AliPay || reback.PayMethod == (int)PayType.AliPayMobile)
                {
                    _obj.Status = (int)CommonStatus.Success;
                }
            }
            return(JsonJC.ObjectToJson(_obj));
        }