public static PaginationViewModel CreatePagination(string action, string controller, IThesesSystemData data, int currentPage, int id = 0, FilterOptions options = null) { int pagesNumber = 0; if (options == null) { pagesNumber = GetPages(data, controller + action, id); } else { pagesNumber = GetPages(data, controller + action, keyWord: options.KeyWord, filterBy: options.FilterBy); } var hasNextPage = currentPage != (pagesNumber - 1) && pagesNumber != 0; var hasPreviousPage = currentPage != 0; var pagination = new PaginationViewModel { CurrentPage = currentPage, PagesNumber = pagesNumber, HasNext = hasNextPage, HasPrevious = hasPreviousPage, Action = action, Controller = controller }; return(pagination); }
public static PaginationViewModel CreatePagination(string action, string controller, IThesesSystemData data, int currentPage, int id = 0, FilterOptions options = null) { int pagesNumber = 0; if (options == null) { pagesNumber = GetPages(data, controller + action, id); } else { pagesNumber = GetPages(data, controller + action, keyWord: options.KeyWord, filterBy: options.FilterBy); } var hasNextPage = currentPage != (pagesNumber - 1) && pagesNumber != 0; var hasPreviousPage = currentPage != 0; var pagination = new PaginationViewModel { CurrentPage = currentPage, PagesNumber = pagesNumber, HasNext = hasNextPage, HasPrevious = hasPreviousPage, Action = action, Controller = controller }; return pagination; }
public FacultiesController(IThesesSystemData data) : base(data) { }
public override Logger Create(IThesesSystemData data) { return(new ThesisLogger(data)); }
public AdministrationController(IThesesSystemData data) : base(data) { }
public UserController(IThesesSystemData data) : base(data) { }
public abstract Logger Create(IThesesSystemData data);
public override Logger Create(IThesesSystemData data) { return new ThesisLogger(data); }
public BaseController(IThesesSystemData data) { this.Data = data; }
private static int GetPages(IThesesSystemData data, string action, int id = 0, string keyWord = null, FilterBy filterBy = FilterBy.All) { int pageNumber = 0; switch (action) { case "StorageIndex": if (keyWord == null) { pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; } switch (filterBy) { case FilterBy.All: pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.FacultyNumber: long number = 0; if (long.TryParse(keyWord, out number)) { pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && t.Student.FacultyNumber == number) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); } else { pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); } break; case FilterBy.EGN: long egn = 0; if (long.TryParse(keyWord, out egn)) { pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && t.Student.User.EGN == egn) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); } else { pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); } break; case FilterBy.StudentName: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Student.User.FirstName.Contains(keyWord) || t.Student.User.MiddleName.Contains(keyWord) || t.Student.User.LastName.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.TeacherName: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Supervisor.User.FirstName.Contains(keyWord) || t.Supervisor.User.MiddleName.Contains(keyWord) || t.Supervisor.User.LastName.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Specialty: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Student.Specialty.Title.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Faculty: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Student.Specialty.Faculty.Title.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Thesis: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Title.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Description: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Description.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; } break; case "UserVerification": pageNumber = (int)Math.Ceiling((double)data.Users.All().Where(u => !u.IsVerified).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case "IdeaThemes": pageNumber = (int)Math.Ceiling((double)data.ThesisThemes.All().Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case "TutorialIndex": pageNumber = (int)Math.Ceiling((double)data.ThesisTutorials.All().Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case "SpecialtySpecialtyProfile": pageNumber = (int)Math.Ceiling((double)data.Students.All().Where(s => s.SpecialtyId == id).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; default: pageNumber = 0; break; } return(pageNumber); }
public SearchController(IThesesSystemData data) : base(data) { }
public ThesisThemesController(IThesesSystemData data) : base(data) { }
public MessageController(IThesesSystemData data) : base(data) { }
public HomeController(IThesesSystemData data) : base(data) { }
public FriendController(IThesesSystemData data) : base(data) { }
public AuthorizeController(IThesesSystemData data) : base(data) { }
public SpecialtiesController(IThesesSystemData data) : base(data) { }
public ValidationController(IThesesSystemData data) : base(data) { }
public ThesisLogger(IThesesSystemData data) : base(data) { }
public Logger(IThesesSystemData data) { this.Data = data; }
public ThesisController(IThesesSystemData data, LoggerCreator loggerCreater, IStorage storage) : base(data) { this.loggerCreator = loggerCreater; this.storage = storage; }
private static int GetPages(IThesesSystemData data, string action, int id = 0, string keyWord = null, FilterBy filterBy = FilterBy.All) { int pageNumber = 0; switch (action) { case "StorageIndex": if (keyWord == null) { pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; } switch (filterBy) { case FilterBy.All: pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.FacultyNumber: long number = 0; if (long.TryParse(keyWord, out number)) { pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && t.Student.FacultyNumber == number) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); } else { pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); } break; case FilterBy.EGN: long egn = 0; if (long.TryParse(keyWord, out egn)) { pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && t.Student.User.EGN == egn) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); } else { pageNumber = (int)Math.Ceiling((double)data.Theses.All().Where(t => t.IsComplete).Count() / GlobalConstants.ELEMENTS_PER_PAGE); } break; case FilterBy.StudentName: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Student.User.FirstName.Contains(keyWord) || t.Student.User.MiddleName.Contains(keyWord) || t.Student.User.LastName.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.TeacherName: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Supervisor.User.FirstName.Contains(keyWord) || t.Supervisor.User.MiddleName.Contains(keyWord) || t.Supervisor.User.LastName.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Specialty: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Student.Specialty.Title.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Faculty: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Student.Specialty.Faculty.Title.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Thesis: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Title.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case FilterBy.Description: pageNumber = (int)Math.Ceiling((double)data.Theses.All() .Where(t => t.IsComplete && (t.Description.Contains(keyWord))) .Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; } break; case "UserVerification": pageNumber = (int)Math.Ceiling((double)data.Users.All().Where(u => !u.IsVerified).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case "IdeaThemes": pageNumber = (int)Math.Ceiling((double)data.ThesisThemes.All().Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case "TutorialIndex": pageNumber = (int)Math.Ceiling((double)data.ThesisTutorials.All().Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; case "SpecialtySpecialtyProfile": pageNumber = (int)Math.Ceiling((double)data.Students.All().Where(s => s.SpecialtyId == id).Count() / GlobalConstants.ELEMENTS_PER_PAGE); break; default: pageNumber = 0; break; } return pageNumber; }
public FacultyController(IThesesSystemData data) : base(data) { }
public ThesesController(IThesesSystemData data, IStorage storage) : base(data) { this.storage = storage; }
public SpecialtyController(IThesesSystemData data) : base(data) { }
public IdeaController(IThesesSystemData data, LoggerCreator loggerCreator) : base(data) { this.loggerCreator = loggerCreator; }