public void ReLoad() { uint totalRecords; uint newPageSize; totalRecords = PageContract.GetTotalCount(); if ((cmbPageSizes != null) && (cmbPageSizes.SelectedItem != null)) { newPageSize = (uint)cmbPageSizes.SelectedItem; } else { newPageSize = 10; } if (totalRecords == 0) { ItemsSource.Clear(); TotalPages = 1; Page = 1; } else { TotalPages = (totalRecords / newPageSize) + (uint)((totalRecords % newPageSize == 0) ? 0 : 1); } uint newPage = 1; uint StartingIndex = (newPage - 1) * newPageSize; uint oldPage = Page; RaisePreviewPageChange(Page, newPage); Page = newPage; ItemsSource.Clear(); ICollection <object> fetchData = PageContract.GetRecordsBy(StartingIndex, newPageSize, FilterTag); // ItemsSource.Clear(); foreach (object row in fetchData) { ItemsSource.Add(row); } RaisePageChanged(oldPage, Page); }
public override Page AddNewPage(PageContract contract) { var repo = repositories.GetPageRepository(); var result = repo.AddNewPage(new Page { RouteName = contract.RouteName, ControllerName = contract.ControllerName, ControllerAsName = contract.ControllerAsName, ControllerUrl = contract.ControllerUrl, TemplateUrl = contract.TemplateUrl }); repo.Save(); return(result); }
private void Navigate(PageChanges change) { uint totalRecords; uint newPageSize; if (PageContract == null) { return; } totalRecords = PageContract.GetTotalCount(); newPageSize = (uint)cmbPageSizes.SelectedItem; if (totalRecords == 0) { ItemsSource.Clear(); TotalPages = 1; Page = 1; } else { TotalPages = (totalRecords / newPageSize) + (uint)((totalRecords % newPageSize == 0) ? 0 : 1); } uint newPage = 1; switch (change) { case PageChanges.First: if (Page == 1) { return; } break; case PageChanges.Previous: newPage = (Page - 1 > TotalPages) ? TotalPages : (Page - 1 < 1) ? 1 : Page - 1; break; case PageChanges.Current: newPage = (Page > TotalPages) ? TotalPages : (Page < 1) ? 1 : Page; break; case PageChanges.Next: newPage = (Page + 1 > TotalPages) ? TotalPages : Page + 1; //(Page + 1) < 1 ? 1 : break; case PageChanges.Last: if (Page == TotalPages) { return; } newPage = TotalPages; break; default: break; } uint StartingIndex = (newPage - 1) * newPageSize; uint oldPage = Page; RaisePreviewPageChange(Page, newPage); Page = newPage; ItemsSource.Clear(); ICollection <object> fetchData = PageContract.GetRecordsBy(StartingIndex, newPageSize, FilterTag); foreach (object row in fetchData) { ItemsSource.Add(row); } RaisePageChanged(oldPage, Page); }
public Result Post([FromBody] PageContract contract) { var pageDetail = service.AddPageDetail(); return(Result.Ok(pageDetail.Id)); }
public Result Post([FromBody] PageContract contract) { var pageProperty = service.AddPageProperty(); return(Result.Ok(pageProperty)); }
public virtual Page AddNewPage(PageContract contract) { throw new BusinessException(Constants.Message.Exception.HasNotAccess); }