Ejemplo n.º 1
0
 public RestWordRepository(IWordApi wordApi, IUserApi userApi, IServiceApi serviceApi, IFolderApi folderApi)
 {
     _wordApi    = wordApi;
     _userApi    = userApi;
     _serviceApi = serviceApi;
     _folderApi  = folderApi;
 }
Ejemplo n.º 2
0
        private int GetActiveAPTotalCount()
        {
            int totalCount = 0;

            if (LocatingServiceUtil.IsAvailable())
            {
                IServiceApi    serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                APStatusView[] apStatus   = serviceApi.SelectAPStatusList(
                    null,
                    null,
                    "",
                    SortDirection.Ascending,
                    9999,
                    0,
                    out totalCount
                    );
                totalCount = 0;
                if (apStatus != null && apStatus.Length > 0)
                {
                    for (int i = 0; i < apStatus.Length; i++)
                    {
                        if (apStatus[i].APLocatorStatus == (byte)APLocatorStatus.Success || apStatus[i].APLocatorStatus == (byte)APLocatorStatus.Running)
                        {
                            totalCount++;
                        }
                    }
                }
            }
            return(totalCount);
        }
 public LibiMobileDevice()
 {
     this.usbmuxd             = new UsbmuxdApi(this);
     this.plist               = new PlistApi(this);
     this.idevice             = new iDeviceApi(this);
     this.lockdown            = new LockdownApi(this);
     this.afc                 = new AfcApi(this);
     this.debugServer         = new DebugServerApi(this);
     this.diagnosticsRelay    = new DiagnosticsRelayApi(this);
     this.fileRelay           = new FileRelayApi(this);
     this.heartBeat           = new HeartBeatApi(this);
     this.houseArrest         = new HouseArrestApi(this);
     this.installationProxy   = new InstallationProxyApi(this);
     this.misagent            = new MisagentApi(this);
     this.mobileactivation    = new MobileactivationApi(this);
     this.mobileBackup        = new MobileBackupApi(this);
     this.mobileBackup2       = new MobileBackup2Api(this);
     this.mobileSync          = new MobileSyncApi(this);
     this.mobileImageMounter  = new MobileImageMounterApi(this);
     this.notificationProxy   = new NotificationProxyApi(this);
     this.pinvoke             = new PinvokeApi(this);
     this.propertyListService = new PropertyListServiceApi(this);
     this.restore             = new RestoreApi(this);
     this.springBoardServices = new SpringBoardServicesApi(this);
     this.screenshotr         = new ScreenshotrApi(this);
     this.service             = new ServiceApi(this);
     this.syslogRelay         = new SyslogRelayApi(this);
     this.webInspector        = new WebInspectorApi(this);
 }
        public static string BindTag(int userId, int tagId)
        {
            //TagUser user = TagUser.SelectById(userId);
            string             newMac  = "FAIL";
            HostTagGroupStatus hostTag = HostTagGroupStatus.SelectByHostId(userId);

            if (hostTag != null)
            {
                //HostTag.ChangeHostTagBinding(userId, tagId);

                if (LocatingServiceUtil.IsAvailable())
                {
                    //LocatingServiceUtil.Instance<IServiceApi>().UpdateTagNameAndSerialNo(tagId, hostTag.HostName, hostTag.HostExternalId);
                    IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                    newMac = serviceApi.ExchangeTagMac(hostTag.HostId, 0, tagId);
                    SetStartLocating(tagId);

                    // Send a command to LocatingService.
                    LocatingServiceUtil.Instance <IServiceApi>().StartStopLocating();

                    string calling = GetGroupName(hostTag.HostGroupId);
                    //SecurityLog.Insert(tagId, userId, "为" + calling + hostTag.HostName + "绑定标签,标签MAC: " + newMac + "。", Priority.High);
                    Diary.Insert(ContextUser.Current.Id, tagId, hostTag.HostId, "为" + calling + hostTag.HostName + "绑定标签,标签MAC: " + newMac + "。");
                }
                //else
                //{
                //    SetStartLocating(tagId);
                //Tag.UpdateTagNameAndSerialNo(tagId, hostTag.HostName, hostTag.HostExternalId);
                //}
                //TagUser.BindTagToUser(userId, tagId);
            }
            return(newMac);
        }
        private string GetList(int groupID)
        {
            if (groupID == 1 || groupID == 2)
            {
                if (LocatingServiceUtil.IsAvailable())
                {
                    IServiceApi     serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                    TagStatusView[] tagsView   = serviceApi.GetTagOnSentry();

                    if (tagsView == null)
                    {
                        return("");
                    }
                    var q = tagsView.Where(_d => _d != null && _d.HostTag.HostGroupId.Contains(groupID)).Select(_d => new { HostId = _d.HostTag.HostId, HostName = _d.HostTag.HostName, Mac = _d.Mac, HostPhotoPath = "../TagUsers/UserPhoto.ashx?id=" + _d.HostTag.HostId });

                    StringBuilder sb = new StringBuilder("");
                    foreach (var log in q)
                    {
                        sb.AppendFormat(@" 
                                    <td width=4></td>
                                    <td width=100 align=center valign=top><img src={0} width=100 height=120 /><br/><br/> 姓名:{1}<br/> 标签:{2}</td>
                                    ", log.HostPhotoPath, log.HostName, log.Mac);
                    }
                    if (sb.Length > 0)
                    {
                        sb.Insert(0, "<table border=0 cellspacing=0 cellpadding=0><tr>");
                        sb.Append("</tr></table>");
                    }
                    return(sb.ToString());
                }
            }
            return("");
        }
 public AdunisWebHandler(IDevice device, IOAuthUtils oAuth, IHttpClientConfiguration httpClientConfiguration, IServiceApi serviceApi)
 {
     this.device = device;
     this.oAuth  = oAuth;
     this.httpClientConfiguration = httpClientConfiguration;
     this.serviceApi = serviceApi;
 }
Ejemplo n.º 7
0
        private int GetActiveTagTotalCount(int groupId)
        {
            IList <TagStatusView> tagList = new List <TagStatusView>();
            string _keyword = "";

            int[] _hostGroupArray = new int[1];
            _hostGroupArray[0] = groupId;
            int totalCount = 0;

            if (LocatingServiceUtil.IsAvailable())
            {
                IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                if (serviceApi != null)
                {
                    TagStatusView tagStatusView = new TagStatusView();
                    tagList = serviceApi.SelectTagStatusList(
                        _keyword,
                        _hostGroupArray,
                        0,
                        true,
                        false, //SupportEvent.Absent),
                        false, //SupportEvent.BatteryInsufficient),
                        false, //SupportEvent.AreaEvent),
                        false, //SupportEvent.ButtonPressed),
                        false, //SupportEvent.WristletBroken),
                        "",
                        SortDirection.Ascending,
                        0,//only get total count
                        0,
                        out totalCount);
                }
            }
            return(totalCount);
        }
Ejemplo n.º 8
0
 public FilerWebHandler(IDevice device, IAccountService account, IOAuthUtils oAuth, IHttpClientConfiguration httpClientConfiguration, IServiceApi serviceApi)
 {
     this.device  = device;
     this.account = account;
     this.oAuth   = oAuth;
     this.httpClientConfiguration = httpClientConfiguration;
     this.serviceApi = serviceApi;
 }
Ejemplo n.º 9
0
 public MessengerService(IRepository repository)
 {
     _twitter = new TwitterNet(Settings.TwitterUserName, TwitterNet.ToSecureString(Settings.TwitterPassword));
     _twitter.TwitterServerUrl = Settings.TwitterServiceUrl;
     _messageSender = new SendMessageDelegate(SendMessage);
     _urlShortneningService = new UrlShorteningService(ShorteningService.Bitly);
     _repository = repository;
 }
Ejemplo n.º 10
0
 public SendPrivateMsg( User targetUser, User me ,IServiceApi twitterHandle)
 {
     InitializeComponent();
     UserTitleBar.DataContext = targetUser;
     target = targetUser;
     MeTitleBar.DataContext = me;
     twitterApi = twitterHandle;
 }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                tagSelector.SetDataSourceLeft(NetRadio.LocatingMonitor.Controls.__SelectTagUser.SelectTagUsers2);
            }
            ruleList.ItemDataBound += new RepeaterItemEventHandler(ruleList_ItemDataBound);
            //var list=(select new { a=1,b=2}).
            /////////////////////tagSelector.SelectedGroupId = -1;

            int deleteRuleId = Fetch.QueryUrlAsIntegerOrDefault("deleteRuleId", -1);

            if (deleteRuleId != -1)
            {
                if (!LocatingServiceUtil.IsAvailable())
                {
                    AreaWarningRule.Delete(deleteRuleId);
                    AreaWarningRuleCoverage.DeleteByRuleId(deleteRuleId);
                }
                else
                {
                    IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                    serviceApi.DeleteWarningRule(deleteRuleId);
                    serviceApi.DeleteWarningRuleCoverage(deleteRuleId);
                }
                Terminator.Redirect(Fetch.Referrer);
            }

            MapArea area = MapArea.Select(_id);

            areaName.Text     = area.AreaName;
            facilityName.Text = Facility.GetNameByMapId(area.MapId);

            IList <AreaWarningRule>         _p = AreaWarningRule.SelectRuleByAreaId(area.Id);
            IList <AreaWarningRuleCoverage> _c = AreaWarningRuleCoverage.GetAreaWarningRuleCoverages();

            _list = (from _p1 in _p
                     join _c1 in _c
                     on _p1.Id equals _c1.RuleId
                     join _h1 in HostTag.All
                     on _c1.TagId equals _h1.TagId
                     select new _temp
            {
                RuleId = _c1.RuleId,
                TagId = _c1.TagId,
                HostName = _h1.HostName
            }).ToList();

            ruleList.DataSource = _p;
            ruleList.DataBind();
            ruleCount.Value = ruleList.Items.Count;

            if (forAllTags.SelectedValue == "1")
            {
                tagSelectorContainer.Style.Add("display", "none");
            }
        }
        public MvxNativeFileDownloadRequest(string url, string downloadPath)
        {
            this.Url          = url;
            this.DownloadPath = downloadPath;

            this.httpClientConfiguration = Mvx.Resolve <IHttpClientConfiguration>();
            this.device     = Mvx.Resolve <IDevice>();
            this.serviceApi = Mvx.Resolve <IServiceApi>();
        }
        /// <summary>
        /// 取出需要删除掉的hostid
        /// </summary>
        /// <param name="delhostIds"></param>
        /// <param name="groupid"></param>
        /// <param name="MapId"></param>
        /// <param name="hostIds"></param>
        ///

        private void GetDelIDs(out int[] delhostIds, int groupid, int MapId, int[] hostIds)
        {
            LocatingServiceUtil.DemandLocatingService();
            IServiceApi serviceApi  = LocatingServiceUtil.Instance <IServiceApi>();
            List <int>  ihostid     = new List <int>();
            bool        bExist      = false;
            int         itotalcount = 0;
            int         imapid      = MapId;

            int[]           FindHostIDByGroup = new int[] { groupid };
            TagStatusView[] tgv = serviceApi.SelectTagStatusListByKeywords(
                "",
                FindHostIDByGroup,
                MapId,
                false,
                false,
                false,
                false,
                false,
                false,
                "TagName",
                SortDirection.Ascending,
                50,
                0,
                out itotalcount
                );
            for (int k = 0; k < tgv.Count(); k++)
            {
                for (int m = 0; m < hostIds.Count(); m++)
                {
                    if (tgv[k].HostTag.HostId == hostIds[m])
                    {
                        bExist = true;
                        break;
                    }
                }
                if (bExist)
                {
                    bExist = false;
                    continue;
                }
                else
                {
                    ihostid.Add(tgv[k].HostTag.HostId);
                }
            }
            if (ihostid.Count() > 0)
            {
                ihostid.Add(-1);
            }

            delhostIds = ihostid.ToArray();
        }
        public SingleOneAllTweets(IServiceApi net, User relatedUser)
        {
            InitializeComponent();
            this.saNet = net;
            this.saUser = relatedUser;
            this.Title = saUser.ScreenName + "的微博";
            UserTitleBar.DataContext = saUser;
            singleAllTweets = new TweetCollection();
            AllTweetsListBox.DataContext = singleAllTweets;

            DispatchAllTweetsList();
        }
