Exemplo n.º 1
0
        public decimal GetNeedPayCashDepositByShopId(long shopId)
        {
            decimal              num    = new decimal(0, 0, 0, false, 2);
            IShopService         create = Instance <IShopService> .Create;
            IShopCategoryService shopCategoryService = Instance <IShopCategoryService> .Create;
            List <CategoryInfo>  list             = shopCategoryService.GetBusinessCategory(shopId).ToList();
            IEnumerable <long>   parentCategoryId =
                from item in list
                where item.ParentCategoryId == 0
                select item.Id;
            //decimal num1 = context.CategoryCashDepositInfo.FindBy((CategoryCashDepositInfo item) => parentCategoryId.Contains(item.CategoryId)).Max<CategoryCashDepositInfo, decimal>((CategoryCashDepositInfo item) => item.NeedPayCashDeposit);
            decimal         num1            = 1;
            CashDepositInfo cashDepositInfo = (
                from item in context.CashDepositInfo
                where item.ShopId == shopId
                select item).FirstOrDefault();

            if (cashDepositInfo != null && cashDepositInfo.CurrentBalance < num1)
            {
                num = num1 - cashDepositInfo.CurrentBalance;
            }
            if (cashDepositInfo == null)
            {
                num = num1;
            }
            return(num);
        }
Exemplo n.º 2
0
        public CashDepositsObligation GetCashDepositsObligation(long productId)
        {
            CashDepositsObligation cashDepositsObligation = new CashDepositsObligation()
            {
                IsCustomerSecurity       = false,
                IsSevenDayNoReasonReturn = false,
                IsTimelyShip             = false
            };
            CashDepositsObligation enableNoReasonReturn = cashDepositsObligation;
            IProductService        create              = Instance <IProductService> .Create;
            IShopService           shopService         = Instance <IShopService> .Create;
            IShopCategoryService   shopCategoryService = Instance <IShopCategoryService> .Create;
            ICategoryService       categoryService     = Instance <ICategoryService> .Create;
            ProductInfo            product             = create.GetProduct(productId);
            ShopInfo shop = shopService.GetShop(product.ShopId, false);

            CashDepositInfo cashDepositInfo = (
                from item in context.CashDepositInfo
                where item.ShopId == shop.Id
                select item).FirstOrDefault();
            List <CategoryInfo> list             = shopCategoryService.GetBusinessCategory(shop.Id).ToList();
            IEnumerable <long>  parentCategoryId =
                from item in list
                where item.ParentCategoryId == 0
                select item.Id;
            //decimal num = context.CategoryCashDepositInfo.FindBy((CategoryCashDepositInfo item) => parentCategoryId.Contains(item.CategoryId)).Max<CategoryCashDepositInfo, decimal>((CategoryCashDepositInfo item) => item.NeedPayCashDeposit);
            decimal num = 1;

            if (shop.IsSelf || cashDepositInfo != null && cashDepositInfo.CurrentBalance >= num || cashDepositInfo != null && cashDepositInfo.CurrentBalance < num && cashDepositInfo.EnableLabels)
            {
                List <long> nums = new List <long>()
                {
                    product.CategoryId
                };
                CategoryInfo            categoryInfo            = categoryService.GetTopLevelCategories(nums).FirstOrDefault();
                CategoryCashDepositInfo categoryCashDepositInfo = (
                    from item in context.CategoryCashDepositInfo
                    where item.CategoryId == categoryInfo.Id
                    select item).FirstOrDefault();
                enableNoReasonReturn.IsSevenDayNoReasonReturn = categoryCashDepositInfo.EnableNoReasonReturn;
                enableNoReasonReturn.IsCustomerSecurity       = true;
                if (!string.IsNullOrEmpty(product.ChemCloud_FreightTemplate.SendTime))
                {
                    enableNoReasonReturn.IsTimelyShip = true;
                }
            }
            return(enableNoReasonReturn);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 获取诊所授权的分类
 /// </summary>
 /// <returns></returns>
 public JsonResult GetAuthorizationCategory(long shopId, long?key = null, int?level = -1)
 {
     if (level == -1)
     {
         key = 0;
     }
     if (key.HasValue)
     {
         var categories    = _iShopCategoryService.GetBusinessCategory(shopId).Where(r => r.ParentCategoryId == key.Value).ToArray();
         var cateoriesPair = categories.Select(item => new KeyValuePair <long, string>(item.Id, item.Name));
         return(Json(cateoriesPair));
     }
     else
     {
         return(Json(new object[] { }));
     }
 }
Exemplo n.º 4
0
        public JsonResult GetVshops(int page, int rows, string vshopName, int?vshopType = null)
        {
            Func <VShopExtendInfo, bool> func  = null;
            Func <VShopExtendInfo, bool> func1 = null;
            int        num        = 0;
            VshopQuery vshopQuery = new VshopQuery()
            {
                Name     = vshopName,
                PageNo   = page,
                PageSize = rows
            };
            VshopQuery nullable  = vshopQuery;
            int?       nullable1 = vshopType;

            if ((nullable1.GetValueOrDefault() != 1 ? false : nullable1.HasValue))
            {
                nullable.VshopType = new VShopExtendInfo.VShopExtendType?(VShopExtendInfo.VShopExtendType.TopShow);
            }
            int?nullable2 = vshopType;

            if ((nullable2.GetValueOrDefault() != 2 ? false : nullable2.HasValue))
            {
                nullable.VshopType = new VShopExtendInfo.VShopExtendType?(VShopExtendInfo.VShopExtendType.HotVShop);
            }
            int?nullable3 = vshopType;

            if ((nullable3.GetValueOrDefault() != 0 ? false : nullable3.HasValue))
            {
                nullable.VshopType = new VShopExtendInfo.VShopExtendType?(0);
            }
            List <VShopInfo> list = ServiceHelper.Create <IVShopService>().GetVShopByParamete(nullable, out num).ToList();

            num = list.Count();
            ICategoryService     categoryService     = ServiceHelper.Create <ICategoryService>();
            IShopCategoryService shopCategoryService = ServiceHelper.Create <IShopCategoryService>();
            var collection = list.ToArray().Select((VShopInfo item) => {
                string str;
                long id     = item.Id;
                string name = item.Name;
                string str1 = item.CreateTime.ToString();
                ICollection <VShopExtendInfo> vShopExtendInfo = item.VShopExtendInfo;
                if (func == null)
                {
                    func = (VShopExtendInfo t) => t.Type == VShopExtendInfo.VShopExtendType.TopShow;
                }
                if (vShopExtendInfo.Any(func))
                {
                    str = "主推微店";
                }
                else
                {
                    ICollection <VShopExtendInfo> vShopExtendInfos = item.VShopExtendInfo;
                    if (func1 == null)
                    {
                        func1 = (VShopExtendInfo t) => t.Type == VShopExtendInfo.VShopExtendType.HotVShop;
                    }
                    str = (vShopExtendInfos.Any(func1) ? "热门微店" : "普通微店");
                }
                return(new { id = id, name = name, creatTime = str1, vshopTypes = str, categoryName = (shopCategoryService.GetBusinessCategory(item.ShopId).FirstOrDefault() != null ? categoryService.GetCategory(long.Parse(shopCategoryService.GetBusinessCategory(item.ShopId).FirstOrDefault().Path.Split(new char[] { '|' }).First <string>())).Name : ""), visiteNum = item.VisitNum, buyNum = item.buyNum });
            });

            return(Json(new { rows = collection, total = num }));
        }