public string InsertEquipmentAssignment(EquipmentAssignment pEquipmentAssignment) { try { context.EquipmentAssignment.Add(pEquipmentAssignment); context.SaveChanges(); return("success"); } catch (Exception ex) { return("fail"); } }
public string DeletePatientConfiguration(int pPatientId) { try { var patientConfig = (from p in context.PatientConfiguration where p.PatientId == pPatientId select p).ToList(); context.PatientConfiguration.RemoveRange(patientConfig); context.SaveChanges(); } catch (Exception ex) { return("fail"); } return("success"); }
public string DeletePain(string painId) { try { var pain = (from p in context.Pain where p.PainId == painId select p).ToList(); context.Pain.RemoveRange(pain); context.SaveChanges(); } catch (Exception ex) { return("fail"); } return("success"); }
public string DeleteUserActivityLog(int activityId) { try { var activity = (from p in context.UserActivityLog where p.ActivityId == activityId select p).ToList(); context.UserActivityLog.RemoveRange(activity); context.SaveChanges(); } catch (Exception ex) { return("fail"); } return("success"); }
public string DeleteSessionAuditTrail(int lAuditTrailID) { try { var audittrail = (from p in context.SessionAuditTrail where p.AuditTrailId == lAuditTrailID select p).ToList(); context.SessionAuditTrail.RemoveRange(audittrail); context.SaveChanges(); } catch (Exception ex) { return("fail"); } return("success"); }
public string CreatePIN(string patientloginid, string SurgeryDate, string PIN) { string result = string.Empty; try { var _patient = (from p in context.Patient.Where(p => p.PatientLoginId == patientloginid && Convert.ToDateTime(p.SurgeryDate).ToString("dd/MM/yyyy") == Convert.ToDateTime(SurgeryDate).ToString("dd/MM/yyyy")) select p).FirstOrDefault(); if (_patient != null) { _patient.Pin = !String.IsNullOrEmpty(PIN) ? int.Parse(PIN) : 0; context.Entry(_patient).State = EntityState.Modified; context.SaveChanges(); result = "success"; } else { result = "fail"; } } catch (Exception ex) { result = "error"; } return(result); }
public Vtransact getVTransactbyTherapistAndPatientId(string therapistId, string patientId) { Vtransact ltransact = (from p in context.Vtransact where p.TherapistId == therapistId && p.Status == 0 select p).FirstOrDefault(); if (ltransact != null) { ltransact.PatientId = patientId; context.Entry(ltransact).State = Microsoft.EntityFrameworkCore.EntityState.Modified; if (context.SaveChanges() > 0) { return(ltransact); } } return(null); }
//delete the provider record not having any patients assigned public IActionResult DeleteProvider(string provider) { try { var _user = (from p in context.User where p.UserId == provider select p).FirstOrDefault(); context.User.Remove(_user); int res = context.SaveChanges(); if (res > 0) { VSeeHelper lhelper = new VSeeHelper(); DeleteUser luser = new DeleteUser(); luser.secretkey = ConfigVars.NewInstance.secretkey; luser.username = _user.UserId; var resUser = lhelper.DeleteUser(luser); if (resUser != null && resUser["status"] == "success") { //Insert to User Activity Log UserActivityLog llog = new UserActivityLog(); llog.SessionId = HttpContext.Session.GetString("SessionId"); llog.ActivityType = "Update"; llog.StartTimeStamp = !string.IsNullOrEmpty(HttpContext.Session.GetString("SessionTime")) ? Convert.ToDateTime(HttpContext.Session.GetString("SessionTime")) : DateTime.Now; llog.Duration = Convert.ToInt32((DateTime.Now - Convert.ToDateTime(HttpContext.Session.GetString("SessionTime"))).TotalSeconds); llog.RecordChangeType = "Delete"; llog.RecordType = "Provider"; llog.Comment = "Record deleted"; llog.RecordJson = JsonConvert.SerializeObject(_user); llog.UserId = HttpContext.Session.GetString("UserId"); llog.UserName = HttpContext.Session.GetString("UserName"); llog.UserType = HttpContext.Session.GetString("UserType"); if (!string.IsNullOrEmpty(HttpContext.Session.GetString("ReviewID"))) { llog.ReviewId = HttpContext.Session.GetString("ReviewID"); } lIUserActivityLogRepository.InsertUserActivityLog(llog); } } } catch (Exception ex) { return(RedirectToAction("Index", "Provider")); } return(RedirectToAction("Index", "Provider")); }
public int deleteDeviceCalibrationCascade(string setupId) { DeviceCalibration ldevice = (from p in context.DeviceCalibration where p.SetupId == setupId select p).FirstOrDefault(); if (ldevice != null) { List <PatientConfiguration> lpatientCofig = (from p in context.PatientConfiguration where p.SetupId == ldevice.SetupId select p).ToList(); if (lpatientCofig != null) { foreach (PatientConfiguration lpat in lpatientCofig) { List <Protocol> lprotocolList = (from p in context.Protocol where p.RxId == lpat.RxId select p).ToList(); foreach (Protocol lprotocol in lprotocolList) { var pain = (from p in context.Pain where p.ProtocolId == lprotocol.ProtocolId select p).ToList(); context.Pain.RemoveRange(pain); context.SaveChanges(); var session = (from p in context.Session where p.ProtocolId == lprotocol.ProtocolId select p).ToList(); context.Session.RemoveRange(session); context.SaveChanges(); var protocol = (from p in context.Protocol where p.ProtocolId == lprotocol.ProtocolId select p).ToList(); context.Protocol.RemoveRange(protocol); context.SaveChanges(); } } context.PatientConfiguration.RemoveRange(lpatientCofig); context.SaveChanges(); } context.DeviceCalibration.RemoveRange(ldevice); return(context.SaveChanges()); } return(0); }
public User userLogin(string lUserID, string password, int type) { User luser = (from p in context.User where p.UserId == lUserID && p.Password == password && p.Type == type select p).FirstOrDefault(); if (luser != null) { luser.LoginSessionId = Guid.NewGuid().ToString(); context.Entry(luser).State = EntityState.Modified; int result = context.SaveChanges(); if (result > 0) { return(luser); } } return(null); }
public string InsertProtocol(Protocol pProtocol) { context.Protocol.Add(pProtocol); context.SaveChanges(); return(""); }
public int InsertPatientReview(PatientReview pPatientReview) { context.PatientReview.Add(pPatientReview); return(context.SaveChanges()); }
public void InsertRomChangeLog(RomchangeLog plog) { context.RomchangeLog.Add(plog); context.SaveChanges(); }
public void InsertLibrary(Library pLibrary) { context.Library.Add(pLibrary); context.SaveChanges(); }
public List <PatientRx> CreateNewPatientByProvider(NewPatientWithProtocol NewPatient) { List <PatientRx> lrxList = new List <PatientRx>(); DateTime? RXSD = null; DateTime? RXED = null; try { Patient patient = new Patient(); patient.PatientName = NewPatient.NewPatient.PatientName; patient.ProviderId = NewPatient.ProviderId; patient.Dob = NewPatient.NewPatient.Dob; patient.AddressLine = NewPatient.NewPatient.AddressLine; patient.EquipmentType = NewPatient.NewPatient.EquipmentType; patient.State = NewPatient.NewPatient.State; patient.City = NewPatient.NewPatient.City; patient.Zip = NewPatient.NewPatient.Zip; patient.PhoneNumber = NewPatient.NewPatient.PhoneNumber; patient.SurgeryDate = NewPatient.NewPatient.SurgeryDate; patient.Ssn = NewPatient.NewPatient.Ssn; patient.Side = NewPatient.NewPatient.Side; patient.Therapistid = NewPatient.NewPatient.TherapistId; patient.Paid = NewPatient.NewPatient.PatientAdminId; patient.DateCreated = DateTime.UtcNow; string patName = NewPatient.NewPatient.Ssn + NewPatient.NewPatient.PhoneNumber.Substring(NewPatient.NewPatient.PhoneNumber.Length - 4); patient.PatientLoginId = patName; context.Patient.Add(patient); context.SaveChanges(); int count = 0; foreach (NewPatientRx _PatientRx in NewPatient.NewPatientRXList) { if (count == 0) { RXSD = _PatientRx.RxStartDate; RXED = _PatientRx.RxEndDate; count++; } PatientRx patRx = new PatientRx(); patRx.RxId = Guid.NewGuid().ToString(); patRx.EquipmentType = NewPatient.NewPatient.EquipmentType; patRx.DeviceConfiguration = _PatientRx.DeviceConfiguration; patRx.RxStartDate = RXSD; patRx.RxEndDate = RXED; patRx.ProviderId = NewPatient.ProviderId; patRx.PatientId = patient.PatientId; patRx.CurrentFlexion = _PatientRx.CurrentFlexion; patRx.CurrentExtension = _PatientRx.CurrentExtension; patRx.GoalFlexion = _PatientRx.GoalFlexion; patRx.GoalExtension = _PatientRx.GoalExtension; patRx.RxDaysPerweek = 2; patRx.RxSessionsPerWeek = 3; patRx.Active = true; patRx.DateCreated = DateTime.UtcNow; patRx.PatientSide = patient.Side; patRx.PainThreshold = NewPatient.PainThreshold; patRx.RateOfChange = NewPatient.RateOfChange; context.PatientRx.Add(patRx); int response = context.SaveChanges(); if (response > 0) { patRx.Session = null; lrxList.Add(patRx); } } if (patient.PatientId > 0) { return(lrxList); } else { return(lrxList); } } catch (Exception ex) { return(lrxList); } }
public void InsertSession(Session pSession) { context.Session.Add(pSession); context.SaveChanges(); }
public void InsertPatientLibrary(PatientLibrary pLibrary) { context.PatientLibrary.Add(pLibrary); context.SaveChanges(); }
public int InsertMessage(Messages pMessage) { context.Messages.Add(pMessage); return(context.SaveChanges()); }