示例#1
0
        public bool DeletePatient(int id, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to delete
            Patient patient = context.Patients.Find(id);
            //find treatment plans matching that patient
            List <TreatmentPlan> treatmentPlans = new List <TreatmentPlan>();

            treatmentPlans = context.TreatmentPlans.Where(x => x.PatientId == patient.PatientId).ToList();
            //if there aren't any treatment plans we can skip forward
            TreatmentPlanService treatmentService = new TreatmentPlanService();

            if (treatmentPlans.Count > 0)
            {
                foreach (TreatmentPlan treatmentPlan in treatmentPlans)
                {
                    context = treatmentService.DeleteTreatmentPlanAssociations(context, treatmentPlan);
                }
            }
            //remove the patient
            context.Patients.Remove(patient);
            try
            {
                //attempt to commit the changes
                var changes = context.SaveChanges();
                //if the changes are equal to or greater than 1 the change was sucessful
                return(changes >= 1);
            }
            catch
            {
                //if commit fails let the requester know
                return(false);
            }
        }
示例#2
0
        public bool UpdatePatients(int id, string name, string insurance, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to edit
            Patient patient = context.Patients.Find(id);

            if (patient.PatientId == id)
            {
                patient.PatientName = name;
                patient.Insurance   = insurance;
                context.Patients.Update(patient);
                var changes = context.SaveChanges();
                return(changes == 1);
            }
            return(false);
        }
示例#3
0
        public bool UpdatePriorAuthorization(int id, int treatmentId, string authorization, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to edit
            PriorAuthorization priorAuthorization = context.PriorAuthorizations.Find(id);

            if (priorAuthorization.PriorAuthorizationId == id)
            {
                priorAuthorization.TreatmentPlanId = treatmentId;
                priorAuthorization.Authorization   = authorization;
                context.PriorAuthorizations.Update(priorAuthorization);
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            return(false);
        }
        public bool UpdateEligibilityResponse(int id, int treatmentId, string response, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to edit
            EligibilityResponse eligibilityResponse = context.EligibilityResponses.Find(id);

            if (eligibilityResponse.ResponseId == id)
            {
                eligibilityResponse.TreatmentPlanId = treatmentId;
                eligibilityResponse.Response        = response;
                context.EligibilityResponses.Update(eligibilityResponse);
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            return(false);
        }
示例#5
0
        public bool InsertPatients(string name, string insurance, tech_assessmentContext context)
        {
            Patient patient = new Patient();

            patient.PatientName = name;
            patient.Insurance   = insurance;
            //attempt to insert new patient if it fails returns false
            try
            {
                context.Patients.Add(patient);
                var changes = context.SaveChanges();
                return(changes == 1);
            }
            catch
            {
                return(false);
            }
        }
示例#6
0
        public bool InsertPriorAuthorization(int treatmentId, string authorization, tech_assessmentContext context)
        {
            PriorAuthorization priorAuthorization = new PriorAuthorization();

            priorAuthorization.TreatmentPlanId = treatmentId;
            priorAuthorization.Authorization   = authorization;
            //attempt to insert new response if it fails returns false
            try
            {
                context.PriorAuthorizations.Add(priorAuthorization);
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            catch
            {
                return(false);
            }
        }
        public bool InsertEligibilityResponse(int treatmentId, string response, tech_assessmentContext context)
        {
            EligibilityResponse eligibilityResponse = new EligibilityResponse();

            eligibilityResponse.TreatmentPlanId = treatmentId;
            eligibilityResponse.Response        = response;
            //attempt to insert new response if it fails returns false
            try
            {
                context.EligibilityResponses.Add(eligibilityResponse);
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            catch
            {
                return(false);
            }
        }
示例#8
0
        public bool UpdateTreatmentPlan(int id, int patientId, string diagnosis, string service, string drug, string jcode, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to edit
            TreatmentPlan treatmentPlan = context.TreatmentPlans.Find(id);

            if (treatmentPlan != null)
            {
                treatmentPlan.PatientId = patientId;
                treatmentPlan.Diagnosis = diagnosis;
                treatmentPlan.Service   = service;
                treatmentPlan.Drug      = drug;
                treatmentPlan.Jcode     = jcode;
                context.TreatmentPlans.Update(treatmentPlan);
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }

            return(false);
        }
示例#9
0
        public bool DeleteTreatmentPlan(int id, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to delete

            TreatmentPlan treatmentPlan = new TreatmentPlan();

            treatmentPlan = context.TreatmentPlans.Find(id);
            DeleteTreatmentPlanAssociations(context, treatmentPlan);
            try
            {
                //attempt to commit the changes
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            catch
            {
                //if commit fails let the requester know
                return(false);
            }
        }
示例#10
0
        public bool DeletePriorAuthorization(int id, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to delete

            PriorAuthorization priorAuthorization = new PriorAuthorization();

            priorAuthorization = context.PriorAuthorizations.Find(id);

            context.PriorAuthorizations.Remove(priorAuthorization);
            try
            {
                //attempt to commit the changes
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            catch
            {
                //if commit fails let the requester know
                return(false);
            }
        }
        public bool DeleteEligibilityResponse(int id, tech_assessmentContext context)
        {
            //make sure it exsists before attempting to delete

            EligibilityResponse eligibilityResponse = new EligibilityResponse();

            eligibilityResponse = context.EligibilityResponses.Find(id);

            context.EligibilityResponses.Remove(eligibilityResponse);
            try
            {
                //attempt to commit the changes
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            catch
            {
                //if commit fails let the requester know
                return(false);
            }
        }
示例#12
0
        public bool InsertTreatmentPlan(int patientId, string diagnosis, string service, string drug, string jcode, tech_assessmentContext context)
        {
            TreatmentPlan treatmentPlan = new TreatmentPlan();


            treatmentPlan.PatientId = patientId;
            treatmentPlan.Diagnosis = diagnosis;
            treatmentPlan.Service   = service;
            treatmentPlan.Drug      = drug;
            treatmentPlan.Jcode     = jcode;
            //attempt to insert new response if it fails returns false
            try
            {
                context.TreatmentPlans.Add(treatmentPlan);
                var changes = context.SaveChanges();
                //if the changes are equal to 1 the change was sucessful
                return(changes == 1);
            }
            catch
            {
                return(false);
            }
        }