Ejemplo n.º 15
0
        protected void saveNewRule_Click(object sender, EventArgs e)
        {
            AreaWarningRule rule = new AreaWarningRule();

            rule.EnableToAllTags = forAllTags.SelectedValue == "1";
            rule.AreaEventType   = byte.Parse(areaEventType.SelectedValue);
            rule.AreaId          = _id;
            rule.IsDisabled      = false;

            int[]     tagidarray = new int[tagSelector.SelectedUserIds.Count()];
            ArrayList alHostId   = new ArrayList();

            int[] hostIdArray = null;
            sTagID = "";
            for (int i = 0; i < tagSelector.SelectedUserIds.Count(); i++)
            {
                //根据hostid取得tagid
                HostTag ht = new HostTag();
                ht = HostTag.GetById(tagSelector.SelectedUserIds[i]);
                if (ht != null)
                {
                    alHostId.Add(ht.HostId);
                    sTagID       += ht.TagId + ",";
                    tagidarray[i] = ht.TagId;
                }
            }
            hostIdArray            = (int[])alHostId.ToArray(typeof(int));
            AreaWarningRule.sTagID = sTagID;

            if (!LocatingServiceUtil.IsAvailable())
            {
                AreaWarningRule.InsertAndReturnId(rule);
                if (rule.EnableToAllTags == false)
                {
                    //AreaWarningRuleCoverage.SetCoverage(rule.Id, hostIdArray);
                    AreaWarningRuleCoverage.SetCoverage(rule.Id, tagidarray);
                    //AreaWarningRuleCoverage.SetCoverage(rule.Id, tagSelector.SelectedTagIdArray);
                }
            }
            else
            {
                IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                EditResult  result     = serviceApi.InsertWarningRule(rule);
                rule.Id = result.Id;
                if (rule.EnableToAllTags == false)
                {
                    serviceApi.SetWarningRuleCoverage(rule.Id, tagidarray);
                    //serviceApi.SetWarningRuleCoverage(rule.Id, tagSelector.SelectedTagIdArray);
                }
            }

            Terminator.Redirect(Fetch.CurrentUrl);
        }
