Esempio n. 1
0
 public override bool CheckVisibility(object dataItem)
 {
     if (dataItem is BusinessObject)
     {
         BusinessObject bo = (BusinessObject)dataItem;
         Mediachase.Ibn.Data.Services.EventService es = bo.GetService <Mediachase.Ibn.Data.Services.EventService>();
         if (es == null || es.LoadEvents().Length == 0)
         {
             return(false);
         }
     }
     return(base.CheckVisibility(dataItem));
 }
Esempio n. 2
0
        public override void DataBind()
        {
            BusinessObject bo = (BusinessObject)DataItem;

            if (bo == null)
            {
                return;
            }

            Mediachase.Ibn.Data.Services.EventService es = bo.GetService <Mediachase.Ibn.Data.Services.EventService>();
            if (es == null)
            {
                this.Visible = false;
                return;
            }
            ICollection <EventGroup> mas = es.LoadEvents();

            grdMain.DataSource = mas;
            grdMain.PageSize   = PageSize;
            object pIndex = CHelper.GetFromContext(this.ClientID + "_NewPageIndex");

            if (pIndex != null)
            {
                int iIndex = int.Parse(pIndex.ToString());
                CHelper.RemoveFromContext(this.ClientID + "_NewPageIndex");
                grdMain.PageIndex = iIndex;
            }
            int pageIndex = mas.Count / grdMain.PageSize;

            if (pageIndex > 0 && mas.Count % grdMain.PageSize == 0)
            {
                pageIndex = pageIndex - 1;
            }
            if (grdMain.PageIndex > pageIndex)
            {
                grdMain.PageIndex = pageIndex;
            }

            grdMain.DataBind();
        }