public List <PhysicUser> GetPhysicUsers() { using (var db = new Model.PhysicManagementEntities()) { return(db.PhysicUser.OrderByDescending(x => x.Id).ToList()); } }
public PagedList <Cancer> GetCancerList(string title, string englishTitle, int CurrentPage = 1, int pageSize = 30) { using (var db = new Model.PhysicManagementEntities()) { IQueryable <Model.Cancer> QueryableCancer = db.Cancer; if (!string.IsNullOrEmpty(title)) { title = title.Trim().ToPersian(); QueryableCancer = QueryableCancer.Where(x => x.Title.Contains(title)); } if (!string.IsNullOrEmpty(englishTitle)) { englishTitle = englishTitle.Trim().ToPersian(); QueryableCancer = QueryableCancer.Where(x => x.EnglishTitle.Contains(englishTitle)); } QueryableCancer = QueryableCancer.OrderByDescending(x => x.Id); return(new ViewModels.PagedList <Model.Cancer>() { CurrentPage = CurrentPage, PageSize = pageSize, TotalRecords = QueryableCancer.Count(), Records = QueryableCancer.Skip((CurrentPage - 1) * pageSize).Take(pageSize).ToList() }); } }
public Model.ContourDetails GetContourDetailByMedicalRecordIdAndCancerOARId(long medicalRecordId, int cancerOARId, long contourId) { using (var db = new Model.PhysicManagementEntities()) { return(db.ContourDetails.FirstOrDefault(e => e.CancerOARId == cancerOARId && e.ContourId == contourId && e.MediacalRecordId == medicalRecordId)); } }
public List <Model.CancerOAR> GetCancerOARList() { using (var db = new Model.PhysicManagementEntities()) { return(db.CancerOAR.Include("Cancer").OrderBy(x => x.Cancer.Title).ToList()); } }
public List <Model.CancerTarget> GetCancerTargetList() { using (var db = new Model.PhysicManagementEntities()) { return(db.CancerTarget.OrderBy(x => x.Title).ToList()); } }
public static bool Register(string userName, string firstName, string lastName, string passWord, string mobileNo) { User UserEntity = new User() { FirstName = firstName, Mobile = mobileNo, LastName = lastName, Password = EncryptPassword(userName, passWord), Username = userName, IsSupervisor = true, IsActive = true }; var validation = new UserValidation.UserEntityValidate().Validate(UserEntity); if (validation.IsValid) { using (var db = new Model.PhysicManagementEntities()) { if (IsUserValidByUserName(userName)) { throw new ValidationException("این نام کاربری تکراری است"); } else { db.User.Add(UserEntity); return(db.SaveChanges() == 1); } } } throw new ValidationException(validation.Errors); }
public static User GetUserByUserId(long userId) { using (var db = new Model.PhysicManagementEntities()) { return(db.User.Where(x => x.Id == userId && x.IsActive == true).OrderBy(x => x.FirstName).FirstOrDefault()); } }
public List <Model.Alarm> GetUnreadAlarmListByUserType(UserType userType, int entityId) { if (entityId == 0) { throw new ValidationException("این رکورد در پایگاه داده وجود ندارد"); } using (var db = new Model.PhysicManagementEntities()) { switch (userType) { case UserType.Doctor: return(db.Alarm.Where(x => x.DoctorId == entityId && x.IsDelivered == false).OrderBy(x => x.Id).ToList()); case UserType.Resident: return(db.Alarm.Where(x => x.ResidentId == entityId && x.IsDelivered == false).OrderBy(x => x.Id).ToList()); case UserType.Physist: return(db.Alarm.Where(x => x.PhysicUserId == entityId && x.IsDelivered == false).OrderBy(x => x.Id).ToList()); case UserType.User: return(db.Alarm.Where(x => x.UserId == entityId && x.IsDelivered == false).OrderBy(x => x.Id).ToList()); default: return(null); } } }
public List <Model.PhysicTreatmentPlanDetail> GetPhysicTreatmentPlanDetailByPhysicPlanId(int physicPlanId) { using (var db = new Model.PhysicManagementEntities()) { return(db.PhysicTreatmentPlanDetail.Where(x => x.PhysicTreatmentPlanId == physicPlanId).ToList()); } }
public bool UpdateAlarmConfig(Model.AlarmConfig entity) { var validation = new AlarmConfigValidation.AlarmConfigEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.AlarmConfig.Find(entity.Id); if (Entity == null) { throw Common.MegaException.ThrowException("این رکورد در پایگاه داده پیدا نشد."); } Entity.AlarmEventTypeId = entity.AlarmEventTypeId; Entity.SendDoctorSMS = entity.SendDoctorSMS; Entity.SendPhysictSMS = entity.SendPhysictSMS; Entity.SendAdminSMS = entity.SendAdminSMS; Entity.SendAggregateSMS = entity.SendAggregateSMS; Entity.SendResidentSMS = entity.SendResidentSMS; Entity.LastModifiedDate = DateTime.Now; return(db.SaveChanges() == 1); } }
public List <Model.AlarmEventType> GetAlarmEventTypeList() { using (var db = new Model.PhysicManagementEntities()) { return(db.AlarmEventType.OrderBy(x => x.Id).ToList()); } }
public bool UpdateAlarm(Model.Alarm entity) { var validation = new AlarmValidation.AlarmEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.Alarm.Find(entity.Id); if (Entity == null) { throw Common.MegaException.ThrowException("این رکورد در پایگاه داده پیدا نشد."); } Entity.AlarmEventTypeId = entity.AlarmEventTypeId; Entity.Body = entity.Body; Entity.DeliverDate = entity.DeliverDate; Entity.DoctorId = entity.DoctorId; Entity.IsArchived = entity.IsArchived; Entity.IsDelivered = entity.IsDelivered; Entity.IsSMS = entity.IsSMS; Entity.IsSystemAlarm = entity.IsSystemAlarm; Entity.SendDate = entity.SendDate; return(db.SaveChanges() == 1); } }
public List <Model.PhysicUserAlarm> GetPhysicUserAlarmList() { using (var db = new Model.PhysicManagementEntities()) { return(db.PhysicUserAlarm.OrderBy(x => x.Id).ToList()); } }
public bool UpdateDoctorAlarm(Model.DoctorAlarm entity) { var validation = new DoctorAlarmValidation.DoctorAlarmEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.DoctorAlarm.Find(entity.Id); if (Entity == null) { throw Common.MegaException.ThrowException("این رکورد در پایگاه داده پیدا نشد."); } Entity.DoctorId = entity.DoctorId; Entity.IsSmsRecieveActive = entity.IsSmsRecieveActive; Entity.ReplacementResidentId = entity.ReplacementResidentId; Entity.ChangeDate = DateTime.Now; return(db.SaveChanges() == 1); } }
public static List <Model.TreatmentCategory> GetAllTreatmentCategory() { using (var db = new Model.PhysicManagementEntities()) { return(db.TreatmentCategory.ToList()); } }
public List <Model.PhysicTreatmentPlan> GetPhysicTreatmentPlanList() { using (var db = new Model.PhysicManagementEntities()) { return(db.PhysicTreatmentPlan.OrderBy(x => x.Id).ToList()); } }
public List <Model.TreatmentCategory> GetTreatmentCategoryList() { using (var db = new Model.PhysicManagementEntities()) { return(db.TreatmentCategory.Include("TreatmentCategoryService").OrderBy(x => x.Title).ToList()); } }
public bool UpdatePhysicTreatmentPlanDetail(Model.PhysicTreatmentPlanDetail entity) { var validation = new PhysicTreatmentPlanDetailValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors.ToString()); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.PhysicTreatmentPlanDetail.Find(entity.Id); if (Entity == null) { throw Common.MegaException.ThrowException("این رکورد در پایگاه داده پیدا نشد."); } Entity.MedicalRecordId = entity.MedicalRecordId; Entity.CancerOARId = entity.CancerOARId; Entity.CancerOARIdValue = entity.CancerOARIdValue; Entity.CancerOARTitle = entity.CancerOARTitle; Entity.CancerOARTolerance = entity.CancerOARTolerance; Entity.CancerTargetId = entity.CancerTargetId; Entity.CancerTargetOptimum = entity.CancerTargetOptimum; Entity.CancerTargetTitle = entity.CancerTargetTitle; Entity.CancerTargetValue = entity.CancerTargetValue; return(db.SaveChanges() == 1); } }
public List <Model.User> GetUserList() { using (var db = new Model.PhysicManagementEntities()) { return(db.User.OrderBy(x => x.FirstName).ToList()); } }
public bool UpdatePhysicTreatmentPlan(Model.PhysicTreatmentPlan entity) { var validation = new PhysicTreatmentPlanValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors.ToString()); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.PhysicTreatmentPlan.Find(entity.Id); if (Entity == null) { throw Common.MegaException.ThrowException("این رکورد در پایگاه داده پیدا نشد."); } Entity.PhysicId = entity.PhysicId; Entity.DoctorComment = entity.DoctorComment; Entity.DoctorFullName = entity.DoctorFullName; Entity.DoctorId = entity.DoctorId; Entity.Fields = entity.Fields; Entity.IsApprovedByDoctor = entity.IsApprovedByDoctor; Entity.MedicalRecordId = entity.MedicalRecordId; Entity.PhysicApplyDate = entity.PhysicApplyDate; Entity.PhysicComment = entity.PhysicComment; Entity.PhysicFullName = entity.PhysicFullName; Entity.PlanNo = entity.PlanNo; return(db.SaveChanges() == 1); } }
public static User GetUserByUserNameAndMobile(string userName, string mobile) { using (var db = new Model.PhysicManagementEntities()) { return(db.User.Where(x => x.Username.ToLower() == userName.ToLower() && x.Mobile == mobile && x.IsActive == true).OrderBy(x => x.FirstName).FirstOrDefault()); } }
public static List <Model.KFactor> GetAllKFaktors() { using (var db = new Model.PhysicManagementEntities()) { return(db.KFactor.ToList()); } }
public List <Model.Cancer> GetCancerList() { using (var db = new Model.PhysicManagementEntities()) { return(db.Cancer.ToList()); } }
public bool UpdateTreatmentCategoryService(Model.TreatmentCategoryService entity) { var validation = new TreatmentCategoryValidation.TreatmentCategoryServiceEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } if (entity.RelativeProfessionalValue == null) { entity.RelativeProfessionalValue = 0; } //if (entity.RelativeTechnicalValue == null) // entity.RelativeTechnicalValue = 0; using (var db = new Model.PhysicManagementEntities()) { var Entity = db.TreatmentCategoryService.Find(entity.Id); Entity.Title = entity.Title; Entity.Description = entity.Description; Entity.RelativeTechnicalValue = entity.RelativeTechnicalValue; Entity.RelativeProfessionalValue = entity.RelativeProfessionalValue; Entity.RelativeValue = entity.RelativeProfessionalValue + entity.RelativeTechnicalValue; Entity.TreatmentCategoryId = entity.TreatmentCategoryId; Entity.Code = entity.Code; return(db.SaveChanges() == 1); } }
public List <Model.CancerTarget> GetCancerTargetListByCancerId(int entityId) { using (var db = new Model.PhysicManagementEntities()) { return(db.CancerTarget.Where(x => x.CancerId == entityId).OrderBy(x => x.Title).ToList()); } }
public static Model.KFactor GetKFaktorByYear(string year) { using (var db = new Model.PhysicManagementEntities()) { return(db.KFactor.Where(x => x.Year == year).FirstOrDefault()); } }
public List <Model.ContourDetails> GetContourDetailsList() { using (var db = new Model.PhysicManagementEntities()) { return(db.ContourDetails.OrderBy(x => x.Id).ToList()); } }
public TreatmentCategory GetTreatmentCategoryById(int id) { using (var db = new Model.PhysicManagementEntities()) { return(db.TreatmentCategory.Find(id)); } }
public List <Model.KFactor> GetkFactorList() { using (var db = new Model.PhysicManagementEntities()) { return(db.KFactor.Where(x => x.IsActive == true).OrderBy(x => x.Year).ToList()); } }
public bool UpdatePatient(Model.Patient entity) { var validation = new PatientValidation.PatientEntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.Patient.Find(entity.Id); Entity.FirstName = entity.FirstName; Entity.LastName = entity.LastName; Entity.Mobile = entity.Mobile; Entity.NationalCode = entity.NationalCode; Entity.Code = entity.Code; Entity.Province = entity.Province; Entity.City = entity.City; Entity.Address = entity.Address; Entity.RegisterDate = entity.RegisterDate; Entity.GenderIsMale = entity.GenderIsMale; return(db.SaveChanges() == 1); } }