Beispiel #1
0
        public static Mall_ProductDetail[] GetMall_ProductDetailPriceList(Mall_ProductDetail[] list)
        {
            if (list.Length > 0)
            {
                var        tag_list              = Mall_Tag.GetMall_Tags().ToArray();
                List <int> ProductIDList         = list.Select(p => p.ID).ToList();
                var        variant_list          = Mall_Product_VariantDetail.GetMall_Product_VariantDetailListByProductIDList(ProductIDList);
                var        product_tag_list      = Mall_ProductTag.GetMall_ProductTagListByProductIDList(ProductIDList);
                var        BusinessIDList        = list.Where(p => p.BusinessID > 0).Select(p => p.BusinessID).ToList();
                var        discount_product_list = Mall_BusinessDiscountRequest_Product.GetMall_BusinessDiscountRequest_ProductListByBusinessIDList(BusinessIDList);
                foreach (var item in list)
                {
                    var my_discount_product = discount_product_list.FirstOrDefault(p => p.BusinessID == item.BusinessID && p.ProductID == item.ID);
                    if (my_discount_product != null)
                    {
                        item.DiscountPrice    = my_discount_product.Price;
                        item.DiscountQuantity = my_discount_product.Quantity;
                    }
                    item.VariantPrice      = (item.SalePrice > 0 ? item.SalePrice : 0);
                    item.VariantPointPrice = 0;
                    item.VariantPoint      = 0;
                    item.VariantVIPPrice   = 0;
                    item.VariantVIPPoint   = 0;
                    item.VariantStaffPrice = 0;
                    item.VariantStaffPoint = 0;
                    item.VariantInventory  = (item.TotalCount > 0 ? item.TotalCount : 0);
                    item.VariantID         = 0;
                    item.VariantName       = string.Empty;
                    var my_variant_list = variant_list.Where(q => q.ProductID == item.ID).OrderBy(q => q.FinalVariantPrice).ToArray();
                    if (my_variant_list.Length > 0)
                    {
                        item.VariantPrice      = (my_variant_list[0].FinalVariantPrice > 0 ? my_variant_list[0].FinalVariantPrice : item.VariantPrice);
                        item.VariantPointPrice = (my_variant_list[0].VariantPointPrice > 0 ? my_variant_list[0].VariantPointPrice : item.VariantPointPrice);
                        item.VariantPoint      = (my_variant_list[0].VariantPoint > 0 ? my_variant_list[0].VariantPoint : item.VariantPoint);
                        item.VariantVIPPrice   = (my_variant_list[0].VariantVIPPrice > 0 ? my_variant_list[0].VariantVIPPrice : item.VariantVIPPrice);
                        item.VariantVIPPoint   = (my_variant_list[0].VariantVIPPoint > 0 ? my_variant_list[0].VariantVIPPoint : item.VariantVIPPoint);
                        item.VariantStaffPrice = (my_variant_list[0].VariantStaffPrice > 0 ? my_variant_list[0].VariantStaffPrice : item.VariantStaffPrice);
                        item.VariantStaffPoint = (my_variant_list[0].VariantStaffPoint > 0 ? my_variant_list[0].VariantStaffPoint : item.VariantStaffPoint);
                        item.VariantInventory  = (my_variant_list[0].Inventory > 0 ? my_variant_list[0].Inventory : item.VariantInventory);
                        item.VariantID         = my_variant_list[0].ID;
                        item.VariantName       = my_variant_list[0].VariantName;
                    }

                    var my_product_tag_list = product_tag_list.Where(q => q.ProductID == item.ID).ToArray();
                    var my_tag_list         = tag_list.Where(q => (my_product_tag_list.Select(m => m.TagID).ToList()).Contains(q.ID)).ToArray();
                    if (my_tag_list.Length > 0)
                    {
                        item.TagNames = string.Join(",", my_tag_list.Select(q => q.TagName));
                    }
                }
            }
            return(list);
        }
 public static Mall_Product_VariantDetail GetMall_ProductVariantDetailPrice(Mall_Product_VariantDetail data)
 {
     if (data != null && data.BusinessID > 0)
     {
         var my_discount_product = Mall_BusinessDiscountRequest_Product.GetMall_BusinessDiscountRequest_ProductListByBusinessID(data.BusinessID, data.ProductID);
         if (my_discount_product != null)
         {
             data.DiscountPrice    = my_discount_product.Price;
             data.DiscountQuantity = my_discount_product.Quantity;
         }
     }
     return(data);
 }
 public static Mall_Product_VariantDetail[] GetMall_ProductVariantDetailPriceList(Mall_Product_VariantDetail[] list)
 {
     if (list.Length > 0)
     {
         var BusinessIDList        = list.Where(p => p.BusinessID > 0).Select(p => p.BusinessID).ToList();
         var discount_product_list = Mall_BusinessDiscountRequest_Product.GetMall_BusinessDiscountRequest_ProductListByBusinessIDList(BusinessIDList);
         foreach (var item in list)
         {
             var my_discount_product = discount_product_list.FirstOrDefault(p => p.BusinessID == item.BusinessID && p.ProductID == item.ProductID);
             if (my_discount_product != null)
             {
                 item.DiscountPrice    = my_discount_product.Price;
                 item.DiscountQuantity = my_discount_product.Quantity;
             }
         }
     }
     return(list);
 }
