Beispiel #1
0
 public void VirtualDelete(long idDashboard, Boolean delete, DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin, OrderSettingsBy orderBy, Boolean ascending)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleDashboard.ActionType action = (delete) ? ModuleDashboard.ActionType.DashboardSettingsVirtualDelete : ModuleDashboard.ActionType.DashboardSettingsVirtualUndelete;
         try
         {
             DashboardSettings item = Service.DashboardSettingsVirtualDelete(idDashboard, delete);
             if (item == null)
             {
                 action = (delete) ? ModuleDashboard.ActionType.DashboardSettingsUnableToVirtualDelete : ModuleDashboard.ActionType.DashboardSettingsUnableToUndelete;
             }
             View.DisplayMessage(action);
             View.SendUserAction(idCommunity, CurrentIdModule, idDashboard, action);
         }
         catch (DashboardException ex)
         {
             action = (delete) ? ModuleDashboard.ActionType.DashboardSettingsUnableToVirtualDelete : ModuleDashboard.ActionType.DashboardSettingsUnableToUndelete;
             View.SendUserAction(idCommunity, CurrentIdModule, idDashboard, action);
             View.DisplayMessage(ex.ErrorType);
         }
         LoadSettings(type, idCommunity, loadFromRecycleBin, orderBy, ascending);
     }
 }
        public void InitView(ModuleDashboard permissions, DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin, long idTile = 0, TileType preloadType = TileType.None)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdTilesCommunity = idCommunity;
                //dtoFilters filters = new dtoFilters() { DashboardType = type, IdCommunity = idCommunity, IdSelectedLanguage=-1, FromRecycleBin = loadFromRecycleBin };
                //if (!loadFromRecycleBin && preloadType != TileType.None)
                //    filters.IdTileType = (long)preloadType;
                Dictionary <searchFilterType, long> defaultValues = (from searchFilterType n in Enum.GetValues(typeof(searchFilterType)).AsQueryable() where n != searchFilterType.none select n).ToDictionary(t => t, t => (long)-1);
                if (!loadFromRecycleBin && preloadType != TileType.None)
                {
                    defaultValues[searchFilterType.type] = (long)preloadType;
                }

                List <lm.Comol.Core.DomainModel.Filters.Filter> filters = Service.GetDefaultFilters(type, p.Id, idCommunity, -1, idCommunity, loadFromRecycleBin, defaultValues).OrderBy(f => f.DisplayOrder).ToList();
                View.LoadDefaultFilters(filters);
                InitializeView(permissions, new dtoFilters(type, idCommunity, loadFromRecycleBin, filters), idCommunity, idTile);
            }
        }
Beispiel #3
0
        public void InitView(DashboardType type, Boolean loadFromRecycleBin, Int32 idCommunity, long idDashboard = 0, WizardDashboardStep step = WizardDashboardStep.None)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                ModuleDashboard permissions = ModuleDashboard.CreatePortalmodule(p.TypeID);
                if (type == DashboardType.Community)
                {
                    View.IdContainerCommunity = UserContext.CurrentCommunityID;
                    if (idCommunity < 0)
                    {
                        idCommunity = UserContext.CurrentCommunityID;
                    }
                    if (idCommunity > 0 && (!permissions.Administration && !permissions.ManageTiles))
                    {
                        permissions = Service.GetPermission(idCommunity);
                    }
                }
                else
                {
                    idCommunity = 0;
                    View.IdContainerCommunity = 0;
                }
                View.IdTilesCommunity = idCommunity;
                SetBackUrl(type, idDashboard, step);
                if (permissions.ManageTiles)
                {
                    if (loadFromRecycleBin)
                    {
                        View.SetBackUrl(RootObject.TileList(type, false, idCommunity));
                    }
                    else
                    {
                        View.SetRecycleUrl(RootObject.TileList(type, true, idCommunity));
                        View.SetAddUrl(RootObject.TileAdd(type, idCommunity));
                        View.AllowCommunityTypesTileAutoGenerate = (Service.GetCommunityTypesWithoutTilesCount() > 0);
                    }
                    TileType preloadType = TileType.None;
                    if (idDashboard > 0)
                    {
                        switch (step)
                        {
                        case WizardDashboardStep.CommunityTypes:
                            preloadType = TileType.CommunityType;
                            break;
                        }
                    }
                    View.InitializeListControl(permissions, type, idCommunity, loadFromRecycleBin, View.PreloadIdTile, preloadType);
                }
                else
                {
                    View.DisplayNoPermission(idCommunity, CurrentIdModule);
                }
            }
        }