Ejemplo n.º 16
0
 public CommentsWindow(IServiceApi api, Tweet t)
 {
     twitterApi = api;
     tweet = t;
     InitializeComponent();
     comments = new CommentCollection();
     //HeadImage.Source = new BitmapImage(new Uri(tweet.User.ImageUrl)); ;
     TitleBar.DataContext = tweet;
     TweetText.DataContext = tweet;
     CommentsListBox.DataContext = comments;
     UpdateComments();
 }
 public OAuthUtils(ISettings settings, IDevice device, IUserInteractionService userInteraction, IAccountService account, IHttpClientConfiguration httpClientConfiguration, IMvxWebBrowserTask browser, IServiceApi serviceApi)
 {
     this.settings                = settings;
     this.device                  = device;
     this.userInteraction         = userInteraction;
     this.account                 = account;
     this.httpClientConfiguration = httpClientConfiguration;
     this.State       = this.settings.GetValueOrDefault(StateKey, Guid.NewGuid().ToString());
     this.browser     = browser;
     this.serviceApi  = serviceApi;
     this.oAuthClient = serviceApi.OAuthClient;
     this.oAuthSecret = serviceApi.OAuthSecret;
 }
Ejemplo n.º 18
0
        private void LoadRepeater()
        {
            //LocatingServiceUtil.DemandLocatingService();
            try
            {
                int            totalCount;
                IServiceApi    serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                APStatusView[] apStatus   = serviceApi.SelectAPStatusList(
                    null,
                    null,
                    _activatedSorter.SortKey,
                    _activatedSorter.SortDirection,
                    p.PageSize,
                    p.RecordOffset,
                    out totalCount
                    );

                if (_activatedSorter.SortDirection == SortDirection.Ascending)
                {
                    if (_activatedSorter.SortKey == "APName")
                    {
                        apStatus = apStatus.OrderBy(x => x.APName).ToArray();
                    }
                    else
                    {
                        apStatus = apStatus.OrderBy(x => x.UpdateTime).ToArray();
                    }
                }

                else
                {
                    if (_activatedSorter.SortKey == "APName")
                    {
                        apStatus = apStatus.OrderByDescending(x => x.APName).ToArray();
                    }
                    else
                    {
                        apStatus = apStatus.OrderByDescending(x => x.UpdateTime).ToArray();
                    }
                }
                apStatus          = apStatus.Where(a => !a.Mac.Substring(0, 11).Contains("00:55:52:48")).ToArray();
                p.RecordCount     = totalCount;//2010-11-17bydyp
                apList.DataSource = apStatus.ToList();
                apList.DataBind();
            }
            catch
            {
                //new PrettyTerminator().End("Locating Service 远程支持服务程序未启动,无法打开该页面。");
            }
        }