Beispiel #4
0
        public static Mall_ProductDetail GetMall_ProductDetailPrice(Mall_ProductDetail data)
        {
            if (data == null)
            {
                return(null);
            }
            var my_discount_product = Mall_BusinessDiscountRequest_Product.GetMall_BusinessDiscountRequest_ProductListByBusinessID(data.BusinessID, data.ID);

            if (my_discount_product != null)
            {
                data.DiscountPrice    = my_discount_product.Price;
                data.DiscountQuantity = my_discount_product.Quantity;
            }
            data.VariantPrice      = (data.SalePrice > 0 ? data.SalePrice : 0);
            data.VariantPoint      = 0;
            data.VariantPointPrice = 0;
            data.VariantVIPPoint   = 0;
            data.VariantVIPPrice   = 0;
            data.VariantStaffPrice = 0;
            data.VariantStaffPoint = 0;
            data.VariantInventory  = (data.TotalCount > 0 ? data.TotalCount : 0);
            data.VariantID         = 0;
            data.VariantName       = string.Empty;
            var my_variant_list = Mall_Product_VariantDetail.GetMall_Product_VariantDetailListByProductID(data.ID).OrderBy(q => q.FinalVariantPrice).ToArray();

            if (my_variant_list.Length > 0)
            {
                data.VariantPrice      = (my_variant_list[0].FinalVariantPrice > 0 ? my_variant_list[0].FinalVariantPrice : data.VariantPrice);
                data.VariantPoint      = (my_variant_list[0].VariantPoint > 0 ? my_variant_list[0].VariantPoint : data.VariantPoint);
                data.VariantPointPrice = (my_variant_list[0].VariantPointPrice > 0 ? my_variant_list[0].VariantPointPrice : data.VariantPointPrice);
                data.VariantVIPPoint   = (my_variant_list[0].VariantVIPPoint > 0 ? my_variant_list[0].VariantVIPPoint : data.VariantVIPPoint);
                data.VariantVIPPrice   = (my_variant_list[0].VariantVIPPrice > 0 ? my_variant_list[0].VariantVIPPrice : data.VariantVIPPrice);
                data.VariantStaffPrice = (my_variant_list[0].VariantStaffPrice > 0 ? my_variant_list[0].VariantStaffPrice : data.VariantStaffPrice);
                data.VariantStaffPoint = (my_variant_list[0].VariantStaffPoint > 0 ? my_variant_list[0].VariantStaffPoint : data.VariantStaffPoint);
                data.VariantInventory  = (my_variant_list[0].Inventory > 0 ? my_variant_list[0].Inventory : data.VariantInventory);
                data.VariantID         = my_variant_list[0].ID;
                data.VariantName       = my_variant_list[0].VariantName;
            }
            return(data);
        }