Beispiel #4
0
        public void SetStatus(long idDashboard, AvailableStatus status, DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin, OrderSettingsBy orderBy, Boolean ascending)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                ModuleDashboard.ActionType action = (status == AvailableStatus.Available) ? ModuleDashboard.ActionType.DashboardSettingsEnable : ModuleDashboard.ActionType.DashboardSettingsDisable;
                try
                {
                    DashboardSettings item = Service.DashboardSettingsSetStatus(idDashboard, status);
                    if (item == null || item.Status != status)
                    {
                        action = (status == AvailableStatus.Available) ? ModuleDashboard.ActionType.DashboardSettingsUnableToEnable : ModuleDashboard.ActionType.DashboardSettingsUnableToDisable;
                    }
                    View.DisplayMessage(action);
                    View.SendUserAction(idCommunity, CurrentIdModule, idDashboard, action);
                }
                catch (DashboardException ex) {
                    action = (status == AvailableStatus.Available) ? ModuleDashboard.ActionType.DashboardSettingsUnableToEnable : ModuleDashboard.ActionType.DashboardSettingsUnableToDisable;
                    View.SendUserAction(idCommunity, CurrentIdModule, idDashboard, action);
                    View.DisplayMessage(ex.ErrorType);
                }

                LoadSettings(type, idCommunity, loadFromRecycleBin, orderBy, ascending);
            }
        }
Beispiel #5
0
        public static String TileList(DashboardType type, Boolean loadfromRecycleBin = false, Int32 idCommunity = -1, long idTile = 0, long fromIdDashboard = 0, WizardDashboardStep step = WizardDashboardStep.None)
        {
            String url = tilemodulehome;

            if (loadfromRecycleBin)
            {
                url = url + "RecycleBin.aspx?recycle=true";
            }
            else
            {
                url = url + "List.aspx?recycle=false";
            }
            url = url + (idCommunity > 0 ? "&idCommunity=" + idCommunity.ToString() : "");
            url = url + "&type=" + type.ToString();
            if (fromIdDashboard > 0)
            {
                url = url + "&fromIdDashboard=" + fromIdDashboard.ToString() + ((step == WizardDashboardStep.None) ? "" : "&step=" + step.ToString());
            }
            if (idTile > 0)
            {
                url = url + "&idTile=" + idTile.ToString() + "#tile" + idTile.ToString();
            }

            return(url);
        }
        private async Task <dynamic> CompareGraph(dynamic parameters, CancellationToken ct)
        {
            this.RequiresAuthentication();
            var locations = await DataConnection.Ask(x => x.GetLocationsForPersonAsync(CurrentUserGuid()));

            var items = new DashboardType(
                new List <Tuple <Location, IEnumerable <string>, List <Tuple <Sensor, IEnumerable <string> > > > >(),
                CurrentUserGuid().ToString());

            foreach (var location in locations)
            {
                var sensors = await DataConnection.Ask(x => x.GetSensorsAtLocationAsync(location));

                var taggedSensors = new List <Tuple <Sensor, IEnumerable <string> > >();

                foreach (var sensor in sensors)
                {
                    taggedSensors.Add(new Tuple <Sensor, IEnumerable <string> >(sensor, await DataConnection.Ask(x => x.GetSensorTagsAsync(sensor.Id))));
                }

                IEnumerable <string> tags = await DataConnection.Ask(x => x.GetTagsAtLocationAsync(location));

                items.Item1.Add(new Tuple <Location, IEnumerable <string>, List <Tuple <Sensor, IEnumerable <string> > > >(location, tags, taggedSensors));
            }

            return(View["compare-graph.cshtml", items]);
        }
