public string DeletePage(int PageID) { var currentPage = new DashboardFacade(Profile.UserName).DeleteCurrentPage(PageID); Context.Cache.Remove(Profile.UserName); return currentPage.TabName(); }
public void ChangeCurrentPage(int pageId) { UserPageSetup setup = new DashboardBusiness.DashboardFacade(Profile.UserName).LoadUserSetup(string.Empty); if (setup.UserSetting.CurrentPageId != pageId) { setup.UserSetting.Detach(); DatabaseHelper.Update<UserSetting>(setup.UserSetting, delegate(UserSetting u) { u.CurrentPageId = pageId; }); } }
public void ChangePageLayout(int newLayout) { UserPageSetup setup = new DashboardBusiness.DashboardFacade(Profile.UserName).LoadUserSetup(string.Empty); //if new layout is 3 cols then do nothing //if new layout is 2 cols we need to move the 3rd into the second if (newLayout == 2 | newLayout == 3 | newLayout == 5) { foreach (WidgetInstance instance in setup.WidgetInstances) { if (setup.CurrentPage.ID == instance.PageId) { if (instance.ColumnNo == 2) { //move widget to the middle panel new DashboardFacade(Profile.UserName).MoveWidgetInstance(instance.Id, 1, 0); } } } } else if (newLayout == 4) { //move the widgets from both middle panels to the left panel. foreach (WidgetInstance instance in setup.WidgetInstances) { if (setup.CurrentPage.ID == instance.PageId) { if (instance.ColumnNo == 1 | instance.ColumnNo == 2) { new DashboardFacade(Profile.UserName).MoveWidgetInstance(instance.Id, 0, 0); } } } } new DashboardFacade(Profile.UserName).ModifyPageLayout(setup.CurrentPage.ID, newLayout); }
public string NewPage(string newLayout) { var newPage = new DashboardFacade(Profile.UserName).AddNewPage(newLayout); return newPage.TabName(); }
private void LoadUserPageSetup(bool noCache) { // If URL has the page title, load that page by default string pageTitle = (Request.Url.Query ?? string.Empty).TrimStart('?'); if( Profile.IsAnonymous ) { if( Profile.IsFirstVisit ) { // First visit Profile.IsFirstVisit = false; Profile.Save(); _Setup = new DashboardFacade(Profile.UserName).NewUserVisit(); } else { // OMAR Apr 5, 2008: Turning off cache because sometimes page setups get out of sync with the cached item //_Setup = Cache[Profile.UserName] as UserPageSetup; //if( noCache || null == _Setup ) _Setup = new DashboardFacade(Profile.UserName).LoadUserSetup(pageTitle); } } else { // OMAR Apr 5, 2008: Turning off cache because sometimes page setups get out of sync with the cached item //_Setup = Cache[Profile.UserName] as UserPageSetup; //if( noCache || null == _Setup ) _Setup = new DashboardFacade(Profile.UserName).LoadUserSetup(pageTitle); } // Cache the user setup in order to avoid repeated loading during postback //Cache[Profile.UserName] = _Setup; }
protected void DeleteTabLinkButton_Clicked(object sender, EventArgs e) { var currentPage = new DashboardFacade(Profile.UserName).DeleteCurrentPage(_Setup.CurrentPage.ID); Context.Cache.Remove(Profile.UserName); RedirectToTab(currentPage); }
void WidgetDataList_ItemCommand(object source, DataListCommandEventArgs e) { if( !ActionValidator.IsValid(ActionValidator.ActionTypeEnum.AddNewWidget) ) return; int widgetId = int.Parse( e.CommandArgument.ToString() ); DashboardFacade facade = new DashboardFacade(Profile.UserName); WidgetInstance newWidget = facade.AddWidget( widgetId ); /// User added a new widget. The new widget is loaded for the first time. So, it's not /// a postback experience for the widget. But for rest of the widgets, it is a postback experience. this.ReloadPage(wi => wi.Id == newWidget.Id); this.RefreshColumn(newWidget.ColumnNo); // Refresh the middle column where the new widget is added }
void addNewTabLinkButton_Click(object sender, EventArgs e) { var page = new DashboardFacade(Profile.UserName).AddNewPage("1"); RedirectToTab(page); }