public NotificationService() { alarmService = new AlarmService(); MedicalRecordService = new MedicalRecordService(); physicUserService = new PhysicUserService(); residentService = new ResidentService(); }
public static bool LockUser(int id) { var userEntity = GetUserByUserId(id); if (userEntity == null) { throw MegaException.ThrowException("کاربری با این شناسه در پایگاه داده وجود ندارد"); } ResidentService.UpdateResident(userEntity); return(true); }
public static (int?UserId, string RoleName, string FullName) GetUserId() { string CookieName = "RoleType"; string RoleName = (Common.Cookie.ReadCookie(CookieName) ?? "").ToLower(); switch (RoleName) { default: return(UserId : null, RoleName : null, FullName : null); case "doctor": { var UserData = DoctorService.IsAuthenticated(); if (UserData == null) { return(UserId : null, RoleName : null, FullName : null); } else { return(UserId : UserData.Id, RoleName : RoleName, FullName : UserData.FirstName + " " + UserData.LastName); } } case "resident": { var UserData = ResidentService.IsAuthenticated(); if (UserData == null) { return(UserId : null, RoleName : null, FullName : null); } else { return(UserId : UserData.Id, RoleName : RoleName, FullName : UserData.FirstName + " " + UserData.LastName); } } case "physicuser": { var UserData = Logic.Services.PhysicUserService.IsAuthenticated(); if (UserData == null) { return(UserId : null, RoleName : null, FullName : null); } else { return(UserId : UserData.Id, RoleName : RoleName, FullName : UserData.FirstName + " " + UserData.LastName); } } } }
public static bool ChangePassword(string newPassword, string oldPassword) { UserType CurrentUserType = GetUserType(); var(UserId, _, _) = GetUserId(); switch (CurrentUserType) { case UserType.Doctor: { return (DoctorService .ChangeUserPassword (UserId.GetValueOrDefault(), oldPassword, newPassword)); } case UserType.Resident: { return (ResidentService .ChangeUserPassword (UserId.GetValueOrDefault(), oldPassword, newPassword)); } case UserType.Physist: { return (PhysicUserService .ChangeUserPassword (UserId.GetValueOrDefault(), oldPassword, newPassword)); } case UserType.User: { return(UserService .ChangeUserPassword (UserId.GetValueOrDefault(), oldPassword, newPassword)); } } return(false); }