Beispiel #7
0
        public async Task <List <Dashpost> > RequestList(DashboardType type)
        {
            var    temp      = new List <Dashpost>();
            var    objClient = new HttpClient();
            Uri    uri       = null;
            string strResponse;

            if (type == DashboardType.LOST)
            {
                uri = new Uri("http://localhost:8080/dashboards/lost/");
            }
            else if (type == DashboardType.FOUND)
            {
                uri = new Uri("http://localhost:8080/dashboards/found/");
            }

            try
            {
                HttpResponseMessage response = await objClient.GetAsync(uri);

                response.EnsureSuccessStatusCode();

                strResponse = await response.Content.ReadAsStringAsync();

                temp = json2List.parseJArray2List(JsonArray.Parse(strResponse));
            }
            catch (HttpRequestException exception)
            {
                Debug.WriteLine("DESCRIPTION: " + exception.Message + " STATUS CODE: " + exception.HResult);
            }

            return(temp);
        }
Beispiel #8
0
        /// <summary>
        /// Creates a new dashboard based on the user.
        ///
        /// NOTE
        /// THIS METHOD USES UNIT OF WORK
        /// </summary>
        public Dashboard AddDashboard(string userId = "-1", DashboardType dashType = DashboardType.Private)
        {
            uowManager = new UnitOfWorkManager();
            InitRepo();

            //Create dashboard
            Dashboard dashboard = new Dashboard()
            {
                DashboardType = dashType,
                Widgets       = new List <UserWidget>(),
            };

            //Get user
            if (!userId.Equals("-1"))
            {
                UserManager userManager = new UserManager(uowManager);
                User        user        = userManager.GetUser(userId);

                if (user == null)
                {
                    return(null);
                }
                else
                {
                    dashboard.User = user;
                }
            }

            //Create database
            widgetRepo.CreateDashboard(dashboard);
            uowManager.Save();
            uowManager = null;
            return(dashboard);
        }
Beispiel #9
0
        private void LoadSettings(ModuleDashboard permissions, DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin, OrderSettingsBy orderBy = OrderSettingsBy.Default, Boolean ascending = true)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                List <dtoDashboardSettings> items = Service.DashboardGetSettings(permissions, type, View.GetUnknownUserName(), View.GetTranslatedStatus(), idCommunity, loadFromRecycleBin, orderBy, ascending);
                if (items == null)
                {
                    View.DisplayErrorLoadingFromDB();
                }
                else
                {
                    //if (items.Count == 1)
                    //    items[0].Permissions.AllowSetUnavailable = items[0].Permissions.AllowSetUnavailable && !(items[0].Active && items[0].ForAll);
                    //else if (items.Where())
                    ModuleDashboard.ActionType action = ModuleDashboard.ActionType.DashboardSettingsPortalList;
                    switch (type)
                    {
                    case DashboardType.AllCommunities:
                        action = ModuleDashboard.ActionType.DashboardSettingsAllCommunitiesList;
                        break;

                    case DashboardType.Community:
                        action = ModuleDashboard.ActionType.DashboardSettingsCommunityList;
                        break;
                    }
                    View.LoadSettings(items);
                    View.SendUserAction(idCommunity, CurrentIdModule, action);
                }
            }
        }
Beispiel #10
0
        public static String DashboardUrl(long idDashboard, DashboardType type, Int32 idCommunity = -1)
        {
            String url = "type=" + type.ToString();

            url = url + (idCommunity > 0 ? "&idCommunity=" + idCommunity.ToString() : "");
            url = url + (idDashboard > 0 ? "&idDashboard=" + idDashboard.ToString() : "");
            return(url);
        }
