Exemplo n.º 1
0
        /// <summary>
        /// 产品Top显示 新增重载,根据产品id筛选
        /// </summary>
        public static DataTable GetHomeProductTop(string top, ProductInfo.ProductTop productTop, int CategoryId)
        {
            DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors();

            if (productTop == ProductInfo.ProductTop.MostLike)    //如果是猜你喜欢的产品
            {
                MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                if (currentMember != null)
                {
                    DataTable favPros = ProductBrowser.GetFavorites(currentMember);
                    if (favPros.Rows.Count > 0)
                    {
                        return(favPros);
                    }
                }
            }
            return(new HomeProductDao().GetHomeProductTop(top, productTop, DistributorsBrower.GetCurrStoreProductRange(), CategoryId));
        }
Exemplo n.º 2
0
        public static ShoppingCartInfo GetCountDownShoppingCart(string productSkuId, int buyAmount)
        {
            ShoppingCartItemInfo info4;
            ShoppingCartInfo     info  = new ShoppingCartInfo();
            ShoppingCartItemInfo info2 = new ShoppingCartDao().GetCartItemInfo(MemberProcessor.GetCurrentMember(), productSkuId, buyAmount);

            if (info2 == null)
            {
                return(null);
            }
            CountDownInfo countDownInfo = ProductBrowser.GetCountDownInfo(info2.ProductId);

            if (countDownInfo == null)
            {
                return(null);
            }
            info4 = new ShoppingCartItemInfo
            {
                SkuId     = info2.SkuId,
                ProductId = info2.ProductId,
                SKU       = info2.SKU,
                Name      = info2.Name,

                SkuContent = info2.SkuContent,

                Weight           = info2.Weight,
                ThumbnailUrl40   = info2.ThumbnailUrl40,
                ThumbnailUrl60   = info2.ThumbnailUrl60,
                ThumbnailUrl100  = info2.ThumbnailUrl100,
                IsfreeShipping   = info2.IsfreeShipping,
                MainCategoryPath = info2.MainCategoryPath,
            };

            info4.MemberPrice = info4.AdjustedPrice = countDownInfo.CountDownPrice;
            info4.Quantity    = info4.ShippQuantity = buyAmount;
            info.LineItems.Add(info4);
            return(info);
        }
Exemplo n.º 3
0
        public static bool InsertCalculationCommission(string orderid)
        {
            OrderInfo        orderInfo          = GetOrderInfo(orderid);
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(orderInfo.ReferralUserId);
            bool             flag = false;

            if (userIdDistributors != null)
            {
                Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                LineItemInfo info3       = new LineItemInfo();
                DataView     defaultView = CategoryBrowser.GetAllCategories().DefaultView;
                string       str2        = null;
                string       str3        = null;
                string       str4        = null;
                decimal      subTotal    = 0M;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    string key = pair.Key;
                    info3 = pair.Value;
                    DataTable productCategories = ProductBrowser.GetProductCategories(info3.ProductId);
                    if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                    {
                        defaultView.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                        str2 = defaultView[0]["FirstCommission"].ToString();
                        str3 = defaultView[0]["SecondCommission"].ToString();
                        str4 = defaultView[0]["ThirdCommission"].ToString();
                        if ((!string.IsNullOrEmpty(str2) && !string.IsNullOrEmpty(str3)) && !string.IsNullOrEmpty(str4))
                        {
                            ArrayList referralBlanceList = new ArrayList();
                            ArrayList userIdList         = new ArrayList();
                            ArrayList ordersTotalList    = new ArrayList();
                            subTotal = info3.GetSubTotal();
                            if (string.IsNullOrEmpty(userIdDistributors.ReferralPath))
                            {
                                referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                userIdList.Add(orderInfo.ReferralUserId);
                                ordersTotalList.Add(subTotal);
                            }
                            else
                            {
                                string[] strArray = userIdDistributors.ReferralPath.Split(new char[] { '|' });
                                if (strArray.Length == 1)
                                {
                                    referralBlanceList.Add((decimal.Parse(str3) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[0]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(orderInfo.ReferralUserId);
                                    ordersTotalList.Add(subTotal);
                                }
                                if (strArray.Length == 2)
                                {
                                    referralBlanceList.Add((decimal.Parse(str2) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[0]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str3) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[1]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(orderInfo.ReferralUserId);
                                    ordersTotalList.Add(subTotal);
                                }
                            }
                            flag = InsertCalculationCommission(userIdList, referralBlanceList, orderInfo.OrderId, ordersTotalList, orderInfo.UserId.ToString());
                        }
                    }
                }
            }
            return(flag);
        }
Exemplo n.º 4
0
        public static bool UpdateCalculationCommission(OrderInfo order)
        {
            DistributorsInfo userIdDistributors = GetUserIdDistributors(order.ReferralUserId);
            bool             flag = false;

            if (userIdDistributors != null)
            {
                Dictionary <string, LineItemInfo> lineItems = order.LineItems;
                LineItemInfo info2       = new LineItemInfo();
                DataView     defaultView = CategoryBrowser.GetAllCategories().DefaultView;
                string       str2        = null;
                string       str3        = null;
                string       str4        = null;
                decimal      subTotal    = 0M;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    string key = pair.Key;
                    info2 = pair.Value;
                    DataTable productCategories = ProductBrowser.GetProductCategories(info2.ProductId);
                    if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                    {
                        defaultView.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                        str2 = defaultView[0]["FirstCommission"].ToString();
                        str3 = defaultView[0]["SecondCommission"].ToString();
                        str4 = defaultView[0]["ThirdCommission"].ToString();

                        //计算分销 一口价 减 成本价 乘以 佣金比例
                        if ((!string.IsNullOrEmpty(str2) && !string.IsNullOrEmpty(str3)) && !string.IsNullOrEmpty(str4))
                        {
                            ArrayList referralBlanceList = new ArrayList();
                            ArrayList userIdList         = new ArrayList();
                            ArrayList ordersTotalList    = new ArrayList();
                            subTotal = info2.GetSubTotal();

                            //三级分店
                            referralBlanceList.Add((decimal.Parse(str2.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                            userIdList.Add(order.ReferralUserId);
                            ordersTotalList.Add(subTotal);

                            if (userIdDistributors.ParentUserId > 0)
                            {
                                referralBlanceList.Add((decimal.Parse(str3.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                                userIdList.Add(userIdDistributors.ParentUserId);
                                ordersTotalList.Add(subTotal);

                                if (userIdDistributors.ReferralUserId2 > 0)
                                {
                                    referralBlanceList.Add((decimal.Parse(str4.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                                    userIdList.Add(userIdDistributors.ReferralUserId2);
                                    ordersTotalList.Add(subTotal);
                                }
                            }

                            flag = new DistributorsDao().UpdateCalculationCommission(userIdList, referralBlanceList, order.OrderId, ordersTotalList, order.UserId.ToString());
                        }
                    }
                }
                flag = new DistributorsDao().UpdateDistributorsOrderNum(order.ReferralUserId.ToString(), order.GetTotal().ToString());
                RemoveDistributorCache(userIdDistributors.UserId);
            }
            return(flag);
        }