Ejemplo n.º 19
0
        public object GetStrongestRssiTag()
        {
            string Mes    = "";
            int    TagID  = 0;
            string TagMAC = "";

            int Error = 0;// 标签可用 = 0 ; 标签已经被绑定 =1 ; LocatingService不可用时 = 2  ; 没有扫描到可用的标签 = 3


            if (LocatingServiceUtil.IsAvailable())
            {
                IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                string      mac        = serviceApi.GetTagOnReception();
                if (mac == null)
                {
                    mac = "";
                }
                AppDataContext   db   = new AppDataContext();
                IQueryable <Tag> tags = db.Tags.Where(_d => _d.TagMac.ToLower().Trim() == mac.ToLower().Trim());
                if (tags.Count() == 1)
                {
                    Tag tag = tags.First();
                    IQueryable <HostTag> hostTags = db.HostTags.Where(_d => _d.TagId == tag.Id);
                    if (hostTags.Count() > 0)
                    {
                        Mes   = string.Format("×当前信号最强的标签MAC地址是{0},但已经被绑定,标签不可用。", tag.TagMac);
                        Error = 1;
                    }
                    else
                    {
                        Mes    = string.Format("√当前信号最强的标签MAC地址是{0},标签可用。", tag.TagMac);
                        TagID  = tag.Id;
                        TagMAC = tag.TagMac;
                        Error  = 0;
                    }
                }
                else
                {
                    Mes   = "暂时没有扫描到可用的标签!";
                    Error = 3;
                }
            }
            else
            {
                Mes   = "LocatingService不可用";
                Error = 2;
            }
            return(new { Mes, TagID, TagMAC, Error });
        }
        public bool ImportUsers()
        {
            int totalCount = 0;

            if (LocatingServiceUtil.IsAvailable())
            {
                IServiceApi   serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                GeneralResult gr         = serviceApi.LoadHostInfo();
                CulpritRoomReference.RemoveCaching();
                if (!gr.Suceess)
                {
                    throw new Exception(gr.ErrText);
                }
            }
            return(true);
        }
        protected void list_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            Facility   f            = (Facility)e.Item.DataItem;
            SmartLabel facilityName = e.Item.FindControl("facilityName") as SmartLabel;
            SmartLabel headCount    = e.Item.FindControl("headCount") as SmartLabel;

            facilityName.Text = f.FacilityName;

            IList <TagStatusView> tagList = new List <TagStatusView>();
            string _keyword = "";

            //GTang 20101122 修改为统计hostGroupid=1,2
            //int[] _hostGroupArray = new int[1] { 1 };
            int[] _hostGroupArray = new int[2] {
                1, 2
            };
            int totalCount = 0;

            IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();

            if (serviceApi != null && LocatingServiceUtil.IsAvailable())
            {
                TagStatusView tagStatusView = new TagStatusView();
                tagList = serviceApi.SelectTagStatusList(
                    _keyword,
                    _hostGroupArray,
                    f.MapId,
                    true,
                    false, //SupportEvent.Absent),
                    false, //SupportEvent.BatteryInsufficient),
                    false, //SupportEvent.AreaEvent),
                    false, //SupportEvent.ButtonPressed),
                    false, //SupportEvent.WristletBroken),
                    "",
                    SortDirection.Ascending,
                    0,//only get total count
                    0,
                    out totalCount);

                headCount.Text = totalCount.ToString();
                _totalCount   += totalCount;
            }
        }
Ejemplo n.º 22
0
        public static bool ClearAllEventStatus(string tagMac)
        {
            if (LocatingServiceUtil.IsAvailable())
            {
                IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                bool        boolean    = serviceApi.ClearTagStatus(tagMac);

                //记录日志
                using (AppDataContext db = new AppDataContext())
                {
                    Tag tag = db.Tags.SingleOrDefault(t => t.TagMac == tagMac);
                    if (tag != null)
                    {
                        Diary.Insert(ContextUser.Current.Id, tag.Id, TagStatusView.SelectTagStatus(tag.Id).HostTag.HostId, "清除" + tag.TagName + "的所有报警状态。");//SecurityLog.Insert(tag.Id, TagUser.GetUserIdByTagId(tag.Id), "清除" + tag.TagName + "的所有报警状态。", Priority.High);
                    }
                }
                return(boolean);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 23
0
 public DummyMenuWebHandler(IDevice device, IServiceApi serviceApi, IHttpClientConfiguration httpClientConfiguration)
     : base(device, serviceApi, httpClientConfiguration)
 {
 }
Ejemplo n.º 24
0
 public QuestionnaireController(IServiceApi service)
 {
     _serviceApi = service;
 }
Ejemplo n.º 25
0
 private void DebugAutoLogin()
 {
     twitter = new RenmeiNet("*****@*****.**", RenmeiNet.ToSecureString("hbcjob"));
     //twitter = new RenmeiNet("*****@*****.**", RenmeiNet.ToSecureString("111111"));
     //twitter = new RenmeiNet("*****@*****.**", RenmeiNet.ToSecureString("woaini737727"));
     twitter.TwitterServerUrl = AppSettings.RenmeiHost;
     TryLogin(twitter);
 }
Ejemplo n.º 26
0
        private void DisplayLoginIfUserNotLoggedIn()
        {
            // Does the user need to login?
            //if (string.IsNullOrEmpty(AppSettings.UserName))
            if (App.LoggedInUser.Id == 0)
            {
                ShowLogin();
            }
            else
            {
                LoginLayoutRoot.Visibility = Visibility.Collapsed;

                System.Security.SecureString password = RenmeiNet.DecryptString(AppSettings.Password);

                // Jason Follas: Reworked Web Proxy - don't need to explicitly pass into TwitterNet ctor
                //twitter = new TwitterNet(AppSettings.Username, password, WebProxyHelper.GetConfiguredWebProxy());
                twitter = new RenmeiNet(AppSettings.UserName, password);

                // Jason Follas: Twitter proxy servers, anyone?  (Network Nazis who block twitter.com annoy me)
                twitter.TwitterServerUrl = AppSettings.RenmeiHost;

                //// Let the user know what's going on
                //StatusTextBlock.Text = Properties.Resources.TryLogin;
                //PlayStoryboard("Fetching");

                //// Create a Dispatcher to attempt login on new thread
                //NoArgDelegate loginFetcher = new NoArgDelegate(this.TryLogin);
                //loginFetcher.BeginInvoke(null, null);

                //Retrieve tweets
                //DelegateRecentFetch();

            }
        }
Ejemplo n.º 27
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            // TODO enable the two below control if login process failed.
            PasswordTextBox.IsEnabled = false;
            UserNameBox.IsEnabled = false;

            //HttpRequest htr = new HttpRequest(MainWindows.website);
            twitter = new RenmeiNet(UserNameBox.Text,RenmeiNet.ToSecureString(PasswordTextBox.Password));
            twitter.TwitterServerUrl = AppSettings.RenmeiHost;

            // 等待效果
            // 加一个等待循环的图片,然后现在enable可见

            // 用线程实现的效果比较好
            //# TryLogin(twitter);
            LoginButton.Dispatcher.BeginInvoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new LoginDelegate(TryLogin), twitter);
        }
