예제 #1
0
        public static object GetHCUrl(int coordinatesId)
        {
            string url         = "";
            int    iChannel    = 0;
            string urlref      = "";
            int    iChannelref = 0;

            using (AppExtensionDataContext db = new AppExtensionDataContext())
            {
                CoordinatesCamera coordinate = db.CoordinatesCameras.SingleOrDefault(c => c.CoordinatesId == coordinatesId);
                if (coordinate != null)
                {
                    url         = coordinate.CameraIP;
                    iChannel    = coordinate.iChannel;
                    urlref      = coordinate.CameraIPlref;
                    iChannelref = coordinate.iChannelref;
                }
            }

            return(new
            {
                url,
                iChannel,
                urlref,
                iChannelref
            });
        }
        public object GetCoordinatesAndTagInfo(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() == 1;
            bool   CoordinatesHasVedio = false;
            string url         = "";
            int    iChannel    = 0;
            string urlref      = "";
            int    iChannelref = 0;


            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 (AppExtensionDataContext db = new AppExtensionDataContext())
                    {
                        CoordinatesCamera coordinate = db.CoordinatesCameras.SingleOrDefault(c => c.CoordinatesId == coordinatesID);
                        if (coordinate != null)
                        {
                            CoordinatesHasVedio = true;
                            url         = coordinate.CameraIP;
                            iChannel    = coordinate.iChannel;
                            urlref      = coordinate.CameraIPlref;
                            iChannelref = coordinate.iChannelref;
                        }
                    }
                }
                return(new
                {
                    //------位置、状态-----
                    hostName,
                    coordinates,
                    tagStatus,
                    coordinatesID,
                    //------是否有视频-----
                    SystemHasVedio,
                    CoordinatesHasVedio,
                    //------摄像头信息-----
                    url,
                    iChannel,
                    urlref,
                    iChannelref,
                    VedioType = NetRadio.Business.BusSystemConfig.GetVedioType()
                });
            }
            else
            {
                return(null);
            }
        }