Beispiel #11
0
        public void InitView(long idDashboard, DashboardType dashboardType, Int32 idContainerCommunity)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            View.IdDashboard = idDashboard;
            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                liteDashboardSettings settings = CurrentManager.Get <liteDashboardSettings>(idDashboard);
                Int32 idDashboardCommunity     = (settings == null) ? ((dashboardType == DashboardType.Community) ? idContainerCommunity : 0) : settings.IdCommunity;
                List <lm.Comol.Core.Wizard.dtoNavigableWizardItem <dtoDashboardStep> > steps = Service.GetAvailableSteps(WizardDashboardStep.HomepageSettings, idDashboard, (settings == null) ? dashboardType :settings.Type, idDashboardCommunity);
                View.LoadWizardSteps(steps);

                if (settings == null)
                {
                    View.DisplayUnknownDashboard();
                    if (dashboardType == DashboardType.Community)
                    {
                        if (idContainerCommunity < 0)
                        {
                            idDashboardCommunity = UserContext.CurrentCommunityID;
                        }
                    }
                    else
                    {
                        idDashboardCommunity = 0;
                    }
                    View.IdContainerCommunity = idDashboardCommunity;
                }
                else
                {
                    View.IdContainerCommunity = idDashboardCommunity;
                    ModuleDashboard permissions = (dashboardType == DashboardType.Community) ? Service.GetPermission(idDashboardCommunity) : ModuleDashboard.CreatePortalmodule(p.TypeID);
                    if (permissions.Edit || permissions.Administration)
                    {
                        View.SetBackUrl(RootObject.DashboardList(dashboardType, false, idContainerCommunity));
                    }
                    if (settings.Deleted != BaseStatusDeleted.None)
                    {
                        View.DisplayDeletedDashboard();
                    }
                    else if (permissions.Edit || permissions.Administration)
                    {
                        View.AllowSave = (settings.Deleted == BaseStatusDeleted.None);
                        View.SetPreviewUrl(RootObject.DashboardPreview(settings.Id, settings.Type, settings.IdCommunity));
                        View.LoadSettings(new dtoViewSettings(settings));
                        View.SendUserAction(idContainerCommunity, Service.ServiceModuleID(), settings.Id, ModuleDashboard.ActionType.DashboardSettingsViewsStartEditing);
                    }
                    else
                    {
                        View.DisplayNoPermission(idContainerCommunity, CurrentIdModule);
                    }
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Gets the users 'Dashboard' aka 'Stream'
        /// </summary>
        /// <param name="type">The filtered type</param>
        /// <param name="tracksOnly"></param>
        /// <param name="startIndex">The index to begin from</param>
        /// <param name="length">The length of how many items to retrive</param>
        /// <returns></returns>
        public static List <int> GetNextDashboard(DashboardType type = DashboardType.All, bool tracksOnly = true)
        {
            // Buffer for returned activity
            List <int> list = new List <int>();

            // Check if there is more to get
            if (_dashboardHref == "stop")
            {
                return(list);
            }

            // Set url variable
            string url = "";

            if (_dashboardHref != null)
            {
                url = _dashboardHref;
            }
            else
            {
                // Switch for what dashboard to get
                switch (type)
                {
                default:
                case DashboardType.All:
                    url = "me/activities";
                    break;

                case DashboardType.Affiliated:
                    url = "me/activities/tracks/affiliated";
                    break;

                case DashboardType.Exclusive:
                    url = "me/activities/tracks/exclusive";
                    break;

                case DashboardType.Own:
                    url = "me/activities/all/own";
                    break;
                }
                url += SoundCloudCore.Pagination;
            }

            // Get Response
            var res = SoundCloudCore.SendRequest <Dictionary <string, dynamic> >(url);

            _dashboardHref = res.ContainsKey("next_href") ? res["next_href"] : "stop";

            foreach (var dict in res["collection"])
            {
                if (tracksOnly && dict["type"].Value.Contains("track"))
                {
                    list.Add(JsonConvert.DeserializeObject <Track>(dict["origin"].ToString()).ID);
                    System.IO.File.AppendAllText("log.log", dict["origin"].ToString());
                }
            }
            return(list);
        }
Beispiel #13
0
        public static List <Dashboard> get_dashboards(Guid applicationId, Guid?userId, Guid?nodeTypeId, Guid?nodeId,
                                                      string nodeAdditionalId, DashboardType dashboardType, DashboardSubType subType, string subTypeTitle, bool?done,
                                                      DateTime?dateFrom, DateTime?dateTo, string searchText, int?lowerBoundary, int?count)
        {
            long totalCount = 0;

            return(get_dashboards(applicationId, userId, nodeTypeId, nodeId, nodeAdditionalId, dashboardType, subType,
                                  subTypeTitle, done, dateFrom, dateTo, searchText, lowerBoundary, count, ref totalCount));
        }
Beispiel #14
0
        public static List <Guid> get_dashboards(Guid applicationId, Guid?userId, Guid?nodeTypeId, Guid?nodeId,
                                                 DashboardType dashboardType, DashboardSubType subType, string subTypeTitle, string searchText, bool?inWorkFlowState,
                                                 int?lowerBoundary, int?count, ref long totalCount)
        {
            List <Dashboard> retList = new List <Dashboard>();

            return(DataProvider.GetDashboards(applicationId, ref retList, userId, nodeTypeId, nodeId, null,
                                              dashboardType, subType, subTypeTitle, null, null, null, searchText, true, inWorkFlowState, lowerBoundary, count, ref totalCount));
        }
Beispiel #15
0
        public static String TileUrl(long idTile, DashboardType type, Int32 idCommunity = -1, long fromIdDashboard = 0, WizardDashboardStep step = WizardDashboardStep.None)
        {
            String url = "type=" + type.ToString();

            url = url + (idCommunity > 0 ? "&idCommunity=" + idCommunity.ToString() : "");
            url = url + (fromIdDashboard > 0 ? "&fromIdDashboard=" + fromIdDashboard.ToString() : "") + ((step == WizardDashboardStep.None) ? "" : "&step=" + step.ToString());
            url = url + (idTile > 0 ? "&idTile=" + idTile.ToString() : "");
            return(url);
        }
Beispiel #16
0
        public static List <Dashboard> get_dashboards(Guid applicationId, Guid?userId, Guid?nodeTypeId, Guid?nodeId,
                                                      string nodeAdditionalId, DashboardType dashboardType, DashboardSubType subType, string subTypeTitle, bool?done,
                                                      DateTime?dateFrom, DateTime?dateTo, string searchText, int?lowerBoundary, int?count, ref long totalCount)
        {
            List <Dashboard> retList = new List <Dashboard>();

            DataProvider.GetDashboards(applicationId, ref retList, userId, nodeTypeId, nodeId, nodeAdditionalId, dashboardType,
                                       subType, subTypeTitle, done, dateFrom, dateTo, searchText, false, null, lowerBoundary, count, ref totalCount);
            return(retList);
        }
Beispiel #17
0
        public DataSet GetData(DashboardType dashboardType)
        {
            DataSet dt = new DataSet();

            string strStoredProc = GetStoredProcedureName(dashboardType);

            if (!string.IsNullOrEmpty(strStoredProc))
            {
                dt = _DatabaseFactory.ExecuteDataSet(Helper.GetDataBaseType,
                                                     DataBaseConnectionString, strStoredProc, true);
            }
            return(dt);
        }
Beispiel #18
0
 public dtoFilters(DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin, List <lm.Comol.Core.DomainModel.Filters.Filter> filters, Int32 idLanguage = -1)
 {
     DashboardType      = type;
     IdModifiedBy       = -1;
     Status             = (AvailableStatus)GetSingleValue(filters, searchFilterType.status, (long)AvailableStatus.Any);
     StartWith          = "";
     Name               = "";
     Ascending          = true;
     OrderBy            = OrderTilesBy.Name;
     IdCommunity        = idCommunity;
     FromRecycleBin     = loadFromRecycleBin;
     IdSelectedLanguage = idLanguage;
     IdTileType         = (long)GetSingleValue(filters, searchFilterType.type, -1);
 }
        public void InitView(DashboardType type, Boolean loadFromRecycleBin, Int32 idCommunity)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                ModuleDashboard permissions = ModuleDashboard.CreatePortalmodule(p.TypeID);
                if (type == DashboardType.Community)
                {
                    idCommunity = UserContext.CurrentCommunityID;
                    if (idCommunity < 0)
                    {
                        idCommunity = UserContext.CurrentCommunityID;
                    }
                    if (idCommunity > 0 && (!permissions.Administration && !permissions.ManageTiles))
                    {
                        permissions = Service.GetPermission(idCommunity);
                    }
                }
                else
                {
                    idCommunity = 0;
                }
                View.IdContainerCommunity = idCommunity;
                View.SetTitle(type, (idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
                if (permissions.Administration || permissions.List || permissions.Edit)
                {
                    if (loadFromRecycleBin)
                    {
                        View.SetBackUrl(RootObject.DashboardList(type, false, idCommunity));
                    }
                    else
                    {
                        View.SetRecycleUrl(RootObject.DashboardList(type, true, idCommunity));
                        View.SetAddUrl(RootObject.DashboardAdd(type, idCommunity));
                    }
                    View.InitializeListControl(permissions, type, idCommunity, loadFromRecycleBin);
                }
                else
                {
                    View.DisplayNoPermission(idCommunity, CurrentIdModule);
                }
            }
        }
Beispiel #20
0
 public ContainerSettings(DashboardType type, DashboardSettings dSettings = null) : this()
 {
     if (dSettings == null || (dSettings.Type == DashboardType.Portal && type != dSettings.Type))
     {
         AvailableViews   = GetAvailableView(type);
         AvailableOrderBy = GetAvailableOrderBy(type);
         AvailableGroupBy = GetAvailableGroupBy(type);
         Default          = new DefaultSettings(type, dSettings);
     }
     else
     {
         Default          = dSettings.Container.Default;
         AvailableViews   = dSettings.Container.AvailableViews;
         AvailableOrderBy = dSettings.Container.AvailableOrderBy;
         AvailableGroupBy = dSettings.Container.AvailableGroupBy;
     }
 }
Beispiel #21
0
        public static String DashboardList(DashboardType type, Boolean loadfromRecycleBin = false, Int32 idCommunity = -1)
        {
            String url = dashboardmodulehome;

            if (loadfromRecycleBin)
            {
                url = url + "RecycleBin.aspx?recycle=true";
            }
            else
            {
                url = url + "List.aspx?recycle=false";
            }
            url = url + (idCommunity > 0 ? "&idCommunity=" + idCommunity.ToString() : "");
            url = url + "&type=" + type.ToString();

            return(url);
        }
        public void InternalInitView(Boolean forPortal, Int32 idCommunity)
        {
            DashboardType         type     = (forPortal) ? DashboardType.Portal : DashboardType.Community;
            liteDashboardSettings settings = Service.DashboardSettingsGet(type, idCommunity, true);

            if (settings != null)
            {
                if (forPortal)
                {
                    LoadPortalDashboard(settings);
                }
                else
                {
                    LoadCommunityDashboard(settings, idCommunity);
                }
            }
        }
Beispiel #23
0
        public DefaultSettings(DashboardType type, DashboardSettings dSettings = null)
        {
            if (dSettings == null || (dSettings.Type == DashboardType.Portal && type != dSettings.Type))
            {
                switch (type)
                {
                case DashboardType.Portal:
                    View                = DashboardViewType.Tile;
                    Search              = DisplaySearchItems.Simple;
                    DefaultNoticeboard  = DisplayNoticeboard.OnRight;
                    TileNoticeboard     = DisplayNoticeboard.InheritsFromDefault;
                    ListNoticeboard     = DisplayNoticeboard.InheritsFromDefault;
                    CombinedNoticeboard = DisplayNoticeboard.InheritsFromDefault;
                    AfterUserLogon      = OnLoadSettings.AlwaysDefault;
                    OrderBy             = OrderItemsBy.LastAccess;
                    GroupBy             = GroupItemsBy.Tile;
                    break;

                case DashboardType.Community:
                case DashboardType.AllCommunities:
                    View                = DashboardViewType.Tile;
                    Search              = DisplaySearchItems.Hide;
                    DefaultNoticeboard  = DisplayNoticeboard.OnRight;
                    TileNoticeboard     = DisplayNoticeboard.InheritsFromDefault;
                    ListNoticeboard     = DisplayNoticeboard.InheritsFromDefault;
                    CombinedNoticeboard = DisplayNoticeboard.InheritsFromDefault;
                    AfterUserLogon      = OnLoadSettings.AlwaysDefault;
                    OrderBy             = OrderItemsBy.Name;
                    GroupBy             = GroupItemsBy.None;
                    break;
                }
            }
            else
            {
                View                = dSettings.Container.Default.View;
                Search              = dSettings.Container.Default.Search;
                DefaultNoticeboard  = dSettings.Container.Default.DefaultNoticeboard;
                TileNoticeboard     = dSettings.Container.Default.TileNoticeboard;
                ListNoticeboard     = dSettings.Container.Default.ListNoticeboard;
                CombinedNoticeboard = dSettings.Container.Default.CombinedNoticeboard;
                AfterUserLogon      = dSettings.Container.Default.AfterUserLogon;
                OrderBy             = dSettings.Container.Default.OrderBy;
                GroupBy             = dSettings.Container.Default.GroupBy;
            }
        }
Beispiel #24
0
        public void InitView(ModuleDashboard permissions, DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdContainerCommunity = idCommunity;
                View.CurrentType          = type;
                View.FromRecycleBin       = loadFromRecycleBin;
                View.CurrentOrderBy       = OrderSettingsBy.Default;
                View.CurrentAscending     = true;
                LoadSettings(permissions, type, idCommunity, loadFromRecycleBin);
            }
        }
