Beispiel #1
0
        public JsonResult GetNotifications(SimplePagerModel pager)
        {
            var currentUser = HttpContext.User as CustomUser;
            var id          = currentUser?.UserId ?? default(int);

            var notifications = _customerService.GetPagedNotifications(id);


            var model = new NotificationListModel
            {
                Notifications = notifications.Select(x => new NotificationVewModel
                {
                    IsPositive = x.IsPositive,
                    Text       = x.Text
                }).ToList(),
                Pager = Extensions.Extensions.ToSimplePagerModel(notifications)
            };

            foreach (var item in notifications)
            {
                var updateItem = _customerService.GetNotificationById(item.Id);
                updateItem.IsOpened = true;
                _customerService.UpdateNotification(updateItem);
            }
            return(CreateJsonResult(true, data: model));
        }
Beispiel #2
0
        public ActionResult Notifications(SimplePagerModel pager)
        {
            var currentUser = HttpContext.User as CustomUser;
            var id          = currentUser?.UserId ?? default(int);

            var notifications = _customerService.GetPagedNotifications(id);


            var model = new NotificationListModel
            {
                Notifications = notifications.Select(x => new NotificationVewModel
                {
                    IsPositive   = x.IsPositive,
                    Text         = x.Text,
                    IsOpened     = x.IsOpened,
                    CreatedOnUtc = x.CreatedOnUtc.ToString(Constants.DateFormat.ShortDateString),
                }).ToList(),
                Pager = Extensions.Extensions.ToSimplePagerModel(notifications)
            };


            foreach (var item in notifications)
            {
                var updateItem = _customerService.GetNotificationById(item.Id);
                updateItem.IsOpened = true;
                _customerService.UpdateNotification(updateItem);
            }
            return(View(model));
        }
Beispiel #3
0
        // GET: Customer/Product
        public ActionResult Index(SimplePagerModel pager)
        {
            var products = _productService.GetAllProducts(pager.PageIndex, pager.PageSize);

            var model = _productFactory.PrepareProductListModel(products);

            return(View(model));
        }
Beispiel #4
0
        public JsonResult GetFilteredProducts(SimplePagerModel pager)
        {
            var products = _productService.GetAllProducts(pager.PageIndex, pager.PageSize);
            var model    = _productFactory.PrepareProductListModel(products);
            var url      = GetUrlWithFilters(pager);

            return(CreateJsonResult(true, url, model));
        }
        // GET: Customer/Product
        public ActionResult Index(SimplePagerModel pager)
        {
            var currentUser = HttpContext.User as CustomUser;
            var products    = _productService.GetAllProducts(pager.PageIndex, pager.PageSize);

            var model = _productFactory.PrepareProductListModel(products);

            return(View(model));
        }
Beispiel #6
0
        private string GetUrlWithFilters(SimplePagerModel pager)
        {
            var urlParams = new
            {
                pageIndex = pager.PageIndex,
                pageSize  = pager.PageSize
            };

            return(Url.Action("Index", urlParams));
        }
        // GET: Administration/Worker
        public ActionResult Index(SimplePagerModel pager)
        {
            var currentUser             = HttpContext.User as CustomUser;
            var currentAdministrationId = _userService.GetAdministrationIdByUserId(currentUser.UserId);

            var workers = _customerService.GetFilteredWorkers(currentAdministrationId, pager.PageIndex, pager.PageSize);
            var model   = _customerModelFactory.PrepareWorkersListViewModel(workers);

            return(View(model));
        }
Beispiel #8
0
        public ActionResult Index(SimplePagerModel pager)
        {
            var currentUser = HttpContext.User as CustomUser;

            var offers = _offerService.GetFilteredOffers(currentUser?.UserId ?? default(int), pager.PageIndex, pager.PageSize);

            var model = _offerModelFactory.PrepareProductListModel(offers);

            return(View(model));
        }
Beispiel #9
0
        public JsonResult GetFilteredPersonRequests(SimplePagerModel pager)
        {
            var currentUser    = HttpContext.User as CustomUser;
            var id             = currentUser?.UserId ?? default(int);
            var personRequests = _offerService.GetFilteredPersonRequests(id, pager.PageIndex, pager.PageSize);
            var model          = _offerModelFactory.PreparePersonRequestsListModel(personRequests);
            var url            = GetUrlWithFiltersForRequests(pager, id);

            return(CreateJsonResult(true, url, model));
        }
Beispiel #10
0
        private string GetUrlWithFiltersForRequests(SimplePagerModel pager, int customerId)
        {
            var urlParams = new
            {
                customerId,
                pageIndex = pager.PageIndex,
                pageSize  = pager.PageSize
            };

            return(Url.Action("PersonRequestList", urlParams));
        }
Beispiel #11
0
        public JsonResult GetFilteredRequests(SimplePagerModel pager, CareRequestFilterModel filter)
        {
            var currentUser             = HttpContext.User as CustomUser;
            var currentAdministrationId = _userService.GetAdministrationIdByUserId(currentUser.UserId);

            var requests = _customerService.GetFilteredCareRequests(currentAdministrationId, filter.Name, filter.StatusId, pager.PageIndex, pager.PageSize);
            var model    = _customerModelFactory.PrepareCareRequestsListModel(requests);

            var url = GetUrlWithFilters(pager, currentUser.AreaId);

            return(CreateJsonResult(true, url, model));
        }
        public JsonResult GetFilteredSocialWorkers(SimplePagerModel pager)
        {
            var currentUser             = HttpContext.User as CustomUser;
            var currentAdministrationId = _userService.GetAdministrationIdByUserId(currentUser.UserId);

            var workers = _customerService.GetFilteredWorkers(currentAdministrationId, pager.PageIndex, pager.PageSize);
            var model   = _customerModelFactory.PrepareWorkersListViewModel(workers);

            var url = GetUrlWithFilters(pager, currentUser.AreaId);

            return(CreateJsonResult(true, url, model));
        }
