Esempio n. 1
0
        /// <summary>
        /// Gets the current active department links for this department where data is bring shared to it
        /// </summary>
        /// <returns>List of DepartmentLinkResult objects with the information about the links</returns>
        public List <DepartmentLinkResult> GetActiveDepartmentLinks()
        {
            if (!_limitsService.CanDepartmentUseLinks(DepartmentId))
            {
                return(new List <DepartmentLinkResult>());
            }

            var linkResults = new List <DepartmentLinkResult>();
            var links       = _departmentLinksService.GetAllLinksForDepartment(DepartmentId);

            foreach (var link in links)
            {
                if (link.LinkedDepartmentId == DepartmentId && link.LinkEnabled)
                {
                    var result = new DepartmentLinkResult();
                    result.LinkId         = link.DepartmentLinkId;
                    result.DepartmentName = link.Department.Name;
                    result.Color          = link.DepartmentColor;
                    result.ShareCalls     = link.DepartmentShareCalls;
                    result.ShareOrders    = link.DepartmentShareOrders;
                    result.SharePersonnel = link.DepartmentSharePersonnel;
                    result.ShareUnits     = link.DepartmentShareUnits;

                    linkResults.Add(result);
                }
            }

            return(linkResults);
        }
Esempio n. 2
0
        public IActionResult Index()
        {
            var model = new LinksIndexView();

            model.DepartmentId   = DepartmentId;
            model.Links          = _departmentLinksService.GetAllLinksForDepartment(DepartmentId);
            model.CanCreateLinks = _limitsService.CanDepartmentUseLinks(DepartmentId);

            var department = _departmentsService.GetDepartmentById(DepartmentId);

            model.Code = department.LinkCode;

            return(View(model));
        }