/// <summary> /// Returns the Specialities /// </summary> /// <returns></returns> public List <BusinessModel.BusinessModels.Speciality> GetSpecialities() { try { List <BusinessModel.BusinessModels.Speciality> specialitiesDTO = new List <BusinessModel.BusinessModels.Speciality>(); IEnumerable <DomainModel.DomainModels.Speciality> specialities = _m3PactContext.Speciality; if (specialities != null && specialities.Count() > 0) { foreach (DomainModel.DomainModels.Speciality speciality in specialities) { BusinessModel.BusinessModels.Speciality specialityDTO = new BusinessModel.BusinessModels.Speciality(); specialityDTO.SpecialityCode = speciality.SpecialityCode; specialityDTO.SpecialityCode = speciality.SpecialityCode; specialityDTO.SpecialityName = speciality.SpecialityName; specialityDTO.SpecialityDescription = speciality.SpecialityDescription; specialityDTO.RecordStatus = speciality.RecordStatus; specialityDTO.ID = speciality.SpecialityId; specialitiesDTO.Add(specialityDTO); } } return(specialitiesDTO); } catch (Exception ex) { throw ex; } }
/// <summary> /// To activate or inactivate Speciality /// </summary> /// <param name="speciality"></param> public bool ActiveOrInactiveSpecialities(BusinessModel.BusinessModels.Speciality speciality) { try { DomainModel.DomainModels.Speciality sp = _m3PactContext.Speciality.Where(s => s.SpecialityCode == speciality.SpecialityCode).FirstOrDefault(); if (sp != null) { if (sp.RecordStatus == DomainConstants.RecordStatusActive) { sp.RecordStatus = DomainConstants.RecordStatusInactive; } else if (sp.RecordStatus == DomainConstants.RecordStatusInactive) { sp.RecordStatus = DomainConstants.RecordStatusActive; } _m3PactContext.Update(sp); _m3PactContext.SaveChanges(); return(true); } return(false); } catch (Exception ex) { throw ex; } }
/// <summary> /// To get the specialities based on list of user-ids. /// </summary> /// <param name="userIds"></param> /// <returns></returns> private List <BusinessModel.BusinessModels.Speciality> GetSpecialities(List <string> userIds) { List <BusinessModel.BusinessModels.Speciality> specialityListBusiness = null; List <Speciality> repositorySpecialityList = _clientsHeatMapRepository.GetClientSpecialitiesOfUser(userIds); if (repositorySpecialityList != null) { specialityListBusiness = new List <BusinessModel.BusinessModels.Speciality>(); foreach (Speciality specialityRepository in repositorySpecialityList) { BusinessModel.BusinessModels.Speciality speciality = new BusinessModel.BusinessModels.Speciality(); speciality.ID = specialityRepository.SpecialityId; speciality.SpecialityCode = specialityRepository.SpecialityCode; speciality.SpecialityName = specialityRepository.SpecialityName; speciality.SpecialityDescription = specialityRepository.SpecialityDescription; specialityListBusiness.Add(speciality); } } return(specialityListBusiness); }
/// <summary> /// Saves the Specilaities /// </summary> /// <param name="specialities"></param> /// <returns></returns> public bool SaveSpecialities(List <SpecialityViewModel> specialities) { try { List <BusinessModel.BusinessModels.Speciality> specialitiesDTO = new List <BusinessModel.BusinessModels.Speciality>(); foreach (SpecialityViewModel speciality in specialities) { Speciality specialityDTO = new BusinessModel.BusinessModels.Speciality(); specialityDTO.SpecialityCode = speciality.SpecialityCode; specialityDTO.SpecialityName = speciality.SpecialityName; specialityDTO.SpecialityDescription = speciality.SpecialityDescription; specialityDTO.RecordStatus = speciality.RecordStatus; specialityDTO.ID = speciality.ID; specialitiesDTO.Add(specialityDTO); } return(_specialityRespository.SaveSpecialities(specialitiesDTO)); } catch (Exception ex) { _logger.Log(ex, LogLevel.Error, ex.Message); return(false); } }