Ejemplo n.º 1
0
        private void Bind()
        {
            int posId   = Tools.GetRequestVal("PosID", -1);
            int orderNo = Tools.GetRequestVal("order", -1);

            PosId   = posId;
            OrderNo = orderNo;
            if (posId < 0)
            {
                return;
            }
            var allList = new GroupBLL().HomePageRecommendGetElemsByPosId(posId, this.GroupTypeID, this.SchemeID);

            var      runningList = new List <GroupElemsEntity>();
            var      toRunList   = new List <GroupElemsEntity>();
            var      expiredList = new List <GroupElemsEntity>();
            DateTime currentTime = DateTime.Now;

            foreach (var eachItem in allList)
            {
                if (eachItem.EndTime < currentTime)
                {
                    //已过期
                    expiredList.Add(eachItem);
                }
                else if (eachItem.StartTime > currentTime)
                {
                    //即将启用
                    toRunList.Add(eachItem);
                }
                else
                {
                    //启用中
                    runningList.Add(eachItem);
                }
            }

            RunningList.DataSource = runningList;
            ToRunList.DataSource   = toRunList;
            ExpiredList.DataSource = expiredList;

            RunningList.DataBind();
            ToRunList.DataBind();
            ExpiredList.DataBind();
        }
        private void Bind()
        {
            int posId   = Tools.GetRequestVal("PosID", -1);
            int orderNo = Tools.GetRequestVal("order", -1);

            PosId   = posId;
            OrderNo = orderNo;
            if (posId < 0)
            {
                return;
            }
            var allList = new GroupBLL().HomePageRecommendGetElemsByPosId(posId, this.GroupTypeID, this.SchemeID);

            if (GroupElemID > 0)
            {
                allList = new GroupElemsBLL().GetGroupEntityByID(GroupElemID);
            }
            // 根据orderNo过滤
            //if (orderNo >= 0)
            //{
            //    List<GroupElemsEntity> newList = new List<GroupElemsEntity>();
            //    for (int i = 0; i < allList.Count; i++)
            //    {
            //        if (allList[i].OrderNo == orderNo)
            //            newList.Add(allList[i]);
            //    }
            //    allList = newList;
            //}

            var      runningList = new List <GroupElemsEntity>();
            var      toRunList   = new List <GroupElemsEntity>();
            var      expiredList = new List <GroupElemsEntity>();
            DateTime currentTime = DateTime.Now;

            foreach (var eachItem in allList)
            {
                if (eachItem.EndTime < currentTime)
                {
                    //已过期
                    expiredList.Add(eachItem);
                }
                else if (eachItem.StartTime > currentTime)
                {
                    //即将启用
                    toRunList.Add(eachItem);
                }
                else
                {
                    //启用中
                    runningList.Add(eachItem);
                }
            }

            RunningList.DataSource = runningList;
            ToRunList.DataSource   = toRunList;
            ExpiredList.DataSource = expiredList;

            RunningList.DataBind();
            ToRunList.DataBind();
            ExpiredList.DataBind();
        }