예제 #1
0
 public void SaveSettings(dtoBaseDashboardSettings dto)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         String url = "";
         ModuleDashboard.ActionType action   = (dto.Id == 0) ? ModuleDashboard.ActionType.DashboardSettingsUnableToAdd : ModuleDashboard.ActionType.DashboardSettingsUnableToSave;
         DashboardSettings          settings = (dto.Id > 0) ? CurrentManager.Get <DashboardSettings>(dto.Id) : null;
         if (dto.Id > 0 && settings == null)
         {
             View.DisplayDeletedDashboard();
             View.SendUserAction(dto.IdCommunity, CurrentIdModule, dto.Id, action);
             lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(CacheKeys.AllDashboard);
             return;
         }
         else if (settings != null && settings.Active && !dto.ForAll && dto.Assignments.Count == 0)
         {
             View.DisplayMessage(DashboardErrorType.NoAssignmentsForActiveSettings);
         }
         else
         {
             try
             {
                 DashboardSettings item = Service.SaveBaseSettings(dto);
                 if (item != null)
                 {
                     action = (dto.Id > 0) ? ModuleDashboard.ActionType.DashboardSettingsSaved : ModuleDashboard.ActionType.DashboardSettingsAdded;
                     if (action == ModuleDashboard.ActionType.DashboardSettingsAdded)
                     {
                         url = RootObject.DashboardEdit(item.Id, item.Type, dto.IdCommunity, true);
                     }
                     else
                     {
                         View.EnableSelector(!item.ForAll);
                     }
                 }
                 View.DisplayMessage(action);
                 lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(CacheKeys.AllDashboard);
             }
             catch (DashboardException ex)
             {
                 View.DisplayMessage(ex.ErrorType);
             }
         }
         View.SendUserAction(dto.IdCommunity, CurrentIdModule, dto.Id, action);
         if (!String.IsNullOrEmpty(url))
         {
             View.RedirectToUrl(url);
         }
         else if (action == ModuleDashboard.ActionType.DashboardSettingsSaved)
         {
             View.LoadWizardSteps(Service.GetAvailableSteps(WizardDashboardStep.Settings, settings.Id, settings.Type, View.IdContainerCommunity));
         }
     }
 }
예제 #2
0
        private void SetBackUrl(DashboardType type, long idDashboard, WizardDashboardStep step)
        {
            if (idDashboard > 0)
            {
                String name = (step == WizardDashboardStep.None) ? "" : Service.GetSettingsName(idDashboard);
                switch (step)
                {
                case WizardDashboardStep.Settings:
                    View.SetDashboardSettingsBackUrl(RootObject.DashboardEdit(idDashboard, type), name);
                    break;

                case WizardDashboardStep.HomepageSettings:
                    View.SetDashboardSettingsBackUrl(RootObject.DashboardEditViews(idDashboard, type), name);
                    break;

                case WizardDashboardStep.Modules:
                case WizardDashboardStep.CommunityTypes:
                case WizardDashboardStep.Tiles:
                    View.SetDashboardSettingsBackUrl(RootObject.DashboardTileReorder(step, idDashboard, type), name);
                    break;
                }
            }
        }