コード例 #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
ファイル: ManageOrder.cs プロジェクト: spiltservice/cloudshop
        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);
        }
コード例 #3
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                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", this.CanClose(order, base.CurrentSiteSetting.OpenMultStore));
                    row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, false));
                    row.Add("CanEditPrice", this.CanEditPrice(order));
                    row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                    bool flag = order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore);
                    if (base.CurrentSiteSetting.OpenMultStore && order.StoreId != 0)
                    {
                        flag = false;
                    }
                    row.Add("canSendGoods", flag);
                    row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                    bool flag2 = false;
                    if (base.CurrentSiteSetting.OpenMultStore && order.CountDownBuyId == 0 && order.BundlingId == 0 && order.ItemStatus == OrderItemStatus.Nomarl && (order.OrderStatus == OrderStatus.BuyerAlreadyPaid || (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway == "hishop.plugins.payment.podrequest")))
                    {
                        if (order.StoreId == -1)
                        {
                            flag2 = (order.LineItems.Count > 0);
                        }
                        else if (order.StoreId > 0)
                        {
                            flag2 = !order.IsConfirm;
                        }
                        else if (order.StoreId == 0)
                        {
                            flag2 = (order.ShippingModeId != -2 && order.LineItems.Count > 0);
                        }
                    }
                    row.Add("CanAllotStore", flag2);
                    RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                    if (refundInfo != null)
                    {
                        row.Add("IsCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && !order.IsStoreCollect);
                        row.Add("RefundId", refundInfo.RefundId);
                    }
                    bool   flag3  = false;
                    string value  = string.Empty;
                    string value2 = string.Empty;
                    if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null && order.OrderStatus == OrderStatus.ApplyForRefund)
                        {
                            flag3  = true;
                            value2 = "订单已申请退款";
                            value  = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                        else
                        {
                            int            num            = 0;
                            AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                            int            num2           = 0;
                            foreach (LineItemInfo value4 in order.LineItems.Values)
                            {
                                if (value4.ReturnInfo != null || value4.ReplaceInfo != null)
                                {
                                    ReturnInfo  returnInfo  = value4.ReturnInfo;
                                    ReplaceInfo replaceInfo = value4.ReplaceInfo;
                                    if (num == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                    {
                                        if (value4.ReturnInfo != null)
                                        {
                                            afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                            num2           = value4.ReturnInfo.ReturnId;
                                        }
                                        else
                                        {
                                            afterSaleTypes = AfterSaleTypes.Replace;
                                            num2           = value4.ReplaceInfo.ReplaceId;
                                        }
                                    }
                                    num++;
                                }
                            }
                            if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                            {
                                value2 = "订单中有商品正在退货/换货中";
                            }
                            else if (order.ReturnedCount > 0)
                            {
                                value2 = "订单中有商品已退货完成";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReplace)
                            {
                                value2 = "订单中有商品正在进行换货操作";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReturn)
                            {
                                value2 = "订单中有商品正在进行退货操作";
                            }
                            if (num > 0)
                            {
                                flag3 = true;
                                value = ((afterSaleTypes != AfterSaleTypes.ReturnAndRefund) ? ("ReplaceApplyDetail?ReplaceId=" + num2) : ("ReturnApplyDetail?ReturnId=" + num2));
                            }
                        }
                    }
                    row.Add("IsShowRefundIcon", flag3);
                    row.Add("RefundOperUrl", value);
                    row.Add("RefundTips", value2);
                    bool flag4 = 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)
                            {
                                flag4 = true;
                            }
                        }
                    }
                    row.Add("FightGrouping", flag4);
                    if (order.StoreId > 0)
                    {
                        row.Add("StoreName", this.GetStoreName(order.StoreId));
                    }
                    if (order.LineItems.Count <= 0)
                    {
                        if (order.UserAwardRecordsId > 0)
                        {
                            row.Add("IsAwardOrder", true);
                        }
                        else
                        {
                            row.Add("IsGiftOrder", true);
                        }
                    }
                    if (order.PreSaleId > 0 && order.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
                        if (productPreSaleInfo != null)
                        {
                            string   value3 = "";
                            DateTime dateTime;
                            if (productPreSaleInfo.DeliveryDate.HasValue)
                            {
                                dateTime = productPreSaleInfo.DeliveryDate.Value;
                                value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                            else
                            {
                                DateTime payDate = order.PayDate;
                                if (order.PayDate != DateTime.MinValue)
                                {
                                    dateTime = order.PayDate;
                                    dateTime = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                    value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                                }
                            }
                            row.Add("SendGoodsTips", value3);
                        }
                    }
                }
            }
            return(dataGridViewModel);
        }