/// <summary>
        /// 分页查询商品咨询回复信息
        /// </summary>
        /// <param name="paging">
        /// 分页对象
        /// </param>
        /// <param name="pageCount">
        /// 页数
        /// </param>
        /// <param name="totalCount">
        /// 行数
        /// </param>
        /// <returns>
        /// 查询结果
        /// </returns>
        public List<Product_Consult> QueryConsultReplies(Paging paging, out int pageCount, out int totalCount)
        {
            var list = HttpRuntime.Cache["ProductConsult"] as List<Product_Consult>;
            if (list == null)
            {
                var productConsultDa = new DAFactoryTransact().CreateProductConsultDA();
                return productConsultDa.PagingReplies(paging, out pageCount, out totalCount);
            }

            var productID = int.Parse(paging.Condition.Substring(11));
            list = (from consult in list where consult.ProductID == productID orderby consult.CreateTime descending select consult).ToList();
            totalCount = list.Count;
            pageCount = totalCount / paging.PageSize;
            return list.Skip((paging.PageIndex - 1) * paging.PageSize).Take(paging.PageSize).ToList();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 订单在线支付
        /// </summary>
        /// <param name="order">订单对象</param>
        /// <param name="totalFee">支付金额</param>
        /// <param name="orderOrgID">支付方式(支付宝,财富通,工行,农行等)</param>
        /// <param name="tradeNo">支付交易号</param>
        /// <returns>返回修改订单成功与否</returns>
        public bool OrderOnLinePayment(Order order, double totalFee, int orderOrgID, string tradeNo)
        {
            //支付成功,改写数据库订单信息
            //添加支付记录信息
            //添加订单状态跟踪信息

            LogUtils.Log(
                string.Format("系统更新在线支付订单信息,订单编码:{0},支付平台编码:{1},支付交易号:{2}", order.ID, orderOrgID, tradeNo),
                "OrderOnLinePayment",
                Category.Info,
                null,
                this.userID);

            order.Status = order.Status == 100 ? 0 : order.Status;
            this.orderDA.SqlServer.BeginTransaction();
            var transaction = this.orderDA.SqlServer.Transaction;
            try
            {
                this.Edit(order, transaction);
                var orderPaymentDa = new DAFactoryTransact().CreateOrderPaymentDA();
                var payment = new Order_Payment
                                  {
                                      OrderID = order.ID,
                                      IsDelete = 0,
                                      IsUseAccount = false,
                                      IsUseCoupon = false,
                                      IsUseIntegral = false,
                                      PaymentMoney = totalFee,
                                      TradeNo = tradeNo,
                                      PaymentOrgID = orderOrgID,
                                      CreateTime = DateTime.Now
                                  };
                orderPaymentDa.Insert(payment, transaction);

                new OrderStatusTrackingService().Add(
                    new Order_Status_Tracking
                    {
                        OrderID = order.ID,
                        EmployeeID = isBackage ? this.userID : 0,
                        UserID = isBackage?0:this.userID,
                        Remark = "订单已支付",
                        Status = order.Status
                    },
                    transaction);
                transaction.Commit();

                //检查是否可以由系统自动确认订单
                try
                {
                    if (!this.ConfirmOrderBySystem(order,payment))
                    {
                        LogUtils.Log(
                            string.Format("在线支付成功后,订单自动确认失败,订单编码:{0},支付平台编码:{1},支付交易号:{2}", order.ID, orderOrgID, tradeNo),
                            "在线支付订单状态更新",
                            Category.Warn,
                            null,
                            this.userID);
                    }
                    else
                    {
                        LogUtils.Log(
                            string.Format("在线支付成功后,订单自动确认成功,订单编码:{0},支付平台编码:{1},支付交易号:{2}", order.ID, orderOrgID, tradeNo),
                            "在线支付订单状态更新",
                            Category.Info,
                            null,
                            this.userID);
                    }
                }
                catch (Exception ex)
                {
                    LogUtils.Log(
                            string.Format("在线支付成功后,订单自动确认时出错,订单编码:{0},支付平台编码:{1},支付交易号:{2},错误信息:{3},堆栈:{4}", order.ID, orderOrgID, tradeNo,ex.Message,ex.StackTrace),
                            "在线支付订单状态更新",
                            Category.Error,
                            null,
                            this.userID);
                }

                return true;
            }
            catch(Exception exception)
            {
                if (transaction != null)
                {
                    transaction.Rollback();
                    if (transaction.Connection!=null&&transaction.Connection.State != ConnectionState.Closed)
                    {
                        transaction.Connection.Close();
                    }
                }

                TextLogger.Instance.Log("更新订单支付信息出错~~", Category.Error, exception);
                LogUtils.Log(
                    string.Format(
                        "用户,UserID={0}已支付订单{1},处理订单状态是出错。错误信息:{2}",
                        this.userID,
                        order.OrderCode,
                        exception.Message),
                    "UpdatePayment",
                    Category.Error);
                return false;
            }
        }
 /// <summary>
 /// 分页未回复商品咨询
 /// </summary>
 /// <param name="paging">
 /// 分页对象
 /// </param>
 /// <param name="pageCount">
 /// 页数
 /// </param>
 /// <param name="totalCount">
 /// 行数
 /// </param>
 /// <returns>
 /// 查询结果
 /// </returns>
 public List<Product_Consult> QueryConsult(Paging paging, out int pageCount, out int totalCount)
 {
     var productConsultDa = new DAFactoryTransact().CreateProductConsultDA();
     return productConsultDa.QueryConsult(paging, out pageCount, out totalCount);
 }