Esempio n. 1
0
        internal void ShowAppData(App app)
        {
            var displayName = app.AppName;
            var workspace   =
                this.Workspaces.FirstOrDefault(vm =>
            {
                var item = vm as AppDataViewModel;
                if (item != null && item.DisplayName == displayName)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
                                               ) as AppDataViewModel;


            if (workspace == null)
            {
                workspace = new AppDataViewModel(app);
                this.Workspaces.Add(workspace);
            }

            this.SetActiveWorkspace(workspace);
        }
Esempio n. 2
0
        void HandleAppData()
        {
            var workspace = new AppDataViewModel();

            workspace.DisplayName = "测点数据";
            this.Workspaces.Add(workspace);
            this.SetActiveWorkspace(workspace);
        }
Esempio n. 3
0
        // GET: Dashboard
        public ActionResult Index()
        {
            AppDataViewModel adv = new AppDataViewModel();

            // Get the list of devices and subscriptions attached to this user
            var user = dbContext.Users.Where(u => u.NormalizedUserName == HttpContext.User.Identity.Name).FirstOrDefault();

            if (user != null)
            {
                var devicesForUser = dbContext.UsersToDevices.Where(u => u.UserId == user.Id);
                if (devicesForUser.Count() > 0)
                {
                    var deviceIds = devicesForUser.Where(u => u.Relationship == Models.Relationships.UserToDeviceRelationship.Owner).Select(d => d.DeviceId);
                    adv.OwnedDevices = dbContext.Device.Where(d => deviceIds.Contains(d.Id));
                }
            }
            else
            {
                // TODO: error out - alert user they aren't in the db (for some reason!?)
                return(StatusCode(404, "Could not find current user."));
            }

            return(View(adv));
        }