Beispiel #25
0
        public void LoadSettings(DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin, OrderSettingsBy orderBy, Boolean ascending)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                ModuleDashboard permissions = ModuleDashboard.CreatePortalmodule(p.TypeID);
                if (type == DashboardType.Community && idCommunity > 0 && (!permissions.Administration && !permissions.List))
                {
                    permissions = Service.GetPermission(idCommunity);
                }
                LoadSettings(permissions, type, idCommunity, loadFromRecycleBin, orderBy, ascending);
            }
        }
Beispiel #26
0
        public virtual List <DashboardViewType> GetAvailableView(DashboardType type)
        {
            switch (type)
            {
            case DashboardType.Portal:
                return(new List <DashboardViewType>()
                {
                    DashboardViewType.Tile, DashboardViewType.Combined, DashboardViewType.List
                });

            case DashboardType.Community:
            case DashboardType.AllCommunities:
                return(new List <DashboardViewType>()
                {
                    DashboardViewType.Tile
                });
            }
            return(new List <DashboardViewType>());
        }
Beispiel #27
0
 public void Clone(long idDashboard, String cloneOf, DashboardType type, Int32 idCommunity, Boolean loadFromRecycleBin, OrderSettingsBy orderBy, Boolean ascending)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleDashboard.ActionType action = ModuleDashboard.ActionType.DashboardSettingsClone;
         DashboardSettings          item   = Service.DashboardSettingsClone(idDashboard, cloneOf);
         if (item == null)
         {
             action = ModuleDashboard.ActionType.DashboardSettingsUnableToClone;
         }
         View.DisplayMessage(action);
         View.SendUserAction(idCommunity, CurrentIdModule, idDashboard, action);
         LoadSettings(type, idCommunity, loadFromRecycleBin, orderBy, ascending);
     }
 }