Ejemplo n.º 28
0
 private void TryLogin(IServiceApi rmnet)
 {
     try
     {
         // Schedule the update function in the UI thread.
         LayoutRoot.Dispatcher.BeginInvoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             new PostLoginDelegate(UpdatePostLoginInterface), rmnet.Login());
     }
     catch (WebException ex)
     {
         App.Logger.Error("There was a problem logging in Renmei.",ex);
         MessageBox.Show("There was a problem logging in to Renmei. " + ex.Message);
     }
 }
 public MapWebHandler(IDevice device, IServiceApi serviceApi, IHttpClientConfiguration httpClientConfiguration)
 {
     this.device     = device;
     this.serviceApi = serviceApi;
     this.httpClientConfiguration = httpClientConfiguration;
 }
Ejemplo n.º 30
0
 public ContratoDigitalController(IHostingEnvironment hostingEnvironment, IConfiguration config, IServiceApi api)
 {
     _hostingEnvironment = hostingEnvironment;
     Config     = config;
     ApiService = api;
 }
 public DummyFilerWebHandler(IDevice device, IAccountService account, IOAuthUtils oAuth, IHttpClientConfiguration httpClientConfiguration, IServiceApi serviceApi)
     : base(device, account, oAuth, httpClientConfiguration, serviceApi)
 {
 }
