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(); } }
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); strWhere += (strWhere.Trim() == "") ? "IsDisappeared<0" : " AND IsDisappeared<0"; strWhere += " AND hostgroupid= " + ((int)_userType).ToString(); string zSortDir = "desc"; if (_sortDir == SortDirection.Ascending) { zSortDir = ""; } int totalCount = 0; DataSet ds = DBPositionLog.GetPositionLog(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(); } } }
protected void list_ItemCreated(object sender, RepeaterItemEventArgs e) { //AreaEventLogView log = e.Item.DataItem as AreaEventLogView; //---add by tan 2009-10-6---// DataRowView log = (DataRowView)e.Item.DataItem; if (log != null) { Anchor tagName = e.Item.FindControl("tagName") as Anchor; SmartLabel facilityName = e.Item.FindControl("facilityName") as SmartLabel; SmartLabel areaName = e.Item.FindControl("areaName") as SmartLabel; SmartLabel areaEventType = e.Item.FindControl("areaEventType") as SmartLabel; DateTimeLabel writeTime = e.Item.FindControl("writeTime") as DateTimeLabel; tagName.Text = LocatingMonitorUtils.GetHostName(log["TagName"].ToString(), log["TagMac"].ToString(), log["HostName"].ToString()); HostTagGroupStatus hostTagGroupStatus = HostTagGroupStatus.SelectByHostId((int)log["HostId"]); if (hostTagGroupStatus != null) { int groupId = hostTagGroupStatus.HostGroupId; tagName.Href = PathUtil.ResolveUrl(string.Format("/TagUsers/TagUser.aspx?id={0}&type={1}", log["HostId"], groupId)); } else { } facilityName.Text = Convert.ToString(log["FacilityName"]); areaName.Text = Convert.ToString(log["AreaName"]); if (Convert.ToInt32(log["AreaEventType"]) == 0) { areaEventType.Text = "进入区域"; } else { areaEventType.Text = "离开区域"; } writeTime.DisplayValue = Convert.ToDateTime(log["WriteTime"]); } //----------------------------------// /* * Anchor tagName = e.Item.FindControl("tagName") as Anchor; * SmartLabel facilityName = e.Item.FindControl("facilityName") as SmartLabel; * SmartLabel areaName = e.Item.FindControl("areaName") as SmartLabel; * SmartLabel areaEventType = e.Item.FindControl("areaEventType") as SmartLabel; * DateTimeLabel writeTime = e.Item.FindControl("writeTime") as DateTimeLabel; * * tagName.Text = log.TagName; * tagName.Href = PathUtil.ResolveUrl("Objects/Tag.aspx?id=" + log.TagId); * facilityName.Text = log.FacilityName; * areaName.Text = log.AreaName; * areaEventType.Text = (AreaEventType)log.AreaEventType == AreaEventType.StayInside ? "进入区域" : "离开区域"; * writeTime.DisplayValue = log.WriteTime; */ }
private void LoadRepeater() { using (AppDataContext db = new AppDataContext()) { SqlCommand myCommand; SqlConnection myConnection = (SqlConnection)db.Connection; myCommand = new SqlCommand("pNetRadio_PageRecords", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.CommandTimeout = 600; if (Session["TagLogFilter"] != null) { TagLogFilter1 = (NetRadio.LocatingMonitor.Controls.__TagLogFilter)Session["TagLogFilter"]; string tagFilterCondition = TagLogFilter1.ConditionDescription; } //过滤条件 string strWhere = LocatingMonitorUtils.ConstructSQLWhere(TagLogFilter1); string zCondition = "GenericEventType= " + (int)SupportEvent.WristletBroken; strWhere += (strWhere.Trim() == "") ? zCondition : " AND " + zCondition; int?itotalrecords = 0; myCommand.Parameters.AddWithValue("@tblName", "DBViewGenericEventLog"); myCommand.Parameters.AddWithValue("@strGetFields", "*"); myCommand.Parameters.AddWithValue("@fldName", "ID"); myCommand.Parameters.AddWithValue("@strWhere", strWhere); myCommand.Parameters.AddWithValue("@PageSize", p.PageSize); myCommand.Parameters.AddWithValue("@PageIndex", p.PageIndex); myCommand.Parameters.AddWithValue("@Sort", "desc"); myCommand.Parameters.AddWithValue("@totalRecords", itotalrecords); SqlDataAdapter adapter = new SqlDataAdapter(); SqlParameter Par = myCommand.Parameters.AddWithValue("@rowcount", SqlDbType.Int); Par.Direction = ParameterDirection.Output; myConnection.Open(); myCommand.ExecuteNonQuery(); adapter.SelectCommand = myCommand; DataSet ds = new DataSet(); adapter.Fill(ds, "DBViewGenericEventLog"); //取得过滤后的总记录数 p.RecordCount = Int32.Parse(Par.Value.ToString()); list.DataSource = ds.Tables[0].DefaultView; list.DataBind(); myConnection.Close(); } }
protected void list_ItemCreated(object sender, RepeaterItemEventArgs e) { DataRowView log = (DataRowView)e.Item.DataItem; if (log != null) { Anchor tagName = e.Item.FindControl("tagName") as Anchor; tagName.Text = LocatingMonitorUtils.GetHostName(log["TagName"].ToString(), log["TagMac"].ToString(), log["HostName"].ToString()); tagName.Href = PathUtil.ResolveUrl("Objects/Tag.aspx?id=" + Convert.ToString(log["TagID"])); DateTimeLabel writeTime = e.Item.FindControl("writeTime") as DateTimeLabel; writeTime.DisplayValue = Convert.ToDateTime(log["WriteTime"]); SmartLabel facilityName = e.Item.FindControl("facilityName") as SmartLabel; SmartLabel coordinatesName = e.Item.FindControl("coordinatesName") as SmartLabel; facilityName.Text = Convert.ToString(log["FacilityName"]); coordinatesName.Text = Convert.ToString(log["CoordinatesName"]); } }
public object GetAnchorCameraAndTagInfo(int tagID) { if (!LocatingServiceUtil.IsAvailable()) { return(null); } IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>(); TagStatusView tagStatusView = serviceApi.SelectTagStatus(tagID); int coordinatesID = 0; string hostName = ""; string coordinates = ""; string tagStatus = ""; bool SystemHasVedio = BusSystemConfig.GetVedioType() == 2; bool CoordinatesHasVedio = false; string url = ""; int iChannel = 0; string urlref = ""; int iChannelref = 0; AnchorCamera[] coordinate = null; if (tagStatusView != null) { hostName = string.Format("<a href=\"{0}\">{1}</a>", Web.WebPath.GetFullPath("TagUsers/TagUser.aspx?id=" + tagStatusView.HostTag.HostId), tagStatusView.HostTag.HostName); coordinates = tagStatusView.CoordinatesName; coordinatesID = tagStatusView.CoordinatesId; //tagStatus.Text = LocatingMonitorUtils.GetAllTagEventsDescription(tagStatusView); tagStatus = LocatingMonitorUtils.GetAllTagEventsDescription(tagStatusView, tagStatusView.HostTag.HostGroupId.Min(), 10, "Master/WebItem.Master"); if (tagStatus.Length == 0) { tagStatus = "正常"; } if (SystemHasVedio) { using (AppDataContext db = new AppDataContext()) { coordinate = db.AnchorCameras.Where(c => c.CoordinateID == coordinatesID).ToArray(); if (coordinate != null && coordinate.Length > 0) { CoordinatesHasVedio = true; //coordinate = null; //url = coordinate.CameraIP; //iChannel = coordinate.iChannel; //urlref = coordinate.CameraIPlref; //iChannelref = coordinate.iChannelref; } else { CoordinatesHasVedio = false; coordinate = null; } } } return(new { //------位置、状态----- hostName, coordinates, tagStatus, coordinatesID, //------是否有视频----- SystemHasVedio, CoordinatesHasVedio, //------摄像头信息----- coordinate, VedioType = NetRadio.Business.BusSystemConfig.GetVedioType() //url, //iChannel, //urlref, //iChannelref }); } else { return(null); } }
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(); * } */ }
private void LoadRepeater() { //---add by tan 2009-10-5---// using (AppDataContext db = new AppDataContext()) { if (Session["TagLogFilter"] != null) { tagLogFilter = (NetRadio.LocatingMonitor.Controls.__TagLogFilter)Session["TagLogFilter"]; string tagFilterCondition = tagLogFilter.ConditionDescription; } string strWhere = LocatingMonitorUtils.ConstructSQLWhere(tagLogFilter); strWhere += (strWhere.Trim() == "") ? "hostgroupid= " + ((int)_userType).ToString() : " AND hostgroupid= " + ((int)_userType).ToString(); //if (strWhere.Trim().Length <= 0) //{ // itotalrecords = db.pNetRadio_AllRecords("view_TagPositionLogView", ref itotalrecords); // p.RecordCount = Convert.ToInt32(itotalrecords); //} string zSortDir = "desc"; if (_sortDir == SortDirection.Ascending) { zSortDir = ""; } //SqlCommand myCommand; //SqlConnection myConnection = (SqlConnection)db.Connection; //myCommand = new SqlCommand("pNetRadio_PageRecords", myConnection); //myCommand.CommandType = CommandType.StoredProcedure; //myCommand.CommandTimeout = 600; //int? itotalrecords = 0; //myCommand.Parameters.Add("@tblName", "DBViewTagPositionLog as A JOIN object_HostGroup as B ON A.hostid=B.hostid and B.hostgroupid= " + (int)_userType + " and " + strWhere); //myCommand.Parameters.Add("@strGetFields", "A.TagId,A.hostid,A.HostName,A.FacilityName,A.CoordinatesName,A.IsDisappeared,A.WriteTime,A.MapId"); //myCommand.Parameters.Add("@fldName", " "+_zSortKey); //myCommand.Parameters.Add("@strWhere", ""); //myCommand.Parameters.Add("@PageSize", p.PageSize); //myCommand.Parameters.Add("@PageIndex", p.PageIndex); //myCommand.Parameters.Add("@Sort", zSortDir); //myCommand.Parameters.Add("@totalRecords", itotalrecords); //SqlDataAdapter adapter = new SqlDataAdapter(); //SqlParameter Par = myCommand.Parameters.AddWithValue("@rowcount", SqlDbType.Int); //Par.Direction = ParameterDirection.Output; //myConnection.Open(); //myCommand.ExecuteNonQuery(); //adapter.SelectCommand = myCommand; //DataSet ds = new DataSet(); //adapter.Fill(ds, "view_TagPositionLogView"); //myConnection.Close(); ////取得过滤后的总记录数 //if (strWhere != "") // p.RecordCount = Int32.Parse(Par.Value.ToString()); int totalCount = 0; DataSet ds = DBPositionLog.GetPositionLog(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.TagPositionLogViews * .OrderByDescending(x => x.Id) * .Select(x => new TagPositionLogView { * TagId = x.TagId, * TagName = x.TagName, * FacilityId = x.FacilityId, * FacilityName = x.FacilityName, * MapId = x.MapId, * CoordinatesId = x.CoordinatesId, * CoordinatesName = x.CoordinatesName, * WriteTime = x.WriteTime * }); * * 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); * query = query.Where(x => coveredTagIdArray.Contains(x.TagId)); * } * * if (tagLogFilter.FacilityFilterRowVisible && tagLogFilter.MapId > 0) { * query = query.Where(x => x.MapId == tagLogFilter.MapId); * } * * switch ((TagUserType)Fetch.QueryUrlAsIntegerOrDefault("userType", 1)) { * default: * break; * case TagUserType.Cop: * var arr1 = HostTagGroupStatus.All().Where(u => u.TagId != 0 && u.HostGroupId == (byte)TagUserType.Cop).Select(u => u.TagId).ToArray(); * query = query.Where(x => arr1.Contains(x.TagId)); * break; * case TagUserType.Culprit: * var arr2 = HostTagGroupStatus.All().Where(u => u.TagId != 0 && u.HostGroupId == (byte)TagUserType.Culprit).Select(u => u.TagId).ToArray(); * query = query.Where(x => arr2.Contains(x.TagId)); * break; * } * * p.RecordCount = query.Count(); * query = query.Skip(p.RecordOffset).Take(p.PageSize); * * list.DataSource = query.ToList(); * list.DataBind(); * }*/ }