示例#1
0
        private DataGridViewModel <Dictionary <string, object> > GetOrderList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();
            DbQueryResult orders = OrderHelper.GetOrders(query);

            dataGridViewModel.rows  = DataHelper.DataTableToDictionary(orders.Data);
            dataGridViewModel.total = orders.TotalRecords;
            string[] orderIds = (from d in dataGridViewModel.rows
                                 select d["OrderId"].ToString()).ToArray();
            List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);

            foreach (Dictionary <string, object> row in dataGridViewModel.rows)
            {
                OrderInfo order = TradeHelper.GetOrderInfo(row["OrderId"].ToString());
                row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, order.OrderType));
                row.Add("CanConfirmOrder", order.CanConfirmOrder());
                row.Add("canCheckTake", order.CanConfirmTakeCode());
                row.Add("canCloseOrder", order.CanClose(base.CurrentSiteSetting.OpenMultStore, true));
                row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, true));
                row.Add("canSendGoods", order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore));
                row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                row.Add("canCancelSendGoods", order.OrderStatus == OrderStatus.SellerAlreadySent && (order.DadaStatus == DadaStatus.WaitOrder || order.DadaStatus == DadaStatus.WaitTake));
                row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                row.Add("dadaState", (order.DadaStatus != 0) ? ((Enum)(object)order.DadaStatus).ToDescription() : "");
                RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                if (refundInfo != null)
                {
                    row.Add("RefundId", refundInfo.RefundId);
                }
                if (order.IsStoreCollect)
                {
                    row.Add("isShowCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && order.StoreId == base.CurrentManager.StoreId);
                }
                bool flag = false;
                if (order.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                    if (fightGroup != null)
                    {
                        row.Add("FightGroupActivityId", fightGroup.FightGroupActivityId);
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                        {
                            flag = true;
                        }
                    }
                }
                row.Add("FightGrouping", flag);
            }
            return(dataGridViewModel);
        }
示例#2
0
        private DataGridViewModel <Dictionary <string, object> > GetOrderList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();
            DbQueryResult orders = OrderHelper.GetOrders(query);

            dataGridViewModel.rows  = DataHelper.DataTableToDictionary(orders.Data);
            dataGridViewModel.total = orders.TotalRecords;
            string[] orderIds = (from d in dataGridViewModel.rows
                                 select d["OrderId"].ToString()).ToArray();
            List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);

            foreach (Dictionary <string, object> row in dataGridViewModel.rows)
            {
                OrderInfo order = TradeHelper.GetOrderInfo(row["OrderId"].ToString());
                row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, OrderType.NormalOrder));
                row.Add("CanConfirmOrder", order.CanConfirmOrder());
                row.Add("canCheckTake", order.CanConfirmTakeCode());
                row.Add("canCloseOrder", order.CanClose(base.CurrentSiteSetting.OpenMultStore, true));
                row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, true));
                row.Add("canSendGoods", order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore));
                row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                row.Add("SupplierOrderTotals", order.OrderCostPrice + order.Freight);
                if (order.IsStoreCollect)
                {
                    row.Add("isShowCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && order.StoreId == base.CurrentManager.StoreId);
                }
                row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                bool flag = false;
                if (order.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                    if (fightGroup != null)
                    {
                        row.Add("FightGroupActivityId", fightGroup.FightGroupActivityId);
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                        {
                            flag = true;
                        }
                    }
                }
                row.Add("FightGrouping", flag);
                row.Add("isGiftOrder", order.LineItems.Count <= 0);
                row["IsError"]      = order.IsError;
                row["ErrorMessage"] = order.ErrorMessage;
                RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                if (refundInfo != null)
                {
                    row.Add("RefundId", refundInfo.RefundId);
                }
                int            num      = 0;
                int            num2     = 0;
                bool           flag2    = false;
                string         value    = "订单中有商品正在进行退货/退款";
                AfterSaleTypes?nullable = null;
                if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        RefundInfo refundInfo2 = TradeHelper.GetRefundInfo(order.OrderId);
                        if (refundInfo2 != null)
                        {
                            flag2 = true;
                            value = "订单已申请退款";
                        }
                    }
                    else
                    {
                        int            num3           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num4           = 0;
                        foreach (LineItemInfo value2 in order.LineItems.Values)
                        {
                            if (value2.ReturnInfo != null || value2.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value2.ReturnInfo;
                                ReplaceInfo replaceInfo = value2.ReplaceInfo;
                                if (num3 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value2.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num4           = value2.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num4           = value2.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num3++;
                            }
                        }
                        if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            value = "订单中有商品正在退货/换货中";
                        }
                        else if (order.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            value = "订单中有商品正在进行换货";
                        }
                        else if (order.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            value = "订单中有商品在进行退货/退款操作";
                        }
                        else if (order.ReturnedCount > 0)
                        {
                            value = "订单中有商品已退货完成";
                        }
                        if (num3 > 0)
                        {
                            flag2    = true;
                            nullable = afterSaleTypes;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                num = num4;
                            }
                            else
                            {
                                num2 = num4;
                            }
                        }
                    }
                }
                row.Add("ReturnId", num);
                row.Add("ReplaceId", num2);
                row.Add("AfterSaleType", nullable);
                row.Add("isShowRefund", flag2);
                row.Add("RefundStatus", value);
            }
            return(dataGridViewModel);
        }