Ejemplo n.º 32
0
        private void DisplayLoginIfUserNotLoggedIn()
        {
            // Does the user need to login?
            if (string.IsNullOrEmpty(AppSettings.Username))
            {
                PlayStoryboard("ShowLogin");
            }
            else
            {
                LoginControl.Visibility = Visibility.Hidden;

                System.Security.SecureString password = TwitterNet.DecryptString(AppSettings.Password);

                // Jason Follas: Reworked Web Proxy - don't need to explicitly pass into TwitterNet ctor
                //twitter = new TwitterNet(AppSettings.Username, password, WebProxyHelper.GetConfiguredWebProxy());
                twitter = new TwitterNet(AppSettings.Username, password);

                // Jason Follas: Twitter proxy servers, anyone?  (Network Nazis who block twitter.com annoy me)
                twitter.TwitterServerUrl = AppSettings.TwitterHost;

                // Let the user know what's going on
                StatusTextBlock.Text = Properties.Resources.TryLogin;
                PlayStoryboard("Fetching");

                // Create a Dispatcher to attempt login on new thread
                NoArgDelegate loginFetcher = new NoArgDelegate(this.TryLogin);
                loginFetcher.BeginInvoke(null, null);

            }
        }
        protected void LoadTagAlert()
        {
            using (AppDataContext db = new AppDataContext())
            {
                _tagAlert = db.TagAlerts.SingleOrDefault(t => t.AlertId == _id);

                if (_tagAlert == null)
                {
                    ShowMessagePage("报警事件不存在。");
                }
                else
                {
                    HostTag thisHostTag = HostTag.GetById(_tagAlert.HostId);
                    Tag     thisTag     = Tag.Select(thisHostTag.TagId);
                    if (thisTag != null)
                    {
                        tagName.Text = thisHostTag.HostName;
                        int coorid = _tagAlert.CoordinatesId;
                        if (CommonExtension.IsIlltreatTag(_tagAlert.HostId) && Config.Settings.ProjectType != ProjectTypeEnum.NMPrison)
                        {
                            coorid = CommonExtension.GetCoordinatesId(thisHostTag.Description.Substring(0, thisHostTag.Description.Length - 2));
                        }

                        if (Config.Settings.ProjectType == ProjectTypeEnum.NMPrison)
                        {
                            coordinatesName.Text = thisHostTag.HostName;
                        }
                        else
                        {
                            coordinatesName.Text = Coordinates.GetName(coorid);
                        }

                        if (LocatingServiceUtil.IsAvailable())
                        {
                            IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                            bool        boolean    = serviceApi.ClearTagStatus(thisTag.TagMac, (SupportEvent)_tagAlert.AlertType);
                        }

                        description.Text  = CommonExtension.GetEventDescription((SupportEvent)_tagAlert.AlertType, _tagAlert.HostId);
                        time.DisplayValue = _tagAlert.WriteTime;
                        if (_tagAlert.MasterUserId > 0)
                        {
                            alertMaster.Text = Data.User.Select(_tagAlert.MasterUserId) == null ? "未知" : Data.User.Select(_tagAlert.MasterUserId).UserName;
                        }

                        alertStatus.Text = NetRadio.Common.LocatingMonitor.Misc.GetAlertStatus((AlertStatusType)_tagAlert.AlertStatus);

                        list.DataSource   = db.AlertProcessLogs.Where(t => t.AlertId == _id).OrderBy(t => t.UpdateTime).ToList();
                        list.ItemCreated += new RepeaterItemEventHandler(list_ItemCreated);
                        list.DataBind();

                        if (!IsPostBack)
                        {
                            Dictionary <string, int> alertResults = new Dictionary <string, int>();
                            alertResults.Add(CommonExtension.GetEventDescription((SupportEvent)_tagAlert.AlertType, _tagAlert.HostId), 1);
                            alertResults.Add("误报", 2);
                            alertResults.Add("其它", 3);

                            foreach (var item in alertResults)
                            {
                                ListItem listitem = new ListItem(item.Key, item.Value.ToString());

                                if (item.Value == 1)
                                {
                                    listitem.Selected = true;
                                }

                                alertResultList.Items.Add(listitem);
                            }
                        }

                        if (_tagAlert.AlertStatus == (byte)AlertStatusType.New || _tagAlert.AlertStatus == (byte)AlertStatusType.Processing)
                        {
                            alertResultList.Visible = true;
                            alertResult.Visible     = false;
                            handover.Visible        = true;
                            alertProcess.Visible    = true;
                            otherReason.Visible     = true;
                        }
                        else
                        {
                            alertResultList.Visible = false;
                            alertResult.Visible     = true;
                            handover.Visible        = false;
                            alertProcess.Visible    = false;
                            otherReason.Visible     = false;

                            AlertProcessLog alertProcessLog = db.AlertProcessLogs.SingleOrDefault(t => t.AlertId == _id && t.AlertStatus == (byte)AlertStatusType.Resolved);

                            if (alertProcessLog != null)
                            {
                                alertResult.Text = alertProcessLog.ChangeReason;
                            }
                        }
                    }
                }
            }
        }
        private string CreateOutputContent()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<?xml version=\"1.0\" standalone=\"yes\" ?>");
            sb.AppendLine("<tagCoordinates>");

            if (!LocatingServiceUtil.IsAvailable())
            {
                sb.AppendLine("</tagCoordinates>");
                return(sb.ToString());
            }

            IServiceApi   serviceApi    = LocatingServiceUtil.Instance <IServiceApi>();
            TagStatusView tagStatusView = new TagStatusView();

            if (_tagId > 0)
            {
                tagStatusView = serviceApi.SelectTagStatus(_tagId);

                if (tagStatusView != null && _mapId > 0 && tagStatusView.TagId > 0)
                {
                    _mapId = tagStatusView.MapId;
                }

                if (tagStatusView.WorkingStatus != TagWorkingStatus.Locating)
                {
                    _tagId = 0;
                    _mapId = Fetch.QueryUrlAsIntegerOrDefault("mapId", -1);
                }
            }
            int totalCount = 0;
            IList <TagStatusView> tagList = new List <TagStatusView>();

            if (_hostGroupArray == null || _hostGroupArray.Length == 0)
            {
                _hostGroupArray = new int[] { 1, 2 };
            }

            if (_keyword.Length > 0 && !_keyword.Contains(','))
            {
                _mapId  = 0;
                tagList = serviceApi.SelectTagStatusListByKeywords(
                    _keyword,
                    _hostGroupArray,
                    _mapId,
                    true,
                    _eventTypes.Contains((int)SupportEvent.Absent),
                    _eventTypes.Contains((int)SupportEvent.BatteryInsufficient),
                    _eventTypes.Contains((int)SupportEvent.AreaEvent),
                    _eventTypes.Contains((int)SupportEvent.ButtonPressed),
                    _eventTypes.Contains((int)SupportEvent.WristletBroken),
                    "Position",
                    SortDirection.Ascending,
                    _pageSize,
                    _pageSize * (_currentPage - 1),
                    out totalCount
                    ).ToList();
                tagList = tagList.Where(x => x.X > 0 && !x.HostTag.HostGroupId.Contains((int)TagUserType.Position)).OrderBy(x => x.X).ToList();
                //totalCount = tagList.Count;
            }
            else
            {
                tagList = serviceApi.SelectTagStatusList(
                    _keyword,
                    _hostGroupArray,
                    _mapId,
                    true,
                    _eventTypes.Contains((int)SupportEvent.Absent),
                    _eventTypes.Contains((int)SupportEvent.BatteryInsufficient),
                    _eventTypes.Contains((int)SupportEvent.AreaEvent),
                    _eventTypes.Contains((int)SupportEvent.ButtonPressed),
                    _eventTypes.Contains((int)SupportEvent.WristletBroken),
                    "Position",
                    SortDirection.Ascending,
                    _pageSize,
                    _pageSize * (_currentPage - 1),
                    out totalCount
                    ).ToList();
                tagList = tagList.Where(x => x.X > 0).OrderBy(x => x.X).ToList();
                //totalCount = tagList.Count;
            }

            int tracingItemIndex = -1;

            if (tagStatusView != null && _tagId > 0)
            {
                for (int i = 0; i < tagList.Count(); i++)
                {
                    if (tagList[i].Mac == tagStatusView.Mac)
                    {
                        tracingItemIndex = i;
                    }
                }
            }

            //IList<TagStatusView> tagStatusList = tagList.ToList();
            if (tracingItemIndex != 0 && _tagId > 0)
            {
                if (tracingItemIndex > 0)
                {
                    tagList.RemoveAt(tracingItemIndex);
                }
                tagList.Insert(0, tagStatusView);
            }

            sb.AppendLine("<pagination>");
            sb.AppendFormat("<recordCount>{0}</recordCount>\r\n", totalCount);
            sb.AppendFormat("<pageSize>{0}</pageSize>\r\n", _pageSize);
            sb.AppendFormat("<currentPage>{0}</currentPage>\r\n", _currentPage);
            sb.AppendLine("</pagination>");

            var coordinatesFormat = "<coordinates id=\"{0}\" mapId=\"{1}\" mapName=\"{2}\" coordinatesName=\"{3}\" x=\"{4}\" y=\"{5}\">";
            var tagFormat         = "<tag id=\"{0}\" tagName=\"{1}\" warningTypes=\"{2}\" warningLevel=\"{3}\" moveSpeed=\"{4}\" icon=\"{5}\" updateTime=\"{6}\"  groupIds=\"{7}\" />";

            foreach (var item in tagList)
            {
                if (_coordinatesId != item.CoordinatesId)
                {
                    if (_coordinatesId >= 0)
                    {
                        sb.AppendLine("</coordinates>");
                    }
                    sb.AppendFormat(coordinatesFormat, item.CoordinatesId, item.MapId, Facility.GetNameByMapId(item.MapId), item.CoordinatesName, item.X, item.Y);
                    _coordinatesId = item.CoordinatesId;
                }

                List <string> warningTypes = new List <string>();
                if (item.AreaEventStatus == EventStatus.Occurring)
                {
                    warningTypes.Add(((int)SupportEvent.AreaEvent).ToString());
                }
                if (item.AbsenceStatus == EventStatus.Occurring)
                {
                    warningTypes.Add(((int)SupportEvent.Absent).ToString());
                }
                if (item.BatteryInsufficientStatus == EventStatus.Occurring)
                {
                    warningTypes.Add(((int)SupportEvent.BatteryInsufficient).ToString());
                }
                if (item.BatteryResetStatus == EventStatus.Occurring)
                {
                    warningTypes.Add(((int)SupportEvent.BatteryReset).ToString());
                }
                if (item.ButtonPressedStatus == EventStatus.Occurring)
                {
                    warningTypes.Add(((int)SupportEvent.ButtonPressed).ToString());
                }
                if (item.WristletBrokenStatus == EventStatus.Occurring)
                {
                    warningTypes.Add(((int)SupportEvent.WristletBroken).ToString());
                }

                string hostGroupIds = "";
                if (item.HostTag.HostGroupId.Length > 0)
                {
                    foreach (int gId in item.HostTag.HostGroupId)
                    {
                        if (gId > 0)
                        {
                            if (hostGroupIds == "")
                            {
                                hostGroupIds += gId.ToString();
                            }
                            else
                            {
                                hostGroupIds += "," + gId.ToString();
                            }
                        }
                    }
                }
                string hostName = item.HostTag.HostName;
                if (hostName == "")
                {
                    hostName = item.TagName;
                }
                sb.AppendFormat(tagFormat, item.TagId, hostName, string.Join(",", warningTypes.ToArray()), warningTypes.ToArray().Length > 0 ? "3" : "1", "2", CommonExtension.IdentityIconByGroupId(item.HostTag.HostGroupId), item.PositionUpdateTime.ToString("yyyy/M/d H:mm:ss").Replace('-', '/'),
                                hostGroupIds /*item.HostTag.HostGroupId.Contains(1) ? 1 : 2*/);
            }

            if (_coordinatesId >= 0)
            {
                sb.AppendLine("</coordinates>");
            }

            sb.AppendLine("</tagCoordinates>");
            return(sb.ToString());
        }
