public bool UpdateTreatmentPhaseDetail(Model.TreatmentPhaseDetail entity) { var validation = new TreatmentValidation.TreatmentPhaseDetailEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.TreatmentPhaseDetail.Find(entity.Id); if (Entity == null) { throw MegaException.ThrowException("این رکورد در پایگاه داده پیدا نشد."); } var md = new MedicalRecordService(); var MedicalRecordObject = md.GetMedicalRecordById(entity.MedicalRecordId.GetValueOrDefault()); if (MedicalRecordObject == null) { throw MegaException.ThrowException("شناسه پرونده پزشکی وارد شده در پایگاه داده وجود ندارد."); } entity.MedicalRecordId = Convert.ToInt64(MedicalRecordObject.MRICode); Entity.AcceptedDoctorDate = entity.AcceptedDoctorDate; Entity.AcceptedDoctorFullName = entity.AcceptedDoctorFullName; Entity.AcceptedDoctorUserId = entity.AcceptedDoctorUserId; Entity.CancerOARId = entity.CancerOARId; Entity.CancerOARTitle = entity.CancerOARTitle; Entity.CancerOARTolerance = entity.CancerOARTolerance; Entity.CancerTargetId = entity.CancerTargetId; Entity.CancerTargetOptimum = entity.CancerTargetOptimum; Entity.CancerTargetTitle = entity.CancerTargetTitle; Entity.Description = entity.Description; Entity.DoctorDescription = entity.DoctorDescription; Entity.Evaluation = entity.Evaluation; Entity.HadContour = entity.HadContour; Entity.MedicalRecordId = entity.MedicalRecordId; Entity.PatientFirstName = entity.PatientFirstName; Entity.PatientLastName = entity.PatientLastName; Entity.PhysicPlanHasAccepted = entity.PhysicPlanHasAccepted; Entity.PhysicUserFullName = entity.PhysicUserFullName; Entity.PlannedDose = entity.PlannedDose; Entity.PresciptionHasApproved = entity.PresciptionHasApproved; Entity.PrescribedDate = entity.PrescribedDate; Entity.PrescribedDose = entity.PrescribedDose; Entity.PrescribedUser = entity.PrescribedUser; Entity.Reserve3 = entity.Reserve3; Entity.Reserved1 = entity.Reserved1; Entity.Reserved2 = entity.Reserved2; Entity.TreatmentPhaseId = entity.TreatmentPhaseId; return(db.SaveChanges() == 1); } }
public static bool LockUser(int id) { var userEntity = GetUserByUserId(id); if (userEntity == null) { throw MegaException.ThrowException("کاربری با این شناسه در پایگاه داده وجود ندارد"); } UserService.UpdateProfile(userEntity.Id, userEntity.Username, userEntity.FirstName, userEntity.LastName, userEntity.Mobile); return(true); }
public static bool LockUser(int id) { var userEntity = GetUserByUserId(id); if (userEntity == null) { throw MegaException.ThrowException("کاربری با این شناسه در پایگاه داده وجود ندارد"); } ResidentService.UpdateResident(userEntity); return(true); }
public static bool ChangeUserPassword(int userId, string oldPassword, string newPassword) { using (var db = new Model.PhysicManagementEntities()) { var UserData = GetUserByUserId(userId); string encryptedOldPassword = EncryptPassword(UserData.Username, oldPassword); var userData = GetUserData(UserData.Username, oldPassword); if (userData == null) { throw MegaException.ThrowException("رمز وارد شده اشتباه است."); } string encryptedNewPassword = EncryptPassword(userData.Username, newPassword); UserData.Password = encryptedNewPassword; return(db.SaveChanges() == 1); } }
public bool UpdateTreatmentPhase(Model.TreatmentPhase entity) { var validation = new TreatmentValidation.TreatmentPhaseEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.TreatmentPhase.Find(entity.Id); if (Entity == null) { throw MegaException.ThrowException("این رکورد در پایگاه داده پیدا نشد."); } var md = new MedicalRecordService(); var MedicalRecordObject = md.GetMedicalRecordById(entity.MedicalRecordId.GetValueOrDefault()); if (MedicalRecordObject == null) { throw MegaException.ThrowException("شناسه پرونده پزشکی وارد شده در پایگاه داده وجود ندارد."); } //entity.MedicalRecordId = Convert.ToInt64(MedicalRecordObject.MRICode); Entity.PhaseNumber = entity.PhaseNumber; Entity.PhaseText = entity.PhaseText; Entity.PrescribeDate = entity.PrescribeDate; Entity.Target = entity.Target; Entity.Description = entity.Description; Entity.PatientFirstName = MedicalRecordObject.PatientFirstName; Entity.PatientLastName = MedicalRecordObject.PatientLastName; Entity.PhaseText = entity.PhaseText; Entity.TreatmentDeviceId = entity.TreatmentDeviceId; Entity.TreatmentDeviceTitle = entity.TreatmentDeviceTitle; Entity.IsApproved = entity.IsApproved; Entity.Fraction = entity.Fraction; Entity.IsPrescribedByDoctor = entity.IsPrescribedByDoctor; return(db.SaveChanges() == 1); } }
public bool AddTreatmentPhase(Model.TreatmentPhase entity) { var validation = new TreatmentValidation.TreatmentPhaseEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var md = new MedicalRecordService(); var MedicalRecordObject = md.GetMedicalRecordById(entity.MedicalRecordId.GetValueOrDefault()); if (MedicalRecordObject == null) { throw MegaException.ThrowException("شناسه پرونده پزشکی وارد شده در پایگاه داده وجود ندارد."); } db.TreatmentPhase.Add(entity); return(db.SaveChanges() == 1); } }
public static bool UpdateProfile(int id, string userName, string firstName, string lastName, string mobileNo) { var currentUser = GetUserByUserId(id); if (currentUser == null) { throw MegaException.ThrowException("چنین کاربری در سامانه پیدا نشد."); } currentUser.FirstName = firstName; currentUser.LastName = lastName; currentUser.Mobile = mobileNo; var validation = new UserValidation.UserEntityValidate().Validate(currentUser); if (validation.IsValid) { using (var db = new Model.PhysicManagementEntities()) { db.User.Add(currentUser); return(db.SaveChanges() == 1); } } throw new ValidationException(validation.Errors); }