Beispiel #1
0
        public List <VMClassLike> GetNewestClass()
        {
            ClassDA da     = new ClassDA();
            var     result = da.GetNewestClass();

            if (result != null)
            {
                foreach (var item in result)
                {
                    var likeResult = new BaseSetDA().GetLikeById(item.ClassId);
                    if (likeResult != null && likeResult.Count > 0)
                    {
                        item.likeCount = likeResult.Count;
                    }
                    else
                    {
                        item.likeCount = 0;
                    }

                    var groupResult = new OrderBC().GetGroupBuyConfigByClassId(item.ClassId);
                    var now         = DateTime.Now;
                    if (groupResult != null && groupResult.StartTime < now && groupResult.EndTime > now)
                    {
                        item.GroupPrice = groupResult.GroupPrice;
                    }
                    else
                    {
                        item.GroupPrice = 0;
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
        public List <VMClassLike> GetClassByCondition(string name, string classType, string startDate, string endDate, string classGroup, string order)
        {
            ClassDA da = new ClassDA();

            var result = da.GetClassByCondition(name, classType, startDate, endDate, classGroup, order);

            if (result != null && result.Count > 0)
            {
                foreach (var item in result)
                {
                    item.ClassType = new BaseSetBC().GetDicItemValueByKey(item.ClassType, DictionaryConstant.ClassKey).ItemValue;
                    var groupResult = new OrderBC().GetGroupBuyConfigByClassId(item.ClassId);
                    var now         = DateTime.Now;
                    if (groupResult != null && groupResult.StartTime < now && groupResult.EndTime > now)
                    {
                        item.GroupPrice = groupResult.GroupPrice;
                    }
                    else
                    {
                        item.GroupPrice = 0;
                    }
                }
            }

            return(result);
        }