/// <summary>
        /// Returns all the Care Plan statuses to populate the Drop down list of the same name.
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetCarePlanStatuses()
        {
            HttpResponseMessage message;

            try
            {
                List <CarePlanStatus> carep = new CarePlanBL().GetCarePlanStatuses().ToList();

                var result = from a in carep select new { StatusId = a.CarePlanStatusId, StatusName = a.CarePlanStatusName };
                message = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch
            {
                message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later."));
            }

            return(message);
        }
        /// <summary>
        /// Returns a Care Plan with the matching Care Plan ID from the database to fill the input fields on the page with.
        /// </summary>
        /// <param name="cpid">The Care Plan ID to search for.</param>
        /// <returns></returns>
        public HttpResponseMessage GetCarePlan(Guid cpid)
        {
            HttpResponseMessage message;

            try
            {
                CarePlan cp = new CarePlanBL().GetCarePlan(cpid);

                var result = new { PatientId = cp.PatientId_fk, Date = cp.CarePlanDate, CarePlanId = cp.CarePlanID, Remark = cp.CarePlanRemarks, Status = cp.CarePlanStatus, Type = cp.CarePlanType };
                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 the Care Plans of a particular patient.
        /// </summary>
        /// <param name="patid">The Patient's file number to filter by.</param>
        /// <returns></returns>
        public HttpResponseMessage GetCarePlansOfPatient(int patid)
        {
            HttpResponseMessage message;

            try
            {
                List <CarePlan> carepl = new CarePlanBL().GetCarePlansOfPatient(patid).ToList();

                var result = from cp in carepl select new { PatientId = cp.PatientId_fk, Date = cp.CarePlanDate, CarePlanId = cp.CarePlanID, Remark = cp.CarePlanRemarks, Status = cp.CarePlanStatus, Type = cp.CarePlanType };
                message = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch
            {
                message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later."));
            }

            return(message);
        }
Пример #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);
        }