Ejemplo n.º 35
0
        private void LoginControl_Login(object sender, RoutedEventArgs e)
        {
            // Jason Follas: Reworked Web Proxy - don't need to explicitly pass into TwitterNet ctor
            //twitter = new TwitterNet(AppSettings.Username, TwitterNet.DecryptString(AppSettings.Password), WebProxyHelper.GetConfiguredWebProxy());
            twitter = new TwitterNet(AppSettings.Username, TwitterNet.DecryptString(AppSettings.Password));

            // Jason Follas: Twitter proxy servers, anyone?  (Network Nazis who block twitter.com annoy me)
            twitter.TwitterServerUrl = AppSettings.TwitterHost;

            // fetch new tweets
            DelegateRecentFetch();

            // Setup refresh timer to get subsequent tweets
            refreshTimer.Interval = refreshInterval;
            refreshTimer.Tick += new EventHandler(Timer_Elapsed);
            refreshTimer.Start();

            // Setup friendslist timer for AutoSuggestPattern matching support
            SetupFriendsListTimer();

            PlayStoryboard("HideLogin");

            isExpanded = false;
            isLoggedIn = true;
            OptionsButton.IsEnabled = true;
            FilterToggleButton.IsEnabled = true;
            Filter.IsEnabled = true;
        }
        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);
            }
        }
Ejemplo n.º 37
0
        public static object GetData(int alertID)
        {
            string id_name     = "";
            string id_position = "";
            string id_type     = "";
            string id_time     = "";
            string id_table    = "";

            NameID[] id_selectResult = null;

            using (AppDataContext db = new AppDataContext())
            {
                TagAlert _tagAlert = db.TagAlerts.SingleOrDefault(t => t.AlertId == alertID);

                if (_tagAlert == null)
                {
                    throw new Exception("报警事件不存在!");
                }
                else
                {
                    HostTag thisHostTag = HostTag.GetById(_tagAlert.HostId);
                    Tag     thisTag     = Tag.Select(thisHostTag.TagId);
                    if (thisTag != null)
                    {
                        if (CommonExtension.IsIlltreatTag(_tagAlert.HostId))
                        {
                            if (Config.Settings.ProjectType == ProjectTypeEnum.NMPrison)
                            {
                                id_position = thisHostTag.HostName;
                            }
                            else
                            {
                                int coorid = CommonExtension.GetCoordinatesId(thisHostTag.Description.Substring(0, thisHostTag.Description.Length - 2));
                                id_position = Coordinates.GetName(coorid);
                            }
                        }
                        else
                        {
                            id_position = Coordinates.GetName(_tagAlert.CoordinatesId);
                        }


                        //if (Config.Settings.ProjectType == ProjectTypeEnum.NMPrison)
                        //{
                        //    id_position = thisHostTag.HostName;
                        //}
                        //else
                        //{

                        //    int coorid = CommonExtension.GetCoordinatesId(thisHostTag.Description.Substring(0, thisHostTag.Description.Length - 2));
                        //    id_position = Coordinates.GetName(coorid);

                        //}

                        if (LocatingServiceUtil.IsAvailable())
                        {
                            IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                            bool        boolean    = serviceApi.ClearTagStatus(thisTag.TagMac, (SupportEvent)_tagAlert.AlertType);
                        }

                        id_name = thisHostTag.HostName;
                        //id_position = Coordinates.GetName(coorid);
                        id_type = CommonExtension.GetEventDescription((SupportEvent)_tagAlert.AlertType, _tagAlert.HostId);
                        id_time = _tagAlert.WriteTime.ToString("yyyy/MM/dd HH:mm:ss");

                        id_selectResult = db.ProcessResults.Select(_d => new NameID {
                            ID = _d.ID, Name = _d.Text
                        }).ToArray();

                        id_table = GetProcessTable(alertID);


                        return(new
                        {
                            id_name,
                            id_position,
                            id_type,
                            id_time,
                            id_table,
                            id_selectResult
                        });
                    }
                }
            }



            return("");
        }
