//http://localhost:8236/api/PatientAssessmentsApi/GetPatientAssessments

        /// <summary>
        /// Returns all Patient Assessments in the database.
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetPatientAssessments()
        {
            HttpResponseMessage message;

            try
            {
                List <PatientAssesment> assess = new PatientAssessBL().GetPatientAssessments().ToList();

                var result = from a in assess select new { PatientAssessmentId = a.PatientAssesmentId, Grade = a.PatientAssessmentGrade, Remark = a.Remark, TypeId = a.Type, PatientId = a.PatientId_fk };
                message = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch
            {
                message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later."));
            }

            return(message);
        }
        /// <summary>
        /// Returns all Patient Assessment grades associated with the Type ID passed, to populate the Drop Down list after a Type is chosen.
        /// </summary>
        /// <param name="typeid">The Type ID to filter the results by.</param>
        /// <returns></returns>
        public HttpResponseMessage GetPatientAssessmentTypeGrades(Guid typeid)
        {
            HttpResponseMessage message;

            try
            {
                List <PatientAssessmentGrade> assess = new PatientAssessBL().GetPatientAssessmentTypeGrades(typeid).ToList();

                var result = from a in assess select new { GradeId = a.PatientAssessmentGradeId, GradeName = a.PatientAssessmentGradeName, GradeType = a.PatientAssessmentTypeId_fk };
                message = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch
            {
                message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later."));
            }

            return(message);
        }
        /// <summary>
        /// Returns the Patient Assessments of a particular Patient in the database.
        /// </summary>
        /// <param name="patid">The Patient ID to filter the results by.</param>
        /// <returns></returns>
        public HttpResponseMessage GetPatientAssessmentsOfPatient(int patid)
        {
            HttpResponseMessage message;

            try
            {
                List <PatientAssesment> patass = new PatientAssessBL().GetPatientAssessmentsOfPatient(patid).ToList();

                var result = from pa in patass select new { PatientId = pa.PatientId_fk, Grade = pa.Grade, PatAssId = pa.PatientAssesmentId, Remark = pa.Remark, Type = pa.Type };
                message = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch
            {
                message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later."));
            }

            return(message);
        }
Exemplo n.º 4
0
        //type is the list selector
        public bool checkDropdowns(Guid val, int type)
        {
            bool flag = false;

            //Assessment
            if (type == 1)
            {
                List <AssessmentType> assessments = new AssessmentsBL().GetAssessmentTypes().ToList();

                foreach (AssessmentType at in assessments)
                {
                    if (at.AssesmentTypeId == val)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (type == 2)
            {
                List <AssessmentOrigin> assessments = new AssessmentsBL().GetAssessmentOrigins().ToList();

                foreach (AssessmentOrigin ao in assessments)
                {
                    if (ao.AssesmentOriginId == val)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (type == 3)
            {
                List <Employee> emp = new AssessmentsBL().GetAssessmentWorkers().ToList();

                foreach (Employee e in emp)
                {
                    if (e.EmployeesId == val)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            //patient Assessments
            if (type == 4)
            {
                List <PatientAssessmentType> patients = new PatientAssessBL().GetPatientAssessmentTypes().ToList();

                foreach (PatientAssessmentType at in patients)
                {
                    if (at.PatientAssesmentTypeId == val)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (type == 5)
            {
                List <PatientAssessmentGrade> patients = new PatientAssessBL().GetPatientAssessmentGrades().ToList();

                foreach (PatientAssessmentGrade at in patients)
                {
                    if (at.PatientAssessmentGradeId == val)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            //Care Plan
            if (type == 6)
            {
                List <CarePlanType> careplan = new CarePlanBL().GetCarePlanTypes().ToList();

                foreach (CarePlanType at in careplan)
                {
                    if (at.CarePlanTypeId == val)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (type == 7)
            {
                List <CarePlanStatus> careplan = new CarePlanBL().GetCarePlanStatuses().ToList();

                foreach (CarePlanStatus at in careplan)
                {
                    if (at.CarePlanStatusId == val)
                    {
                        flag = true;
                        break;
                    }
                }
            }

            return(flag);
        }