Beispiel #13
0
        public JsonResult GetFilteredPeople(SimplePagerModel pager, PeopleFilterModel filter)
        {
            var currentUser             = HttpContext.User as CustomUser;
            var currentAdministrationId = _userService.GetAdministrationIdByUserId(currentUser.UserId);

            var people = _customerService.GetFilteredCustomers(currentAdministrationId, filter.Name, filter.Phone,
                                                               filter.Email, filter.StatusId, pager.PageIndex, pager.PageSize);
            var model = _customerModelFactory.PreparePeopleListViewModel(people);

            var url = GetUrlWithFilters(pager, currentUser.AreaId);

            return(CreateJsonResult(true, url, model));
        }
Beispiel #14
0
        // GET: Administration/People
        public ActionResult Index(SimplePagerModel pager, PeopleFilterModel filter)
        {
            var currentUser             = HttpContext.User as CustomUser;
            var currentAdministrationId = _userService.GetAdministrationIdByUserId(currentUser.UserId);

            var people = _customerService.GetFilteredCustomers(currentAdministrationId, filter.Name, filter.Phone,
                                                               filter.Email, filter.StatusId, pager.PageIndex, pager.PageSize);
            var model = _customerModelFactory.PreparePeopleListViewModel(people);

            model.Filter = filter;

            return(View(model));
        }
Beispiel #15
0
        public ActionResult PersonRequestList(SimplePagerModel pager)
        {
            var currentUser = HttpContext.User as CustomUser;

            var personRequests = _offerService.GetFilteredPersonRequests(currentUser?.UserId ?? default(int), pager.PageIndex, pager.PageSize);
            var model          = _offerModelFactory.PreparePersonRequestsListModel(personRequests);

            ViewBag.Categories = _offerService.GetCategories();
            if (currentUser != null)
            {
                ViewBag.UserId = currentUser.UserId;
            }


            return(View("PersonRequestList", model));
        }
Beispiel #16
0
        public IActionResult Index(ToDoFilterModel filter, SimplePagerModel pager)
        {
            var userId    = User.GetLoggedInUserId <string>();
            var isTeacher = User.IsTeacher();

            var model = new ToDoViewModel();

            if (isTeacher)
            {
                model = _toDoModelFactory.PrepareTeacherToDoViewModel(filter, pager, userId);
            }
            else
            {
                model = _toDoModelFactory.PrepareToDoViewModel(filter, pager, userId);
            }

            return(View(model));
        }
Beispiel #17
0
        // GET: Administration/CareRequest
        public ActionResult Index(SimplePagerModel pager, CareRequestFilterModel filter)
        {
            var currentUser             = HttpContext.User as CustomUser;
            var currentAdministrationId = _userService.GetAdministrationIdByUserId(currentUser.UserId);

            var requests = _customerService.GetFilteredCareRequests(currentAdministrationId, filter.Name, filter.StatusId, pager.PageIndex, pager.PageSize);
            var model    = _customerModelFactory.PrepareCareRequestsListModel(requests);

            var workers = _assignmentService.GetAllowedForAssignWorkers(currentAdministrationId);

            ViewBag.Workers = workers.Select(x => new WorkerForAssignViewModel
            {
                Id       = x.UserId,
                FullName = x.User.GetFullName()
            }).ToList();

            return(View(model));
        }
Beispiel #18
0
        public ToDoViewModel PrepareTeacherToDoViewModel(ToDoFilterModel filter, SimplePagerModel pager, string userId)
        {
            var pagedList = _toDoService.SearchTeacherToDos(
                subjects: filter.Subjects,
                deadline: filter.Deadline,
                name: filter.Name,
                statusId: filter.StatusId,
                pageIndex: pager.PageIndex, pageSize: pager.PageSize > 0 ? pager.PageSize : Constants.Paging.DefaultPageSize, userId);

            var toDoListModel = new ToDoViewModel
            {
                ToDoItems = pagedList.Select(PrepareToDoModel).ToList(),
                Paging    = PagerExtensions.ToSimplePagerModel(pagedList),
                Statuses  = EnumHelpers.GetEnumKeyValuePairList <TaskStatus>(),
                Filter    = filter,
            };

            return(toDoListModel);
        }
Beispiel #19
0
        public JsonResult GetToDos(ToDoFilterModel filter, SimplePagerModel pager)
        {
            var userId    = User.GetLoggedInUserId <string>();
            var isTeacher = User.IsTeacher();

            var model = new ToDoViewModel();

            if (isTeacher)
            {
                model = _toDoModelFactory.PrepareTeacherToDoViewModel(filter, pager, userId);
            }
            else
            {
                model = _toDoModelFactory.PrepareToDoViewModel(filter, pager, userId);
            }

            return(CreateJsonResult(true, new
            {
                ToDos = model.ToDoItems,
                Pager = model.Paging
            }));
        }