Ejemplo n.º 38
0
        private string CreateOutputContent()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<?xml version=\"1.0\" standalone=\"yes\" ?>");
            sb.AppendLine("<areaList>");

            if (_mapId > 0)
            {
                var list   = this.SelectItemList();
                var format = "	<area id=\"{0}\" name=\"{1}\" coordinatesArray=\"{2}\" quota=\"{3}\" currentCount=\"{4}\" mapId=\"{5}\" />";
                foreach (var a in list)
                {
                    try
                    {
                        if (a.LinkedMapId > 0)
                        {
                            IList <TagStatusView> tagList = new List <TagStatusView>();
                            string _keyword        = "";
                            int[]  _hostGroupArray = new int[2] {
                                1, 2
                            };                                          //2010-11-bydyp
                            int totalCount = 0;

                            IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                            if (serviceApi != null)
                            {
                                TagStatusView tagStatusView = new TagStatusView();
                                tagList = serviceApi.SelectTagStatusList(
                                    _keyword,
                                    _hostGroupArray,
                                    a.LinkedMapId,
                                    true,
                                    false, //SupportEvent.Absent),
                                    false, //SupportEvent.BatteryInsufficient),
                                    false, //SupportEvent.AreaEvent),
                                    false, //SupportEvent.ButtonPressed),
                                    false, //SupportEvent.WristletBroken),
                                    "",
                                    SortDirection.Ascending,
                                    0,//only get total count
                                    0,
                                    out totalCount);

                                sb.AppendFormat(format, a.Id, a.AreaName, a.CoordinatesArray, 0, totalCount, a.LinkedMapId);
                                sb.AppendLine();
                            }
                        }
                        else
                        {
                            int quota = 0;

                            try
                            {
                                quota = CulpritRoomReference.All.Count(x => x.JailRoomId == a.Id);
                            }
                            catch { }

                            int currentCount = 0;
                            var coordinates  = MapAreaCoverage.All.Where(x => x.AreaId == a.Id).Select(x => x.CoordinatesId).ToArray();

                            foreach (var item in FullTagStatusView)
                            {
                                if (coordinates.Contains(item.CoordinatesId) &&

                                    item.AbsenceStatus != EventStatus.Occurring &&
                                    item.X > 0)
                                {
                                    currentCount++;
                                }
                            }

                            sb.AppendFormat(format, a.Id, a.AreaName, a.CoordinatesArray, quota, currentCount, -1);
                            sb.AppendLine();
                        }
                    }
                    catch
                    {
                    }
                }
            }

            sb.AppendLine("</areaList>");
            return(sb.ToString());
        }
Ejemplo n.º 39
0
        private void LoadRepeater(string p_keyword, string p_extandId, int p_jailRoomSelectedIndex, string p_jailRoomSelectedValue, string tagBindingSelectedValue, string tagOnlineSelectedValue)
        {
            // var query = HostTagGroupStatus.All().Where(u => u.HostGroupId == (byte)_userType);

            using (AppDataContext db = new AppDataContext())
            {
                var query = db.HostPositionStatusViews.ToList().Where(u => u.HostGroupId == (byte)_userType);

                if (!string.IsNullOrEmpty(p_keyword.Trim()))
                {
                    query = query.Where(u => u.HostName.ToUpper().Contains(p_keyword.Trim().ToUpper()));
                }

                if (!string.IsNullOrEmpty(p_extandId.Trim()))
                {
                    query = query.Where(u => u.HostExternalId.ToUpper().Contains(p_extandId.Trim().ToUpper()));
                }

                if (tagBindingSelectedValue == "1")
                {
                    query = query.Where(u => u.TagId != 0);
                }
                if (tagBindingSelectedValue == "2")
                {
                    query = query.Where(u => u.TagId == 0);
                }

                if (tagOnlineSelectedValue == "1")
                {
                    IList <TagStatusView> tagList = new List <TagStatusView>();
                    string _keyword        = "";
                    int[]  _hostGroupArray = null;
                    int    totalCount      = 0;
                    if (LocatingServiceUtil.IsAvailable())
                    {
                        IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                        if (serviceApi != null)
                        {
                            tagList = serviceApi.SelectTagStatusList(
                                _keyword,
                                _hostGroupArray,
                                0,
                                true,
                                false, //SupportEvent.Absent),
                                false, //SupportEvent.BatteryInsufficient),
                                false, //SupportEvent.AreaEvent),
                                false, //SupportEvent.ButtonPressed),
                                false, //SupportEvent.WristletBroken),
                                "",
                                SortDirection.Ascending,
                                9999,
                                0,
                                out totalCount);
                        }
                    }

                    query = query.Where(u => tagList.Where(t => t.X > 0).Select(t => t.TagId).ToList().Contains(u.TagId));
                }

                if (tagOnlineSelectedValue == "2")
                {
                    IList <TagStatusView> tagList = new List <TagStatusView>();
                    string _keyword        = "";
                    int[]  _hostGroupArray = null;
                    int    totalCount      = 0;
                    if (LocatingServiceUtil.IsAvailable())
                    {
                        IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>();
                        if (serviceApi != null)
                        {
                            tagList = serviceApi.SelectTagStatusList(
                                _keyword,
                                _hostGroupArray,
                                0,
                                true,
                                false, //SupportEvent.Absent),
                                false, //SupportEvent.BatteryInsufficient),
                                false, //SupportEvent.AreaEvent),
                                false, //SupportEvent.ButtonPressed),
                                false, //SupportEvent.WristletBroken),
                                "",
                                SortDirection.Ascending,
                                9999,
                                0,
                                out totalCount);
                        }
                    }

                    query = query.Where(u => !tagList.Where(t => t.X > 0).Select(t => t.TagId).ToList().Contains(u.TagId));
                }

                if (_userType == TagUserType.Culprit && p_jailRoomSelectedIndex > 0)
                {
                    int[] range = CulpritRoomReference.GetCulpritIdByRoomId(int.Parse(p_jailRoomSelectedValue));
                    query = query.Where(u => range.Contains(u.HostId));
                }

                p.RecordCount = query.Count();

                //if (_sortDir == SortDirection.Ascending)
                //{
                //    query = query.OrderBy(u => u.HostName);
                //}
                //else
                //{
                //    query = query.OrderByDescending(u => u.HostName);
                //}
                list.DataSource = query.Skip(p.RecordOffset).Take(p.PageSize).ToList();
                list.DataBind();
            }
        }
Ejemplo n.º 40
0
 public SportsViewModel(IMvxNavigationService navigationService, IMvxWebBrowserTask browser, IServiceApi serviceApi)
 {
     this.NavigationService = navigationService;
     this.browser           = browser;
     this.serviceApi        = serviceApi;
 }