Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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)
 {
 }
Exemplo n.º 6
0
 public UserController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 7
0
 public abstract Logger Create(IThesesSystemData data);
 public override Logger Create(IThesesSystemData data)
 {
     return new ThesisLogger(data);
 }
Exemplo n.º 9
0
 public BaseController(IThesesSystemData data)
 {
     this.Data = data;
 }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 public UserController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 12
0
 public SearchController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 13
0
 public abstract Logger Create(IThesesSystemData data);
Exemplo n.º 14
0
 public SearchController(IThesesSystemData data)
     : base(data)
 {
 }
 public ThesisThemesController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 16
0
 public MessageController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 17
0
 public HomeController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 18
0
 public FriendController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 19
0
 public HomeController(IThesesSystemData data)
     : base(data)
 {
 }
 public AuthorizeController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 21
0
 public SpecialtiesController(IThesesSystemData data)
     : base(data)
 {
 }
        public ValidationController(IThesesSystemData data)
            : base(data)
        {

        }
Exemplo n.º 23
0
 public MessageController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 24
0
 public ValidationController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 25
0
 public AdministrationController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 26
0
 public BaseController(IThesesSystemData data)
 {
     this.Data = data;
 }
Exemplo n.º 27
0
 public ThesisLogger(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 28
0
 public Logger(IThesesSystemData data)
 {
     this.Data = data;
 }
Exemplo n.º 29
0
 public ThesisController(IThesesSystemData data, LoggerCreator loggerCreater, IStorage storage)
     : base(data)
 {
     this.loggerCreator = loggerCreater;
     this.storage       = storage;
 }
Exemplo n.º 30
0
        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;
        }
Exemplo n.º 31
0
 public FacultyController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 32
0
 public ThesisLogger(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 33
0
 public ThesisController(IThesesSystemData data, LoggerCreator loggerCreater, IStorage storage)
     : base(data)
 {
     this.loggerCreator = loggerCreater;
     this.storage = storage;
 }
Exemplo n.º 34
0
 public ThesesController(IThesesSystemData data, IStorage storage)
     : base(data)
 {
     this.storage = storage;
 }
 public SpecialtyController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 36
0
 public Logger(IThesesSystemData data)
 {
     this.Data = data;
 }
Exemplo n.º 37
0
 public IdeaController(IThesesSystemData data, LoggerCreator loggerCreator)
     : base(data)
 {
     this.loggerCreator = loggerCreator;
 }
Exemplo n.º 38
0
 public ThesesController(IThesesSystemData data, IStorage storage)
     : base(data)
 {
     this.storage = storage;
 }
Exemplo n.º 39
0
 public IdeaController(IThesesSystemData data, LoggerCreator loggerCreator)
     : base(data)
 {
     this.loggerCreator = loggerCreator;
 }
Exemplo n.º 40
0
 public FriendController(IThesesSystemData data)
     : base(data)
 {
 }
Exemplo n.º 41
0
 public AuthorizeController(IThesesSystemData data)
     : base(data)
 {
 }