Ejemplo n.º 1
0
        public IList <Notice> GetAllNotice()
        {
            IList <Notice> noticeList = null;

            try
            {
                _daoManager.OpenConnection();
                noticeList = _noticeDao.GetAllNotice();
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error("[GetAllNotice]", exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(noticeList);
        }
Ejemplo n.º 2
0
        public SysBasicData GetSysBasicData()
        {
            SysBasicData basicData = null;

            try
            {
                _daoManager.OpenConnection();
                basicData = new SysBasicData();
                // region
                IList <BizRegion> regionList = _regionDao.GetAllBizRegion();
                if (regionList != null && regionList.Count > 0)
                {
                    IList <BizDesk> deskList = _deskDao.GetAllBizDesks();
                    if (deskList != null && deskList.Count > 0)
                    {
                        foreach (BizRegion region in regionList)
                        {
                            IList <BizDesk> desks = deskList.Where(desk => desk.RegionID.Equals(region.RegionID)).ToList();
                            if (desks.Count > 0)
                            {
                                region.BizDeskList = desks;
                            }
                        }
                    }
                }
                // goodsGroup
                IList <GoodsGroup> goodsGroupList = _goodsGroupDao.GetAllGoodsGroup();
                if (goodsGroupList != null && goodsGroupList.Count > 0)
                {
                    foreach (GoodsGroup item in goodsGroupList)
                    {
                        IList <Goods> goodsList = _goodsDao.GetGoodsListInGroup(item.GoodsGroupID);
                        if (goodsList != null && goodsList.Count > 0)
                        {
                            IList <GoodsDetailsGroup> goodsDetailsGroupList = _goodsDao.GetDetailsGroupIdsInGoods();
                            if (goodsDetailsGroupList != null && goodsDetailsGroupList.Count > 0)
                            {
                                foreach (Goods goods in goodsList)
                                {
                                    IList <Guid> detailsGroupIds = goodsDetailsGroupList.Where(detail => detail.GoodsID.Equals(goods.GoodsID)).Select(detail => detail.DetailsGroupID).ToList();
                                    if (detailsGroupIds.Count > 0)
                                    {
                                        goods.DetailsGroupIDList = detailsGroupIds;
                                    }
                                }
                            }
                        }
                        item.GoodsList = goodsList;
                    }
                }
                // detailsGroup
                IList <DetailsGroup> detailsGroupList = _detailsGroupDao.GetAllDetailsGroup();
                if (detailsGroupList != null && detailsGroupList.Count > 0)
                {
                    IList <Details> detailsInfoList = _detailsDao.GetAllDetails();
                    if (detailsInfoList != null && detailsInfoList.Count > 0)
                    {
                        foreach (DetailsGroup item in detailsGroupList)
                        {
                            IList <Details> detailsList = detailsInfoList.Where(detail => detail.DetailsGroupID.Equals(item.DetailsGroupID)).ToList();
                            if (detailsList.Count > 0)
                            {
                                IList <DetailsDetailsGroup> detailsDetailsGroups = _detailsDao.GetDetailsGroupIdsInDetails();
                                if (detailsDetailsGroups != null && detailsDetailsGroups.Count > 0)
                                {
                                    foreach (Details details in detailsList)
                                    {
                                        IList <Guid> detailsGroupIdList = detailsDetailsGroups.Where(ddg => ddg.DetailsID.Equals(details.DetailsID)).Select(ddg => ddg.DetailsGroupID).ToList();
                                        if (detailsGroupIdList.Count > 0)
                                        {
                                            details.DetailsGroupIDList = detailsGroupIdList;
                                        }
                                    }
                                }
                                item.DetailsList = detailsList;
                            }
                        }
                    }
                }
                // SysBasicData
                basicData.NoticeList               = _noticeDao.GetAllNotice();
                basicData.RegionList               = regionList;
                basicData.DiscountList             = _discountDao.GetAllDiscount();
                basicData.PayoffWayList            = _payoffWayDao.GetAllPayoffWay();
                basicData.ReasonList               = _reasonDao.GetAllReason();
                basicData.GoodsGroupList           = goodsGroupList;
                basicData.DetailsGroupList         = detailsGroupList;
                basicData.GoodsSetMealList         = _goodsSetMealDao.GetAllGoodsSetMeal();
                basicData.GoodsCronTriggerList     = _goodsGroupDao.GetAllGoodsCronTrigger();
                basicData.ButtonStyleList          = _buttonStyleDao.GetButtonStyleList();
                basicData.SysConfig                = _sysConfigDao.GetSystemConfigInfo();
                basicData.PromotionList            = _promotionDao.GetPromotionList();
                basicData.PromotionConditionList   = _promotionDao.GetPromotionConditionList();
                basicData.PromotionCronTriggerList = _promotionDao.GetPromotionCronTriggerList();
                basicData.PromotionPresentList     = _promotionDao.GetPromotionPresentList();
                //限时特价
                basicData.TotalLimitedTimeSaleList = _goodsGroupDao.GetAllGoodsLimitedTimeSale();
                //组合销售
                basicData.TotalCombinedSaleList = _goodsGroupDao.GetAllGoodsCombinedSale();
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error("[GetSysBasicData]", exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(basicData);
        }