private void LoadRepeater()
        {
            if (Session["TagLogFilter"] != null)
            {
                tagLogFilter = (NetRadio.LocatingMonitor.Controls.__TagLogFilter)Session["TagLogFilter"];
                string tagFilterCondition = tagLogFilter.ConditionDescription;
            }

            //过滤条件
            //tagLogFilter.SelectedGroupIdArray = new int[1] { (int)_userType };  //20091228 add
            string strWhere   = LocatingMonitorUtils.ConstructSQLWhere(tagLogFilter);
            string zCondition = "GenericEventType= " + (int)SupportEvent.BatteryInsufficient;

            strWhere += (strWhere.Trim() == "") ? zCondition : " AND " + zCondition;
            strWhere += " AND hostgroupid= " + ((int)_userType).ToString();

            string zSortDir = "desc";

            if (_sortDir == SortDirection.Ascending)
            {
                zSortDir = "";
            }

            int     totalCount = 0;
            DataSet ds         = GenericEventLog.GetGenericEventLog(strWhere, _zSortKey, zSortDir, p.PageSize, p.PageIndex, out totalCount);

            p.RecordCount = totalCount;
            if (ds.Tables.Count != 0)
            {
                list.DataSource = ds.Tables[0].DefaultView;
                list.DataBind();
            }
        }
Ejemplo n.º 2
0
        private void LoadRepeater()
        {
            using (AppDataContext db = new AppDataContext())
            {
                if (Session["TagLogFilter"] != null)
                {
                    tagLogFilter = (NetRadio.LocatingMonitor.Controls.__TagLogFilter)Session["TagLogFilter"];
                    string tagFilterCondition = tagLogFilter.ConditionDescription;
                }

                //过滤条件
                //tagLogFilter.SelectedGroupIdArray = new int[1] { (int)_userType };  //20091228 add
                string strWhere   = LocatingMonitorUtils.ConstructSQLWhere(tagLogFilter);
                string zCondition = "GenericEventType= " + (int)SupportEvent.ButtonPressed;
                strWhere += (strWhere.Trim() == "") ? zCondition : " AND " + zCondition;
                strWhere += " AND hostgroupid= " + ((int)_userType).ToString();

                string zSortDir = "desc";
                if (_sortDir == SortDirection.Ascending)
                {
                    zSortDir = "";
                }

                int     totalCount = 0;
                DataSet ds         = GenericEventLog.GetGenericEventLog(strWhere, _zSortKey, zSortDir, p.PageSize, p.PageIndex, out totalCount);
                p.RecordCount = totalCount;
                if (ds.Tables.Count != 0)
                {
                    list.DataSource = ds.Tables[0].DefaultView;
                    list.DataBind();
                }
            }
            ////////////////////////////////////////////////////////////////////////////////

            /*using (AppDataContext db = new AppDataContext()) {
             *  var query = db.GenericEventLogViews
             *      .Where(x => x.GenericEventType == (int)SupportEvent.ButtonPressed)
             *      .OrderByDescending(x => x.Id)
             *      .Select(x => new GenericEventLogView {
             *          TagId = x.TagId,
             *          TagName = x.TagName,
             *          MapId = x.MapId,
             *          CoordinatesName = x.CoordinatesName,
             *          FacilityName = x.FacilityName,
             *          WriteTime = x.WriteTime
             *      });
             *  if (Session["TagLogFilter"] != null)
             *  {
             *      tagLogFilter = (NetRadio.LocatingMonitor.Controls.__TagLogFilter)Session["TagLogFilter"];
             *      string tagFilterCondition = tagLogFilter.ConditionDescription;
             *  }
             *
             *  query = query.Where(x => x.WriteTime > tagLogFilter.FromTime);
             *  query = query.Where(x => x.WriteTime < tagLogFilter.ToTime);
             *
             *  if (tagLogFilter.TagNameKeyword.Length > 0) {
             *      query = query.Where(x => x.TagName.Contains(tagLogFilter.TagNameKeyword));
             *  }
             *
             *  if (tagLogFilter.SelectedGroupIdArray != null)
             *  {
             *      //int[] coveredTagIdArray = TagGroupCoverage.GetCoveredTagIdArray(tagLogFilter.SelectedGroupIdArray);
             *      int[] coveredTagIdArray = HostTagGroupStatus.GetCoveredTagIdArray(tagLogFilter.SelectedGroupIdArray);
             *      query = query.Where(x => coveredTagIdArray.Contains(x.TagId));
             *  }
             *
             *  if (tagLogFilter.FacilityFilterRowVisible && tagLogFilter.MapId > 0) {
             *      query = query.Where(x => x.MapId == tagLogFilter.MapId);
             *  }
             *
             *  p.RecordCount = query.Count();
             *  query = query.Skip(p.RecordOffset).Take(p.PageSize);
             *
             *  list.DataSource = query.ToList();
             *  list.DataBind();
             * }
             */
        }