Beispiel #28
0
        public virtual List <OrderItemsBy> GetAvailableOrderBy(DashboardType type)
        {
            switch (type)
            {
            case DashboardType.Portal:
                return(new List <OrderItemsBy>()
                {
                    OrderItemsBy.LastAccess, OrderItemsBy.CreatedOn, OrderItemsBy.ClosedOn, OrderItemsBy.Name
                });

            case DashboardType.Community:
            case DashboardType.AllCommunities:
                return(new List <OrderItemsBy>()
                {
                    OrderItemsBy.ActivatedOn, OrderItemsBy.Name
                });
            }
            return(new List <OrderItemsBy>());
        }
Beispiel #29
0
        public virtual List <GroupItemsBy> GetAvailableGroupBy(DashboardType type)
        {
            switch (type)
            {
            case DashboardType.Portal:
                return(new List <GroupItemsBy>()
                {
                    GroupItemsBy.Tag, GroupItemsBy.CommunityType
                });

            case DashboardType.Community:
            case DashboardType.AllCommunities:
                return(new List <GroupItemsBy>()
                {
                    GroupItemsBy.Service
                });
            }
            return(new List <GroupItemsBy>());
        }
Beispiel #30
0
        public List <DashboardType> GetDashboardTypeDropdown()
        {
            DashboardType        dashboardType  = new DashboardType();
            List <DashboardType> dashboardTypes = new List <DashboardType>();
            SqlConnection        connection     = new SqlConnection(ConfigurationManager.ConnectionStrings["SLAConnection"].ConnectionString);

            using (SqlConnection conn = new SqlConnection())
            {
                SqlCommand command = new SqlCommand("usp_GetSLADashboardTypes", connection);
                command.CommandType = CommandType.StoredProcedure;
                DataSet        ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = command;

                try
                {
                    da.Fill(ds);

                    foreach (DataRow dr in ds.Tables[0].AsEnumerable())
                    {
                        dashboardType                   = new DashboardType();
                        dashboardType.DashboardId       = Convert.ToInt32(dr["DashboardId"].ToString());
                        dashboardType.DashboardName     = dr["DashboardName"].ToString();
                        dashboardType.DashboardParentId = Convert.ToInt32(dr["DashboardParentId"].ToString());
                        dashboardType.IsInputEnabled    = Convert.ToInt32(dr["IsInputEnabled"].ToString());
                        dashboardTypes.Add(dashboardType);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    command.Dispose();
                    ds.Dispose();
                    da.Dispose();
                }
            }
            return(dashboardTypes);
        }
Beispiel #31
0
        /// <summary>
        /// Gets the users 'Dashboard' aka 'Stream'
        /// </summary>
        /// <param name="type">The filtered type</param>
        /// <param name="tracksOnly"></param>
        /// <param name="startIndex">The index to begin from</param>
        /// <param name="length">The length of how many items to retrive</param>
        /// <returns></returns>
        public static List<int> GetNextDashboard(DashboardType type = DashboardType.All, bool tracksOnly = true)
        {
            // Buffer for returned activity
            List<int> list = new List<int>();

            // Check if there is more to get
            if(_dashboardHref == "stop")
                return list;

            // Set url variable
            string url = "";
            if(_dashboardHref != null)
                url = _dashboardHref;
            else {
                // Switch for what dashboard to get
                switch(type) {
                    default:
                    case DashboardType.All:
                        url = "me/activities";
                        break;
                    case DashboardType.Affiliated:
                        url = "me/activities/tracks/affiliated";
                        break;
                    case DashboardType.Exclusive:
                        url = "me/activities/tracks/exclusive";
                        break;
                    case DashboardType.Own:
                        url = "me/activities/all/own";
                        break;
                }
                url += SoundCloudCore.Pagination;
            }

            // Get Response
            var res = SoundCloudCore.SendRequest<Dictionary<string, dynamic>>(url);
            _dashboardHref = res.ContainsKey("next_href") ? res["next_href"] : "stop";

            foreach(var dict in res["collection"]) {
                if(tracksOnly && dict["type"].Value.Contains("track")) {
                    list.Add(JsonConvert.DeserializeObject<Track>(dict["origin"].ToString()).ID);
                    System.IO.File.AppendAllText("log.log", dict["origin"].ToString());
                }
            }
            return list;
        }
        private async Task<dynamic> CompareGraph(dynamic parameters, CancellationToken ct)
        {
            this.RequiresAuthentication();
            var locations = await DataConnection.Ask(x => x.GetLocationsForPersonAsync(CurrentUserGuid()));
            var items = new DashboardType(
                new List<Tuple<Location, IEnumerable<string>, List<Tuple<Sensor, IEnumerable<string>>>>>(),
                CurrentUserGuid().ToString());

            foreach (var location in locations)
            {
                var sensors = await DataConnection.Ask(x => x.GetSensorsAtLocationAsync(location));
                var taggedSensors = new List<Tuple<Sensor, IEnumerable<string>>>();

                foreach (var sensor in sensors)
                    taggedSensors.Add(new Tuple<Sensor, IEnumerable<string>>(sensor, await DataConnection.Ask(x => x.GetSensorTagsAsync(sensor.Id))));

                IEnumerable<string> tags = await DataConnection.Ask(x => x.GetTagsAtLocationAsync(location));

                items.Item1.Add(new Tuple<Location, IEnumerable<string>, List<Tuple<Sensor, IEnumerable<string>>>>(location, tags, taggedSensors));
            }

            return View["compare-graph.cshtml", items];
        }
Beispiel #33
0
 public DashboardContainer(int? id, int? userId, DashboardType dashboardType)
 {
     Id = id;
     UserId = userId;
     DashboardType = dashboardType;
 }