/// <summary> /// Returns all the Employees in the database so as to populate the Dropdown of the same name. /// </summary> /// <returns></returns> public HttpResponseMessage GetAssessmentWorkers() { HttpResponseMessage message; try { List <Employee> emp = new AssessmentsBL().GetAssessmentWorkers().ToList(); var result = from e in emp select new { WorkerId = e.EmployeesId, WorkerName = e.Person.FirstName, WorkerSurname = e.Person.LastName }; 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 Assessment Origins in the database so as to popualte the Dropdown of the same name. /// </summary> /// <returns></returns> public HttpResponseMessage GetAssessmentOrigins() { HttpResponseMessage message; try { List <AssessmentOrigin> assess = new AssessmentsBL().GetAssessmentOrigins().ToList(); var result = from a in assess select new { OriginId = a.AssesmentOriginId, OriginName = a.AssesmentOriginName }; message = Request.CreateResponse(HttpStatusCode.OK, result); } catch { message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later.")); } return(message); }
//http://localhost:8236/api/AssessmentsApi/GetAssessments //[ApiVerifcation] /// <summary> /// Returns all the Asssessments in the database. /// </summary> /// <returns></returns> public HttpResponseMessage GetAssessments() { HttpResponseMessage message; try { List <Assessment> assess = new AssessmentsBL().GetAssessments().ToList(); var result = from a in assess select new { PatientId = a.PatientId_fk, Confirmed = a.Confirmed, Worker = a.Worker_fk, Date = a.Date, DateConfirmed = a.ConfirmationDate, AssessmentId = a.AssesmentId, Description = a.Description, Time = a.time, Type = a.AssesmentType_fk, Origin = a.Origin_fk, Duration = a.duration }; //FullName = a.Employee. + " " + a.Employee.Person.LastName, TypeName = a.AssessmentType.AssesmentTypeName 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 Assessments of a particular Patient. /// </summary> /// <param name="patid">The Patient's file-number to use to filter the results returned.</param> /// <returns></returns> public HttpResponseMessage GetAssessmentsOfPatient(int patid) { HttpResponseMessage message; try { List <Assessment> assess = new AssessmentsBL().GetAssessmentsOfPatient(patid).ToList(); UsersBL users = new UsersBL(); Roles rol = new Roles(); var result = from a in assess select new { AssessmentId = a.AssesmentId, Worker = users.GetNameById(a.Worker_fk), Date = a.Date, Time = a.time, Type = a.AssessmentType.AssesmentTypeName, Role = rol.GetRoleName(a.Worker_fk) }; /* * var result = from a in assess select new { PatientId = a.PatientId_fk, Confirmed = a.Confirmed, Worker = users.GetNameById(a.Worker_fk), Date = a.Date, DateConfirmed = a.ConfirmationDate, AssessmentId = a.AssesmentId, Description = a.Description, Time = a.time, Type = a.AssesmentType_fk, Origin = a.Origin_fk, Duration = a.duration, TypeName = a.AssessmentType.AssesmentTypeName }; */ message = Request.CreateResponse(HttpStatusCode.OK, result); } catch { message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later.")); } return(message); }
/// <summary> /// Returns an assessment with the corresponding Assessment ID, to fill the input fields on the page. /// </summary> /// <param name="assid">The Assessment's ID to to search for.</param> /// <returns></returns> public HttpResponseMessage GetAssessment(Guid assid) { HttpResponseMessage message; try { Assessment a = new AssessmentsBL().GetAssessment(assid); var result = new { PatientId = a.PatientId_fk, Confirmed = a.Confirmed, Worker = a.Worker_fk, Date = a.Date, DateConfirmed = a.ConfirmationDate, AssessmentId = a.AssesmentId, Description = a.Description, Time = a.time, Type = a.AssesmentType_fk, Origin = a.Origin_fk, Duration = a.duration }; message = Request.CreateResponse(HttpStatusCode.OK, result); } catch { message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later.")); } return(message); }
//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); }