Exemplo n.º 1
0
 /// <summary>
 /// To SaveAnd Update User Dashboard settings
 /// </summary>
 /// <createdBy>Manoj jaswal</createdBy>
 /// <CreatedDate>2015-2-26</CreatedDate>
 /// <param name="UserID"></param>
 /// <param name="Setting"></param>
 /// <returns></returns>
 public string Save_UpdateDashboardSettings(long UserID, string Setting)
 {
     try
     {
         DashboardSettingsRepository obj_DashboardSettingsRepository = new DashboardSettingsRepository();
         DashbordSetting             obj_DashbordSetting             = new DashbordSetting();
         obj_DashbordSetting = obj_DashboardSettingsRepository.GetAll(x => x.IsDeleted == false &&
                                                                      x.UserID == UserID).FirstOrDefault();
         if (obj_DashbordSetting == null)
         {
             obj_DashbordSetting = new DashbordSetting();
             obj_DashbordSetting.DisplaySettings = Setting;
             obj_DashbordSetting.CreatedDate     = DateTime.UtcNow;
             obj_DashbordSetting.UserID          = UserID;
             obj_DashbordSetting.IsActive        = true;
             obj_DashbordSetting.CreatedBy       = UserID;
             obj_DashboardSettingsRepository.Add(obj_DashbordSetting);
             obj_DashboardSettingsRepository.SaveChanges();
             return("Save Successfully!");
         }
         else
         {
             obj_DashbordSetting.DisplaySettings = Setting;
             obj_DashbordSetting.ModifiedDate    = DateTime.UtcNow;
             obj_DashbordSetting.ModifiedBy      = UserID;
             obj_DashboardSettingsRepository.SaveChanges();
             return("Update successfully!");
         }
     }
     catch (Exception ex)
     {
         return(ex.Message.ToString());
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// TO GET USER DASHBOARD SETTINGS
 /// </summary>
 /// <CreatedBy>Manoj Jaswal</CreatedBy>
 /// <CreatedDate>2015-2-26</CreatedDate>
 /// <param name="UserID"></param>
 /// <returns></returns>
 public string[] getUserDasboardSettings(long UserID)
 {
     try
     {
         DashboardSettingsRepository obj_DashboardSettingsRepository = new DashboardSettingsRepository();
         DashbordSetting             obj_DashbordSetting             = new DashbordSetting();
         var      data_Object = obj_DashboardSettingsRepository.GetAll(x => x.IsDeleted == false && x.UserID == UserID).FirstOrDefault();
         string[] items       = null;
         if (data_Object != null)
         {
             items = data_Object.DisplaySettings.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
         }
         return(items);
     }
     catch (Exception ex)
     {
         Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public string[] getUserDasboardSettings(long UserID)", "From common.cs file", UserID);
         throw;
     }
 }
Exemplo n.º 3
0
        private void LoadSettings()
        {
            if (Settings != null)
            {
                try
                {
                    foreach (ShellHyperlink hyperlink in Settings.ActivationLinks)
                    {
                        try
                        {
                            if (hyperlink.ModuleId == DashboardModule.ModuleId)
                            {
                                IWebView webView = WorkItem.SmartParts.AddNew <WebView>();
                                webView.SetUrl(hyperlink.Data["Title"], hyperlink.Link);
                                View.Show(webView);
                            }
                            else
                            {
                                HyperlinkService.ExecuteHyperlink(hyperlink);
                            }
                        }
                        catch
                        {
                        }
                    }

                    View.LoadLayout();

                    if (Settings.RefreshInterval > 0)
                    {
                        _timer.Interval = Settings.RefreshInterval * 1000;
                        _timer.Start();
                    }
                }
                finally
                {
                    Settings = null;
                }
            }
        }
Exemplo n.º 4
0
        public void SaveUserSettings(DashboardSettingsRepository settings)
        {
            if (!_settingsSaved)
            {
                if (_presenter.Settings == null)
                {
                    settings.ActivationLinks.Clear();

                    int count = 0;

                    foreach (DocumentWindow document in dashboardWorkspace.DocumentWindows)
                    {
                        document.Name = string.Format("Window{0}", count);
                        count++;

                        ISmartPartInfoProvider provider = document.Content as ISmartPartInfoProvider;

                        if (provider != null)
                        {
                            ISmartPartInfo info = provider.GetSmartPartInfo(typeof(ShellSmartPartInfo));

                            ShellSmartPartInfo shellSmartPartInfo = info as ShellSmartPartInfo;

                            if (shellSmartPartInfo != null && shellSmartPartInfo.Hyperlink != null)
                            {
                                settings.ActivationLinks.Add(shellSmartPartInfo.Hyperlink);
                            }
                        }
                    }

                    DockSiteLayoutSerializer serializer = new DockSiteLayoutSerializer();
                    serializer.SerializationBehavior = DockSiteSerializationBehavior.All;
                    settings.Layout = serializer.SaveToString(dashboardWorkspace);
                }
                _settingsSaved = true;
            }
        }
Exemplo n.º 5
0
 public void LoadUserSettings(DashboardSettingsRepository settings)
 {
     Presenter.Settings = settings;
 }