private List <Person> GetUsersList() { var result = new List <Person>(); try { switch (LoginAs) { case Shared.Enums.LoginAs.ADMIN: result = _userService.GetAll().ToList(); break; case Shared.Enums.LoginAs.HOSPITALMANAGER: result = _userService.GetAllForHospital(_hospitalService.GetCurrentHospital().Id).ToList(); break; case Shared.Enums.LoginAs.CLINICMANAGER: result = _userService.GetAllForClinic(_clinicService.GetCurrentClinic().Id).ToList(); break; case Shared.Enums.LoginAs.POLYCLINICMANAGER: case Shared.Enums.LoginAs.BEAUTYCENTERMANAGER: result = _userService.GetAllForPoliClinic(_polyclinicService.GetCurrentShiftCenter().Id).ToList(); break; } } catch { // IGNORED } return(result); }
private ShiftCenter GetPolyclinic(int?polyclinicId) { if (polyclinicId != null) { switch (_workContext.LoginAs) { case Shared.Enums.LoginAs.ADMIN: return(_polyClinicService.GetShiftCenterById((int)polyclinicId)); case Shared.Enums.LoginAs.HOSPITALMANAGER: return(_polyClinicService.GetAllShiftCentersForHospital(_workContext.WorkingArea.Id).FirstOrDefault(x => x.Id == polyclinicId)); case Shared.Enums.LoginAs.CLINICMANAGER: { var currentClinic = _clinicService.GetCurrentClinic(); if (currentClinic != null) { return(currentClinic.ShiftCenters.FirstOrDefault(x => x.Id == polyclinicId)); } } break; case Shared.Enums.LoginAs.POLYCLINICMANAGER: case Shared.Enums.LoginAs.BEAUTYCENTERMANAGER: { var currentPolyclinic = _polyClinicService.GetCurrentShiftCenter(); if (currentPolyclinic != null) { if (polyclinicId == currentPolyclinic.Id) { return(currentPolyclinic); } } } break; } } return(null); }