public List <SectionListItem> GetSectionListForRuleSetId(long departmentId, Guid ruleSetId, Guid SecurityToken)
        {
            if (ruleSetId == null || ruleSetId == Guid.Empty)
            {
                throw new UserInputValidationException("RuleSetId cant't be null or empty");
            }
            if (departmentId == 0)
            {
                throw new UserInputValidationException("Departmentid is not valid.0 is not a valid department id.");
            }
            var sections = m_orgService.GetSectionListByDepartmentId(departmentId, SecurityToken);

            var ruleSet = GetRuleSetById(ruleSetId);

            if (ruleSet.ExcludeOrgUnits?.Count == 0)
            {
                return(sections);
            }
            var newSectionList = new List <SectionListItem>();

            foreach (var section in sections)
            {
                bool isAvailable = false;
                foreach (var _ in ruleSet.ExcludeOrgUnits.Where(unit => section.UnitGid == unit.UnitID).Select(unit => new { }))
                {
                    isAvailable = true;
                }
                if (!isAvailable)
                {
                    newSectionList.Add(section);
                }
            }
            return(newSectionList);
        }
Exemple #2
0
 public ActionResult GetSectionsByDepartmentId(long departmentId)
 {
     try
     {
         m_log.Info($"/department/section endpoint called with department id - {departmentId}");
         var sectionResponse = m_orgUnitsService.GetSectionListByDepartmentId(departmentId, m_user.SecurityToken);
         return(Ok(sectionResponse));
     }
     catch (Exception e)
     {
         var errorMessage = "Exception thrown at GetSectionsByDepartmentId  for the hospital Id =" + m_user.HospitalId;
         m_log.ErrorException(errorMessage, e);
         throw;
     }
 }
Exemple #3
0
        private List <SectionListItem> GetSectionIdByDepartment(long?departmentId, Guid securityToken)
        {
            var orgUnits = m_orgUnitsService.GetSectionListByDepartmentId(departmentId.Value, securityToken);

            return(orgUnits);
        }