Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int         actionNum  = (int)GetDateItem(0);
            TagUserType userType   = (TagUserType)GetDateItem(1);
            string      p_keyword  = GetDateItem(2).ToString();
            string      p_extandId = GetDateItem(3).ToString();
            int         p_jailRoomSelectedIndex = (int)GetDateItem(4);
            string      p_jailRoomSelectedValue = GetDateItem(5).ToString();
            string      tagBindingSelectedValue = GetDateItem(6).ToString();
            string      tagOnlineSelectedValue  = GetDateItem(7).ToString();
            int         pageIndex = (int)GetDateItem(8);

            switch (actionNum)
            {
            case 2:
                _userType   = userType;
                p.PageIndex = pageIndex;
                this.LoadRepeater(p_keyword, p_extandId, p_jailRoomSelectedIndex, p_jailRoomSelectedValue, tagBindingSelectedValue, tagOnlineSelectedValue);
                break;

            default:
                break;
            }
            if (BusSystemConfig.IsAutoSelectStrongestRssiTag() == false)
            {
                tagSelector.Visible            = true;
                selectStrongestRssiTag.Visible = false;
            }
            else
            {
                tagSelector.Visible            = false;
                selectStrongestRssiTag.Visible = true;
            }
        }
Beispiel #2
0
 protected override void RegisterScriptFileInHead(ClientFileCollection scriptFiles)
 {
     scriptFiles.Clear();
     scriptFiles.Add("0", "App_Script/Global.js");
     scriptFiles.Add("1", "App_Script/func.js");
     scriptFiles.Add("2", "App_Script/master.js");
     scriptFiles.Add("3", "App_Script/Common.js");
     scriptFiles.Add("4", "App_Script/Project.js");
     if (BusSystemConfig.IsAutoSelectStrongestRssiTag() == false)
     {
         scriptFiles.Add("5", "App_Script/UI/SelectTag.ascx.js");
     }
     scriptFiles.Add("6", "App_Script/Control.js");
     scriptFiles.Add("7", "App_Script/UI/SelectStrongestRssiTag.ascx.js");
     //base.RegisterScriptFileInHead(scriptFiles);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Ajax.AjaxManager.RegisterClass(typeof(__ReplayRoute_Display));
            //object pp = GetCoordinatesVedio(2, "2010-03-23 15:11:14.903", 999);

            xmlPath.Text             = "../Flash/Xml/ReplayRoute.ashx?" + Request.QueryString.ToString();
            showPlayerMarker.Visible = Fetch.QueryUrlAsIntegerOrDefault("minutes", -1) > 0;
            videoDefault.Visible     = false;
            videoYangZhou.Visible    = false;

            switch (BusSystemConfig.GetVedioType())
            {
            case 0:
            default:
                ddVedioTip.Visible   = false;
                ddVedio.Visible      = false;
                videoDefault.Visible = true;
                break;

            case 1:
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Vedio", "Vedio();", true);
                ddVedioTip.Visible = true;
                ddVedio.Visible    = true;
                if (Business.BusSystemConfig.GetOnlyShowVideo())
                {
                    videoYangZhou.Visible = true;
                }
                else
                {
                    videoDefault.Visible = true;
                }
                break;

            case 2:
                ddVedioTip.Visible   = false;
                ddVedio.Visible      = false;
                videoDefault.Visible = true;
                break;
            }
        }
