public ConsultationView GetDrugs(string id) { ConsultationView cv = new ConsultationView(); using (var deprepo = new ConsultationRepository()) { Consultation _Consult = deprepo.GetById(id); cv.ConsultId = _Consult.ConsultId; cv.collected = _Consult.collected; cv.ConsultTime = _Consult.ConsultTime; cv.Description = _Consult.Description; //cv.illness = _Consult.illness; cv.Symptoms = _Consult.Symptoms; cv.TotalPrice = _Consult.TotalPrice; cv.patientfullname = _Consult.patientfullname; cv.ConsultDate = _Consult.ConsultDate; cv.PatientId = _Consult.PatientId; cv.Custs = new List <ConsultationView.Cust>(); foreach (var VARIABLE in _Consult.CustLis) { ConsultationView.Cust obCust = new ConsultationView.Cust(); obCust.custId = VARIABLE.custId; obCust.Dosage = VARIABLE.Dosage; obCust.DrugId = VARIABLE.DrugId; obCust.Quantity = VARIABLE.Quantity; cv.Custs.Add(obCust); } return(cv); } }
public void UpdateConsultationRepositoryTest() { //Arrange IConsultationRepository repository = new ConsultationRepository(); Consultation Consultation = _contextForTest.Consultations.Find(1); Consultation.Name = "Teste"; Consultation.Age = 20; Consultation.Cpf = "0000"; Consultation.Rg = "0000"; Consultation.Date = DateTime.Now; Consultation.Type = " SAUHSAHUSUAS"; //Action var updatedConsultation = repository.Update(Consultation); //Assert var persistedConsultation = _contextForTest.Consultations.Find(1); Assert.IsNotNull(updatedConsultation); Assert.AreEqual(updatedConsultation.Id, persistedConsultation.Id); Assert.AreEqual(updatedConsultation.Name, persistedConsultation.Name); Assert.AreEqual(updatedConsultation.Cpf, persistedConsultation.Cpf); Assert.AreEqual(updatedConsultation.Rg, persistedConsultation.Rg); Assert.AreEqual(updatedConsultation.Type, persistedConsultation.Type); Assert.AreEqual(updatedConsultation.Date, persistedConsultation.Date); }
public ConsultationView GETdeleteMethod(string id) { ConsultationView cv = new ConsultationView(); using (var deprepo = new ConsultationRepository()) { if (id != null) { Consultation _consultation = deprepo.GetById(id); cv.ConsultId = _consultation.ConsultId; //cv.illness = _consultation.illness; cv.Symptoms = _consultation.Symptoms; cv.Symptoms = _consultation.Symptoms; //cv.PatientSname = _consultation.PatientSname; cv.ConsultDate = _consultation.ConsultDate; //cv.PatientFname = _consultation.PatientFname; cv.PresribedMed = _consultation.PresribedMed; cv.ConsultTime = _consultation.ConsultTime; cv.TotalPrice = _consultation.TotalPrice; } return(cv); } }
public ConsultationBL() { oUnitOfWork = new UnitOfWork(ConfigurationManager.ConnectionStrings["SSREntities"].ConnectionString); oRepositorio = oUnitOfWork.ConsultationRepository; oRepositorioConsultationInterestArea = oUnitOfWork.ConsultationInterestAreaRepository; oRepositorioInvestigator = oUnitOfWork.InvestigatorRepository; }
public UnityOfWork(DevAvaliacaoDataContext context) { _context = context; ConsultationRepository = new ConsultationRepository(context); DoctorRepository = new DoctorRepository(context); DoctorScheduleRepository = new DoctorScheduleRepository(context); PatientRepository = new PatientRepository(context); SpecialtyRepository = new SpecialtyRepository(context); UserRepository = new UserRepository(context); }
public void PostDeleteMethod(string id) { using (var deprepo = new ConsultationRepository()) { if (id != null) { Consultation _dependent = deprepo.GetById(id); deprepo.Delete(_dependent); } } }
public void CreateConsultationRepositoryTest() { //Arrange Consultation b = ObjectMother.GetConsultation(); IConsultationRepository repository = new ConsultationRepository(); //Action Consultation newConsultation = repository.Save(b); //Assert Assert.IsTrue(newConsultation.Id > 0); }
public int CountConsultations() { int count = 0; var crepo = new ConsultationRepository(); foreach (var c in crepo.GetAll()) { count++; } return(count); }
public void DeleteConsultationRepositoryTest() { //Arrange IConsultationRepository repository = new ConsultationRepository(); //Action var deletedConsultation = repository.Delete(1); //Assert var persistedConsultation = _contextForTest.Consultations.Find(1); Assert.IsNull(persistedConsultation); }
public JsonResult CreateConsult(CreateConsultModel model) { try { ConsultationRepository objConsultationRepo = new ConsultationRepository(); ApiResultModel apiresult = new ApiResultModel(); apiresult = objConsultationRepo.CreateConsult(model); return(Json(new { Success = true, ApiResultModel = apiresult })); } catch (System.Web.Http.HttpResponseException ex) { return(Json(new { Message = ex.Response })); } }
public void RetrieveConsultationRepositoryTest() { //Arrange IConsultationRepository repository = new ConsultationRepository(); //Action Consultation Consultation = repository.Get(1); //Assert Assert.IsNotNull(Consultation); Assert.IsTrue(Consultation.Id > 0); Assert.IsFalse(string.IsNullOrEmpty(Consultation.Name)); Assert.IsFalse(string.IsNullOrEmpty(Consultation.Type)); Assert.IsFalse(string.IsNullOrEmpty(Consultation.Cpf)); }
public ConsultationView PostEditMethod(ConsultationView cv) { using (var deprepo = new ConsultationRepository()) { if (cv.ConsultId == null) { Consultation _consultation = new Consultation { ConsultId = cv.ConsultId, //illness = cv.illness, Symptoms = cv.Symptoms, //PatientSname = cv.PatientSname, ConsultDate = cv.ConsultDate, //PatientFname = cv.PatientFname, PresribedMed = cv.PresribedMed, ConsultTime = cv.ConsultTime, TotalPrice = cv.TotalPrice, Description = cv.ConsultTime, }; deprepo.Insert(_consultation); } else { Consultation _consultation = deprepo.GetById(cv.ConsultId); _consultation.ConsultId = cv.ConsultId; //_consultation.illness = cv.illness; _consultation.Symptoms = cv.Symptoms; _consultation.Symptoms = cv.Symptoms; //_consultation.PatientSname = cv.PatientSname; _consultation.ConsultDate = cv.ConsultDate; // _consultation.PatientFname = cv.PatientFname; _consultation.PresribedMed = cv.PresribedMed; _consultation.ConsultTime = cv.ConsultTime; _consultation.TotalPrice = cv.TotalPrice; _consultation.ConsultTime = cv.ConsultTime; deprepo.Update(_consultation); } return(cv); } }
public List <ConsultationView> GetAllCons() { using (var consultrepo = new ConsultationRepository()) { var user = consultrepo.GetAll().ToList(); return(user.Select(x => new ConsultationView() { ConsultId = x.ConsultId, //illness = x.illness, PatientId = x.PatientId, Symptoms = x.Symptoms, Description = x.Description, //PatientSname = x.PatientSname, ConsultDate = x.ConsultDate, //PatientFname = x.PatientFname, PresribedMed = x.PresribedMed, ConsultTime = x.ConsultTime, ProcedurePrice = x.ProcedurePricee, TestTypePrice = x.TestTypePrice }).ToList()); } }
public void Dispose() { this._userRepository = null; this._permissionRepository = null; this._roleRepository = null; this._rolePermissionRepository = null; this._investigatorRepository = null; this._institutionRepository = null; this._interestAreaRepository = null; this._programRepository = null; this._investigationGroupRepository = null; this._commissionRepository = null; this._draftLawRepository = null; this._conceptRepository = null; this._badLanguageRepository = null; this._tagRepository = null; this._conceptStatusLogRepository = null; this._debateSpeakerRepository = null; this._educationalInstitutionRepository = null; this._knowledgeAreaRepository = null; this._academicLevelRepository = null; this._educationLevelRepository = null; this._snieRepository = null; this._meritRangeRepository = null; this._investigatorCommissionRepository = null; this._investigatorInterestAreaRepository = null; this._configurationRepository = null; this._notificationRepository = null; this._conceptDebateSpeakerRepository = null; this._consultationRepository = null; this._consultationInterestAreaRepository = null; this._draftLawStatusRepository = null; this._periodRepository = null; this._originRepository = null; this._userInstitutionRepository = null; this._consultationTypeRepository = null; this._reasonRejectRepository = null; _context.Dispose(); }
public List <ConsultationView> GetAllConsultations(int Id) { using (var consultrepo = new ConsultationRepository()) { var name = da.Patients.ToList().Find(x => x.PatientId == Id); var user = consultrepo.GetAll().FindAll(x => x.PatientId == Id).ToList(); return(user.Select(x => new ConsultationView() { ConsultId = x.ConsultId, //illness = x.illness, PatientId = x.PatientId, Symptoms = x.Symptoms, Description = x.Description, //PatientSname = x.PatientSname, ConsultDate = x.ConsultDate, //PatientFname = x.PatientFname, PresribedMed = x.PresribedMed, ConsultTime = x.ConsultTime, TotalPrice = x.TotalPrice, }).ToList()); } }
public ConsultationController() { oConsultationRepository = new ConsultationRepository(); }//
public AppointmentController() { oAppointmentRepository = new AppointmentRepository(); oConsultationRepository = new ConsultationRepository(); }
public ConsultationController(IConfiguration configuration) { _consultationRepository = new ConsultationRepository(configuration); }
public void AddConsultation(ConsultationView cv, int id, int[] Symptoms, string[] PresribedMed, int[] Testtype, int[] illness, int[] procedures) { //Objects var ob = new List <Cust>(); var cust = new Cust(); ConsultationPriceBusiness cons = new ConsultationPriceBusiness(); bool collected = false; using (var deprepo = new ConsultationRepository()) { var newdb = deprepo.DbContext(); if (cv.ConsultId == null) { cv.PatientId = id; //Set the date and time for consultation var curr = DateTime.Now; string date = curr.ToString("D"); string time = curr.ToString("hh:m:s: tt"); cv.ConsultDate = curr.Date; cv.ConsultTime = time; //find the patient you're creating consultation for var patient = da.Patients.ToList().Find(x => x.PatientId == id); Guid consul = Guid.NewGuid(); string consultid = consul.ToString("N"); cv.ConsultId = consultid; cv.patientfullname = patient.FullName + " " + patient.Surname; cv.TotalPrice = 400; Consultation consultation = new Consultation() { ConsultId = cv.ConsultId, collected = cv.collected, ConsultTime = cv.ConsultTime, Description = cv.Description, //illness = cv.illness, Symptoms = cv.Symptoms, TotalPrice = cv.TotalPrice, patientfullname = cv.patientfullname, ConsultDate = cv.ConsultDate, PatientId = cv.PatientId, Notes = cv.Notes }; consultation.TestTypes = new List <TestType>(); var custlistitem = cv.Custs.ToList().Count; var procedurelistitem = cv.procedures.ToList().Count; consultation.CustLis = new List <Cust>(); if (custlistitem != 0) { foreach (var iteem in cv.Custs) { if ((iteem.DrugId != null) && (iteem.Dosage != null) && (iteem.Quantity != 0)) { var obs = new Cust(); Guid m = Guid.NewGuid(); string custi = m.ToString("N"); obs.custId = custi; obs.DrugId = iteem.DrugId; obs.Quantity = iteem.Quantity; obs.Dosage = iteem.Dosage; ob.Add(obs); consultation.CustLis.Add(obs); } //da.Custs.Add(obs); //custrep.Create(obs);S } //foreach (var item in ob) //{ // var find = newdb.Drugs.ToList().Find(x => Convert.ToString(x.DrugId) == item.DrugId); // find.DrugQuantity -= item.Quantity; // consultation.TotalPrice += find.DrugPrice; //} } if (Testtype != null) { var testResults = new List <TestType>(); var TestTyp = new TestType(); foreach (var item in Testtype) { var symptomstoadd = newdb.TestTypes.Find(item); //TestTyp.Name = symptomstoadd.Name; //TestTyp.Price = symptomstoadd.Price; //TestTyp.Description = symptomstoadd.Description; testResults.Add(symptomstoadd); ////TestTyp.Consultations.Add(consultation); newdb.TestTypes.Attach(symptomstoadd); consultation.TestTypes.Add(symptomstoadd); } foreach (var item in testResults) { consultation.TotalPrice += item.Price; consultation.TestTypePrice += item.Price; } } if (illness != null) { var Illn = new Illness(); consultation.Illness = new List <Illness>(); foreach (var item in illness) { var symptomstoadd = newdb.Illness.Find(item); //Illn.Illnessid = symptomstoadd.Illnessid; //Illn.Illnessname = symptomstoadd.Illnessname; newdb.Illness.Attach(symptomstoadd); consultation.Illness.Add(symptomstoadd); } } if (Symptoms != null) { var sympto = new Symptoms(); consultation.Symptomses = new List <Symptoms>(); foreach (var item in Symptoms) { var symptomstoadd = newdb.Symptomses.Find(item); //sympto.symptomsname = symptomstoadd.symptomsname; //consultation.Symptomses = new List<Symptoms> { symptomstoadd }; newdb.Symptomses.Attach(symptomstoadd); consultation.Symptomses.Add(symptomstoadd); } } if (procedurelistitem != 0) { consultation.Procedures = new List <Procedure>(); foreach (var item in cv.procedures) { if (item.procedurename != null && item.procedureQuantity != 0) { var symptomstoadd = newdb.Procedures.ToList().Find(x => x.procedureName == item.procedurename); //sympto.symptomsname = symptomstoadd.symptomsname; //consultation.Symptomses = new List<Symptoms> { symptomstoadd }; newdb.Procedures.Attach(symptomstoadd); consultation.Procedures.Add(symptomstoadd); consultation.TotalPrice += symptomstoadd.procedurePrice * item.procedureQuantity; consultation.ProcedurePricee += symptomstoadd.procedurePrice * item.procedureQuantity; } } } consultation.TotalPrice += consultation.TotalPrice * Convert.ToDecimal(0.14); newdb.Consultations.Add(consultation); newdb.SaveChanges(); //dab.SaveChanges(); //consultrep.Insert(consultation); //var delete = testresult.GetById(TestTyp.TestTypeID); //testresult.Delete(delete); //var repo=deprepo.GetById(consultid); //da.SaveChangesAsync(); //deprepo.Update(repo); //cv.ConsultDate = date; //if (Symptoms != null) //{ // cv.Symptomses = new List<Symptoms>(); // foreach (var item in Symptoms) // { // var symptomstoadd = da.Symptomses.Find(int.Parse(item)); // cv.Symptomses.Add(symptomstoadd); // } //} //foreach (var VARIABLE in cv.CustModell.CustList) //{ // VARIABLE.Quantity; // VARIABLE.DrugName; //} //if (PresribedMed != null) //{ // var m = _collection.CustList; // cv.Drugs = new List<Drug>(); // foreach (var item in cv.) // { // var drugstoadd = da.Custs.Find(int.Parse(item)); // m.Add(new Cust({DrugName = item.D} )); // _collection.CustList.Add(cv.custList); // cv.Drugs.Add(drugstoadd); // } //} //da.CollectionDrugs.Add(_collection); //deprepo.Insert(cv); // da.Consultations.Add(coc); // da.SaveChanges(); } } }
public List <ConsultationView> GetAllConsultations() { using (var consultrepo = new ConsultationRepository()) { List <ConsultationView> consviewlist = new List <ConsultationView>(); List <ConsultationView.Cust> conscustlist = new List <ConsultationView.Cust>(); ConsultationView.Illness consillness = new ConsultationView.Illness(); List <ConsultationView.Illness> consillnesslist = new List <ConsultationView.Illness>(); ConsultationView.procedure conprocedure = new ConsultationView.procedure(); List <ConsultationView.procedure> conprocedurelist = new List <ConsultationView.procedure>(); ConsultationView.TestType constexttype = new ConsultationView.TestType(); var user = consultrepo.GetAll().ToList(); foreach (var newitem in user) { ConsultationView consview = new ConsultationView(); consview.symptomses = new List <SymptomsModel>(); consview.Illnesses = new List <ConsultationView.Illness>(); consview.Custs = new List <ConsultationView.Cust>(); consview.ConsultId = newitem.ConsultId; //illness = x.illness, consview.PatientId = newitem.PatientId; consview.Symptoms = newitem.Symptoms; consview.Description = newitem.Description; //PatientSname = x.PatientSname, consview.ConsultDate = newitem.ConsultDate; //PatientFname = x.PatientFname, consview.PresribedMed = newitem.PresribedMed; consview.ConsultTime = newitem.ConsultTime; consview.TotalPrice = newitem.TotalPrice; consview.Notes = newitem.Notes; consview.patientfullname = newitem.patientfullname; consview.resultFile = pr.GetById(newitem.PatientId).File; consview.FileName = pr.GetById(newitem.PatientId).FileName; consview.FileType = pr.GetById(newitem.PatientId).FileType; foreach (var cust in newitem.CustLis) { ConsultationView.Cust conscust = new ConsultationView.Cust(); var custtoadd = custrepo.Getall().Find(x => x.custId == cust.custId); conscust.DrugId = custtoadd.DrugId; conscust.Dosage = custtoadd.Dosage; conscust.custId = custtoadd.custId; conscust.Quantity = custtoadd.Quantity; consview.Custs.Add(conscust); } foreach (var symptom in newitem.Symptomses) { SymptomsModel Symptomsmodel = new SymptomsModel(); var symotomstoadd = symptomrtepo.GetById(symptom.Symptomsid); Symptomsmodel.symptomsname = symotomstoadd.symptomsname; Symptomsmodel.Symptomsid = symotomstoadd.Symptomsid; consview.symptomses.Add(Symptomsmodel); } newitem.Illness = new List <Illness>(); foreach (var ill in newitem.Illness) { ConsultationView.Illness conill = new ConsultationView.Illness(); var symotomstoadd = illrepo.GetById(ill.Illnessid); conill.Illnessname = symotomstoadd.Illnessname; conill.Illnessid = symotomstoadd.Illnessid; consview.Illnesses.Add(conill); } consviewlist.Add(consview); } return(consviewlist); } }
public HttpResponseMessage GetConsultations([FromUri] int importYear) { try { var consultaions = _repository.GetConsultaion(importYear); return(ResponseWrapper.SuccessResponse(new { Applications = consultaions.OfType <ApplicationConsultation>().Select(c => ConsultationRepository.TypeConverter(c)), Projects = consultaions.OfType <ProjectConsultation>().Select(c => ConsultationRepository.TypeConverter(c)) })); } catch (Exception e) { return(ResponseWrapper.ExceptionResponse(e)); } }