Beispiel #4
0
        protected void LoadTagStatus()
        {
            //if (!LocatingServiceUtil.IsAvailable())
            //{
            //    ShowMessagePage("LocatingService未启动,无法获得即时状态。");
            //    return;
            //}

            switch (BusSystemConfig.GetVedioType())
            {
            case 0:
            default:
                video.Visible = false;
                CollapseView_Video.Visible = false;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertView",
                                                    "AlertView();window.setInterval(function(){AlertView(); },2000);",
                                                    true);
                break;

            case 1:
                video.Visible = true;
                CollapseView_Video.Visible = false;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertView",
                                                    "AlertView();window.setInterval(function(){AlertView(); },2000);",
                                                    true);
                break;

            case 2:
                video.Visible = false;
                CollapseView_Video.Visible = true;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertView2",
                                                    "AlertView2();window.setInterval(function(){AlertView2(); },2000);",
                                                    true);
                break;
            }
        }
        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);
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadGroupList();
                if (BusSystemConfig.IsAutoSelectStrongestRssiTag())
                {
                    tagSelector.Visible     = false;
                    tagSelectorAuto.Visible = true;
                }
                else
                {
                    tagSelector.Visible     = true;
                    tagSelectorAuto.Visible = false;
                }

                if (Config.Settings.ProjectType == ProjectTypeEnum.NMPrison)
                {
                    objectNavigator.Visible = true;
                }
                else
                {
                    objectNavigator.Visible = false;
                }
            }
            switch (_userType)
            {
            default:
                break;

            case TagUserType.Cop:
                nameCalling.Text       = "名称";
                numberCalling.Text     = "编号";
                culpritRoomRow.Visible = false;
                //number.MaxLength = 6;
                break;

            case TagUserType.Culprit:
                nameCalling.Text       = "名称";
                numberCalling.Text     = "编号";
                culpritRoomRow.Visible = true;
                //number.MaxLength = 5;

                if (!Page.IsPostBack)
                {
                    LoadJailRoomDropList();
                }
                break;

            case TagUserType.Position:
                nameCalling.Text         = "定点标签名称";
                numberCalling.Text       = "标签编号";
                culpritRoomRow.Visible   = false;
                numberCallingRow.Visible = false;

                photoRow.Visible     = false;
                grouplistRow.Visible = false;
                break;
            }
            //tagSelector.AllowedSelectCount = 1;
        }
Beispiel #7
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            if (name.Text.Trim().Length == 0)
            {
                feedbacks.Items.AddError("没有填写" + nameCalling.Text + "。");
            }
            //if (_userType == TagUserType.Cop && number.Text.Trim().Length != 6)
            //{
            //    feedbacks.Items.AddError(numberCalling.Text + "必须是6位数字。");
            //}
            //if (_userType == TagUserType.Culprit && number.Text.Trim().Length != 5)
            //{
            //    feedbacks.Items.AddError(numberCalling.Text + "必须是5位数字。");
            //}
            if (_userType != TagUserType.Position && number.Text.Trim().Length == 0)
            {
                feedbacks.Items.AddError("请输入编号");
            }

            if (_userType == TagUserType.Culprit && culpritRoom.Items.Count > 0 && culpritRoom.SelectedIndex < 1)
            {
                feedbacks.Items.AddError("没有选择该犯人所在的监舍。");
            }
            if (feedbacks.HasItems)
            {
                return;
            }

            //yyang 090916
            //if (TagUser.All.Any(x => string.Compare(x.Number, number.Text.Trim(), true) == 0))
            //{
            //    feedbacks.Items.AddError(numberCalling.Text + " " + number.Text.Trim() + " 已经存在在系统中, 请勿重复。");
            //    return;
            //}

            if (_userType != TagUserType.Position && HostTag.All.Any(x => string.Compare(x.HostExternalId, number.Text.Trim(), true) == 0))
            {
                feedbacks.Items.AddError(numberCalling.Text + " " + number.Text.Trim() + " 已经存在在系统中, 请勿重复。");
                return;
            }
            if (BusSystemConfig.IsAutoSelectStrongestRssiTag() == false)
            {
                if (tagSelector.SelectedTagIdArray.Length > 0)
                {
                    if (HostTag.All.Any(x => x.TagId == tagSelector.SelectedTagIdArray[0]))
                    {
                        feedbacks.Items.AddError("您选择的标签已经被别人领用,请核实。");
                        return;
                    }
                }
            }

            string photoPath = "";

            if (uploadPhoto.HasFile)
            {
                photoPath = CreatePhotoUploadPath() + "/" + Misc.CreateUniqueFileName() + Path.GetExtension(uploadPhoto.FileName);

                try
                {
                    using (System.Drawing.Image image = System.Drawing.Image.FromStream(uploadPhoto.FileContent))
                    {
                        if (image != null)
                        {
                            using (Bitmap bitmap = new Bitmap(image, 100, 120))
                            {
                                bitmap.Save(Fetch.MapPath(PathUtil.ResolveUrl(photoPath)), ImageFormat.Jpeg);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    feedbacks.Items.AddError("上传照片出错,可能是图片体积过大,或者不是图片格式文件。");
                    return;
                }
            }

            HostTag hostTag = new HostTag();

            //TagUser user = new TagUser();
            hostTag.HostName       = name.Text.Trim();
            hostTag.HostExternalId = number.Text.Trim();
            hostTag.ImagePath      = photoPath;
            hostTag.HostType       = 1;
            hostTag.Description    = Strings.Left(memo.Text, 500);

            if (BusSystemConfig.IsAutoSelectStrongestRssiTag())
            {
                hostTag.TagId = tagSelectorAuto.GetStrongestRssiTagID();
            }
            else
            {
                if (tagSelector.SelectedTagIdArray.Length > 0)
                {
                    hostTag.TagId = tagSelector.SelectedTagIdArray[0];
                }
            }

            //TagUser.Insert(user);
            //yzhu 090913
            HostTagView oHostTag = new HostTagView();

            try
            {
                int hostId = HostTag.AddOrUpdateHostTag(0, hostTag.TagId, hostTag.HostExternalId, hostTag.HostName, (int)HostTypeType.Unknown, hostTag.Description, hostTag.ImagePath);
                hostTag.HostId = hostId;
                //lyz 设置用户绑定的标签的名称
                device_Tag tag = new device_Tag();
                tag.Id = hostTag.TagId;
                if (tag.Select())
                {
                    tag.TagName = hostTag.HostName;
                    tag.Save();
                }

                HostTag.SetHostGroup(hostId, (int)_userType);
                if (grouplist.SelectedIndex > 0)
                {
                    HostTag.SetHostGroup(hostId, int.Parse(grouplist.SelectedItem.Value));
                }

                HostTag.SetHostStatus(hostId, (int)HostTagStatusType.Normal);

                Caching.Remove(AppKeys.Cache_TagStatusDictionary);
            }
            catch { }


            //记录日志
            Diary.Insert(ContextUser.Current.Id, hostTag.TagId, oHostTag.HostId, "新增标签使用者, " + nameCalling.Text + ": " + hostTag.HostName + (hostTag.TagId == 0 ? "。" : ",并已为其绑定标签。"));

            //清除缓存
            //TagUser.ClearCache();


            bool isServiceAvailable = LocatingServiceUtil.IsAvailable();

            //更新标签信息
            if (hostTag.TagId != 0)
            {
                //Tag.UpdateTagNameAndSerialNo(hostTag.TagId, hostTag.HostName, hostTag.HostExternalId);
                //LocatingServiceUtil.Instance<IServiceApi>().UpdateTagNameAndSerialNo(hostTag.TagId, hostTag.HostName, hostTag.HostExternalId);
                if (Config.Settings.ProjectType != ProjectTypeEnum.WXFactory)//无锡项目需要给标签设定参数,所以需要手动启动定位
                {
                    //自定将标签启动定位
                    XDocument xDoc          = XDocument.Load(Server.MapPath(PathUtil.ResolveUrl("Settings/LocateParameters.xml")));
                    XElement  root          = xDoc.Element("Parameters");
                    int       surveyGroupId = int.Parse(root.Element("SurveyGroup").Value);
                    using (AppDataContext db = new AppDataContext())
                    {
                        SurveyGroup surveryGroupValue = db.SurveyGroups.FirstOrDefault();
                        if (surveryGroupValue != null)
                        {
                            surveyGroupId = surveryGroupValue.Id;
                        }
                    }
                    TagLocateSetting useSettingModel = new TagLocateSetting
                    {
                        LocatingMode  = byte.Parse(root.Element("LocatingMode").Value),
                        RssiBackCount = int.Parse(root.Element("RssiBackCount").Value),
                        ScanInterval  = int.Parse(root.Element("ScanInterval").Value),
                        ScanMode      = byte.Parse(root.Element("ScanMode").Value),
                        ScanSsid      = root.Element("ScanSsid").Value,
                        ScanChannels  = root.Element("ScanChannels").Value,
                        ScanTarget    = byte.Parse(root.Element("ScanTarget").Value),
                        SurveyGroupId = surveyGroupId,
                        UpdateTime    = DateTime.Now,
                        CommandState  = (byte)LocatingCommandState.WaitToStart
                    };
                    if (Config.Settings.ProjectType == ProjectTypeEnum.WXFactory)
                    {
                        useSettingModel.ScanMode = 1;
                    }
                    TagLocateSetting.StartLocating(new int[] { hostTag.TagId }, useSettingModel);


                    if (isServiceAvailable)
                    {
                        // Send a command to LocatingService.
                        LocatingServiceUtil.Instance <IServiceApi>().StartStopLocating();
                        LocatingServiceUtil.Instance <IServiceApi>().ReloadTagHost(hostTag.TagId);
                    }
                    TagStatusView tagView = TagStatusView.SelectTagStatus(hostTag.TagId);
                    tagView.HostTag = HostTagView.GetHostView(hostTag.TagId);
                }
            }

            int groupId = 1;

            //设置犯人所在监舍
            if (_userType == TagUserType.Culprit)
            {
                groupId = 2;
                int areaId = int.Parse(culpritRoom.SelectedValue);

                CulpritRoomReference.ArrangeNewReference(hostTag.HostId, areaId);

                //查询警告条件
                int ruleId = AreaWarningRule.SelectRuleByAreaId(areaId).Select(x => x.Id).FirstOrDefault();

                //如果警告条件不存在,则自动建立一条
                if (ruleId == 0)
                {
                    var rule = new AreaWarningRule
                    {
                        AreaEventType   = (byte)AreaEventType.StayOutside,
                        AreaId          = areaId,
                        EnableToAllTags = false,
                        IsDisabled      = false
                    };
                    if (isServiceAvailable)
                    {
                        ruleId = LocatingServiceUtil.Instance <IServiceApi>().InsertWarningRule(rule).Id;
                    }
                    else
                    {
                        ruleId = AreaWarningRule.InsertAndReturnId(rule);
                    }
                }

                //为警告条件设置关联标签
                var culpritIdArray = CulpritRoomReference.All.Where(x => x.JailRoomId == areaId).Select(x => x.CulpritId).ToArray();
                var tagIdArray     = HostTag.All.Where(x => culpritIdArray.Contains(x.HostId) && x.TagId > 0).Select(x => x.TagId).ToArray();
                if (isServiceAvailable)
                {
                    LocatingServiceUtil.Instance <IServiceApi>().SetWarningRuleCoverage(ruleId, tagIdArray);
                }
                else
                {
                    AreaWarningRuleCoverage.SetCoverage(ruleId, tagIdArray);
                }
            }
            else if (_userType == TagUserType.Cop)
            {
                groupId = 1;
            }

            /*if (hostTag.TagId != 0)
             * {
             *  TagGroup oGroup = TagGroup.Select(groupId);
             *  if (oGroup == null)
             *  {
             *
             *  }
             *  else
             *  {
             *      int[] tagIdArray = new int[1];
             *      int[] selectedTagIdArray = TagGroupCoverage.GetCoveredTagIdArray(groupId);
             *      bool bIncluded = false;
             *      if (selectedTagIdArray != null && selectedTagIdArray.Length > 0)
             *      {
             *          for (int i = 0; i < selectedTagIdArray.Length; i++)
             *          {
             *              if (selectedTagIdArray[i] == hostTag.TagId)
             *              {
             *                  bIncluded = true;
             *                  break;
             *              }
             *          }
             *          if (!bIncluded)
             *          {
             *              tagIdArray = new int[selectedTagIdArray.Length + 1];
             *              tagIdArray[selectedTagIdArray.Length] = hostTag.TagId;
             *          }
             *      }
             *      else
             *      {
             *
             *          tagIdArray[0] = hostTag.TagId;
             *      }
             *      if (!bIncluded)
             *          TagGroup.UpdateById(groupId, oGroup.GroupName, oGroup.GroupDescription, tagIdArray);
             *  }
             * }*/

            //结束
            ShowMessagePage(string.Format(
                                "{0}: <span class='bold'>{1}</span>, {2}: <span class='bold'>{3}</span> 的信息已成功添加到系统中。",
                                nameCalling.Text, name.Text.Trim(), numberCalling.Text, number.Text.Trim()
                                ),
                            new Link("继续"// + Wrap.Title
                                     , Fetch.CurrentUrl),
                            Config.Settings.ProjectType == ProjectTypeEnum.NMPrison?new Link():new Link("返回信息列表", WebPath.GetFullPath("TagUsers/TagUserList.aspx?type=" + (byte)_userType))
                            );
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NetRadio.Data.User oUser = NetRadio.Data.User.SelectByUserName(me.Name);
            if (oUser.Role >= (int)UserRole.Admin)
            {
                isAdmin = true;
            }



            if (BusSystemConfig.IsAutoSelectStrongestRssiTag() == false)
            {
                tagSelector.Visible            = true;
                selectStrongestRssiTag.Visible = false;
                changeTag.Href = "javascript:tt();";
            }
            else
            {
                tagSelector.Visible            = false;
                selectStrongestRssiTag.Visible = true;
                changeTag.Href = "javascript:tt2();";
            }

            if (!Page.IsPostBack)
            {
                Ajax.AjaxManager.RegisterClass(typeof(__TagUser));
                AjaxUtil.RegisterClientScript(typeof(__TagUser), this.Page);

                int    _tagId;
                string _tagMac = null;

                using (AppDataContext db = new AppDataContext())
                {
                    var cop = db.HostTagGroupStatus.SingleOrDefault(h => h.HostId == _id && h.HostGroupId == (int)TagUserType.Cop);
                    if (cop == null)
                    {
                        ShowMessagePage("记录不存在。");
                    }

                    _tagId = cop.TagId;
                    var tag = Tag.Select(_tagId);
                    if (tag != null)
                    {
                        _tagMac = tag.TagMac;
                    }

                    currentTagId.Value = _tagId.ToString();
                    tagMac.Text        = _tagMac;
                    userId.Value       = cop.HostId.ToString();

                    name.Text   = newName.Text = cop.HostName;
                    number.Text = newNumber.Text = cop.HostExternalId;
                    string[] aGroupIds = HostTagGroupStatus.GetBelongsGroupNameArrayByHostId(_id);
                    if (aGroupIds != null && aGroupIds.Length > 0)
                    {
                        LabelGroup.Text = String.Join(", ", aGroupIds);
                    }
                    memo.Text = newMemo.Text = Strings.TextEncode(cop.Description);

                    groups.Text = string.Join(",", HostTagGroupStatus.GetBelongsGroupNameArrayByHostId(_id));

                    tagBound.Text = cop.TagId == 0 ? "未携带标签" : "已领用标签";
                    photo.Src     = "UserPhoto.ashx?id=" + _id;

                    if (!isAdmin)
                    {
                        changeName.Visible   = false;
                        changeNumber.Visible = false;
                        changeMemo.Visible   = false;
                        deleteButton.Visible = false;
                        uploadButton.Visible = false;
                    }
                }

                if (Config.Settings.ProjectType == ProjectTypeEnum.YZPrison)
                {
                    absencediv.Visible = false;
                }
                else
                {
                    absencediv.Visible = true;
                }

                locatingServiceDownMarker.Visible = !LocatingServiceUtil.IsAvailable();

                if (!LocatingServiceUtil.IsAvailable() || !isAdmin)
                {
                    changeTag.Visible      = false;
                    clearAllEvents.Visible = false;
                    //locatingServiceDownMarker.Visible = true;
                }
                else
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(_tagMac))
                        {
                            TagStatusView tagStatus = LocatingServiceUtil.Instance <IServiceApi>().SelectTagStatus(_tagMac);
                            if (tagStatus != null)
                            {
                                coordinatesName.Text     = Coordinates.GetName(tagStatus.CoordinatesId);
                                positionUpdateTime.Value = tagStatus.PositionUpdateTime;

                                absence.Text             = Misc.GetEventStatusDescription(tagStatus.AbsenceStatus);
                                areaEvent.Text           = Misc.GetEventStatusDescription(tagStatus.AreaEventStatus);
                                batteryInsufficient.Text = Misc.GetEventStatusDescription(tagStatus.BatteryInsufficientStatus);
                                batteryReset.Text        = Misc.GetEventStatusDescription(tagStatus.BatteryResetStatus);
                                buttonPressed.Text       = Misc.GetEventStatusDescription(tagStatus.ButtonPressedStatus);
                                //wristletBroken.Text = Misc.GetEventStatusDescription(tagStatus.WristletBrokenStatus);
                                eventUpdateTime.Value = tagStatus.EventUpdateTime;

                                clearAbsence.Visible             = tagStatus.AbsenceStatus != (byte)EventStatus.Cleared;
                                clearAreaEvent.Visible           = tagStatus.AreaEventStatus != (byte)EventStatus.Cleared;
                                clearBatteryInsufficient.Visible = tagStatus.BatteryInsufficientStatus != (byte)EventStatus.Cleared;
                                clearBatteryReset.Visible        = tagStatus.BatteryResetStatus != (byte)EventStatus.Cleared;
                                clearButtonPressed.Visible       = tagStatus.ButtonPressedStatus != (byte)EventStatus.Cleared;
                                //clearWristletBroken.Visible = tagStatus.WristletBrokenStatus != (byte)EventStatus.Cleared;
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NetRadio.Data.User oUser = NetRadio.Data.User.SelectByUserName(me.Name);
            if (oUser.Role >= (int)UserRole.Admin)
            {
                isAdmin = true;
            }

            if (BusSystemConfig.IsAutoSelectStrongestRssiTag() == false)
            {
                tagSelector.Visible            = true;
                selectStrongestRssiTag.Visible = false;
                changeTag.Href = "javascript:tt();";
            }
            else
            {
                tagSelector.Visible            = false;
                selectStrongestRssiTag.Visible = true;
                changeTag.Href = "javascript:tt2();";
            }
            Ajax.AjaxManager.RegisterClass(typeof(__TagUser));
            AjaxUtil.RegisterClientScript(typeof(__TagUser), this.Page);

            if (!Page.IsPostBack)
            {
                LoadJailRoomList();
            }

            int    _tagId;
            string _tagMac = null;

            userId.Value = _id.ToString();
            using (AppDataContext db = new AppDataContext())
            {
                var culprit = db.HostTagGroupStatus.SingleOrDefault(u => u.HostGroupId == (int)TagUserType.Culprit && u.HostId == _id);
                if (culprit == null)
                {
                    ShowMessagePage("记录不存在。");
                }

                _tagId = culprit.TagId;
                var tag = Tag.Select(_tagId);
                if (tag != null)
                {
                    _tagMac = tag.TagMac;
                }

                currentTagId.Value = _tagId.ToString();
                tagMac.Text        = _tagMac;
                userId.Value       = culprit.HostId.ToString();

                name.Text   = newName.Text = culprit.HostName;
                number.Text = newNumber.Text = culprit.HostExternalId;
                memo.Text   = newMemo.Text = Strings.TextEncode(culprit.Description);

                if (Config.Settings.IsLoadHostInfo)
                {
                    CulMoreInfo.Visible = true;
                    string        strConnect = System.Configuration.ConfigurationSettings.AppSettings["FXConnectionString"].ToString();
                    SqlConnection conn       = new SqlConnection(strConnect);

                    string strSQL = "SELECT top 1 RYBH, ZJHM, JYAQ,V_SSJD.HZ as SSJDHZ, V_AJLB.HZ as AJLBHZ from V_RYXXALL join V_AJLB on V_RYXXALL.AJLB=V_AJLB.DM join V_SSJD on V_SSJD.DM=V_RYXXALL.SSJD where RYBH='" + culprit.HostExternalId + "'";

                    DataSet ds = new DataSet();                                //   创建一个   DataSet
                    conn.Open();
                    SqlDataAdapter command = new SqlDataAdapter(strSQL, conn); //   用   SqlDataAdapter   得到一个数据集
                    command.Fill(ds, "CulInfo");                               //把Dataset绑定到数据表
                    DataTable dt = ds.Tables["CulInfo"];

                    if (dt.Rows.Count > 0)
                    {
                        IDNO.Text     = dt.Rows[0]["ZJHM"].ToString();
                        CulKind.Text  = dt.Rows[0]["AJLBHZ"].ToString();
                        CulState.Text = dt.Rows[0]["SSJDHZ"].ToString();
                        CulDes.Text   = dt.Rows[0]["JYAQ"].ToString();
                    }
                }
                else
                {
                    CulMoreInfo.Visible = false;
                }

                tagBound.Text = culprit.TagId == 0 ? "未携带标签" : "已领用标签";
                photo.Src     = "UserPhoto.ashx?id=" + _id;
                jailRoom.Text = MapArea.All.Where(a => a.Id == CulpritRoomReference.All.Where(r => r.CulpritId == _id).Select(r => r.JailRoomId).SingleOrDefault()).Select(a => a.AreaName).SingleOrDefault();

                if (!isAdmin)
                {
                    changeName.Visible   = false;
                    changeNumber.Visible = false;
                    changeMemo.Visible   = false;
                    deleteButton.Visible = false;
                    uploadButton.Visible = false;
                }
            }


            if (!LocatingServiceUtil.IsAvailable() || !isAdmin)
            {
                changeTag.Visible                  = false;
                changeJailRoom.Visible             = false;
                clearAllEvents.Visible             = false;
                locatingServiceDownMarker.Visible  = true;
                setStatus.Visible                  = false;
                locatingServiceDownMarker1.Visible = true;
            }
            else
            {
                try
                {
                    if (!string.IsNullOrEmpty(_tagMac))
                    {
                        TagStatusView tagStatus = LocatingServiceUtil.Instance <IServiceApi>().SelectTagStatus(_tagMac);
                        if (tagStatus != null)
                        {
                            coordinatesName.Text     = Coordinates.GetName(tagStatus.CoordinatesId);
                            positionUpdateTime.Value = tagStatus.PositionUpdateTime;

                            if (tagStatus.HostTag.HostGroupId.Contains(4))
                            {
                                illness.Checked = true;
                            }

                            if (tagStatus.HostTag.HostGroupId.Contains(3))
                            {
                                serious.Checked = true;
                            }

                            if (tagStatus.HostTag.HostStatusId == (int)HostTagStatusType.Interrogation)
                            {
                                arraignment.Checked = true;

                                using (AppExtensionDataContext dbExtension = new AppExtensionDataContext())
                                {
                                    InterrogationLog interrogationLog = dbExtension.InterrogationLogs.SingleOrDefault(t => t.CulpritId == tagStatus.HostTag.HostId && t.StartTime == null);

                                    if (interrogationLog != null)
                                    {
                                        if (interrogationLog.PoliceId == me.Id)
                                        {
                                            arraignment.Enabled = true;
                                        }
                                        else
                                        {
                                            arraignment.Enabled = false;
                                        }
                                    }
                                    else
                                    {
                                        //状态与数据库不一致,需要同步
                                    }
                                }
                            }


                            absence.Text             = Misc.GetEventStatusDescription(tagStatus.AbsenceStatus);
                            areaEvent.Text           = Misc.GetEventStatusDescription(tagStatus.AreaEventStatus);
                            batteryInsufficient.Text = Misc.GetEventStatusDescription(tagStatus.BatteryInsufficientStatus);
                            batteryReset.Text        = Misc.GetEventStatusDescription(tagStatus.BatteryResetStatus);
                            buttonPressed.Text       = Misc.GetEventStatusDescription(tagStatus.ButtonPressedStatus);
                            wristletBroken.Text      = Misc.GetEventStatusDescription(tagStatus.WristletBrokenStatus);
                            eventUpdateTime.Value    = tagStatus.EventUpdateTime;

                            clearAbsence.Visible             = tagStatus.AbsenceStatus != (byte)EventStatus.Cleared;
                            clearAreaEvent.Visible           = tagStatus.AreaEventStatus != (byte)EventStatus.Cleared;
                            clearBatteryInsufficient.Visible = tagStatus.BatteryInsufficientStatus != (byte)EventStatus.Cleared;
                            clearBatteryReset.Visible        = tagStatus.BatteryResetStatus != (byte)EventStatus.Cleared;
                            clearButtonPressed.Visible       = tagStatus.ButtonPressedStatus != (byte)EventStatus.Cleared;
                            clearWristletBroken.Visible      = tagStatus.WristletBrokenStatus != (byte)EventStatus.Cleared;
                        }
                    }
                }
                catch
                {
                }
            }

            using (AppDataContext db = new AppDataContext())
            {
                list.DataSource   = db.DBViewTagAlerts.Where(x => x.TagId == _tagId).OrderByDescending(x => x.WriteTime).Take(10).ToList();
                list.ItemCreated += new RepeaterItemEventHandler(list_ItemCreated);
                list.DataBind();

                if (latestWarnings.Visible = list.Items.Count > 0)
                {
                    moreWarninngs.Href = "../History/MarshalEventLog.aspx?tagNameKeyword=" + Server.UrlEncode(name.Text);
                }
            }
        }