[HttpPost] //Then, once GET is done, public IActionResult Provider(ProviderRegisterViewModel Register) { if (ModelState.IsValid) { Login newuser = Register; //Every provider must have login regardless of specialty. _db.Logins.Add(newuser); if (Register.Specialty == "Nurse") { Nurse newNurse = Register; newNurse.LoginId = newuser.LoginId; _db.Nurses.Add(newNurse); //_db.SaveChanges(); } else if (Register.Specialty == "Anesthetist") { Anesthetist newAnesthetist = Register; newAnesthetist.LoginId = newuser.LoginId; _db.Anesthetists.Add(newAnesthetist); //_db.SaveChanges(); } else if (Register.Specialty == "Surgeon") { Surgeon newSurgeon = Register; newSurgeon.LoginId = newuser.LoginId; _db.Surgeons.Add(newSurgeon); //_db.SaveChanges(); } _db.SaveChanges(); //return RedirectToAction("Provider"); } return(RedirectToAction("Index", "Login")); }
public IHttpActionResult PutSurgeon(int id, Surgeon surgeon) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != surgeon.Id) { return(BadRequest()); } db.Entry(surgeon).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SurgeonExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator), Id, SetIdPr1.HasValue ? SetIdPr1.Value.ToString(culture) : null, ProcedureCodingMethod, ProcedureCode?.ToDelimitedString(), ProcedureDescription, ProcedureDateTime.HasValue ? ProcedureDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ProcedureFunctionalType?.ToDelimitedString(), ProcedureMinutes.HasValue ? ProcedureMinutes.Value.ToString(Consts.NumericFormat, culture) : null, Anesthesiologist?.ToDelimitedString(), AnesthesiaCode?.ToDelimitedString(), AnesthesiaMinutes.HasValue ? AnesthesiaMinutes.Value.ToString(Consts.NumericFormat, culture) : null, Surgeon?.ToDelimitedString(), ProcedurePractitioner?.ToDelimitedString(), ConsentCode?.ToDelimitedString(), ProcedurePriority, AssociatedDiagnosisCode?.ToDelimitedString(), ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null, ProcedureDrgType?.ToDelimitedString(), TissueTypeCode != null ? string.Join(Configuration.FieldRepeatSeparator, TissueTypeCode.Select(x => x.ToDelimitedString())) : null, ProcedureIdentifier?.ToDelimitedString(), ProcedureActionCode, DrgProcedureDeterminationStatus?.ToDelimitedString(), DrgProcedureRelevance?.ToDelimitedString(), TreatingOrganizationalUnit != null ? string.Join(Configuration.FieldRepeatSeparator, TreatingOrganizationalUnit.Select(x => x.ToDelimitedString())) : null, RespiratoryWithinSurgery, ParentProcedureId?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public ActionResult DeleteConfirmed(int id) { Surgeon surgeon = db.Surgeons.Find(id); db.Surgeons.Remove(surgeon); db.SaveChanges(); return(RedirectToAction("Index")); }
public Surgeon Edit(Surgeon obj) { List <Surgeon> doctors = _stream.ReadAll().ToList(); doctors[doctors.FindIndex(apt => apt.Id == obj.Id)] = obj; _stream.SaveAll(doctors); return(obj); }
private static void ShowGoodSurgeonsWork() { Console.WriteLine(Resources.Separator); Console.WriteLine(Resources.GoodSurgeon); IGoodSurgeon goodSurgeon = new Surgeon(Resources.DoctorsName, Resources.DoctorsSurname, Resources.Employer); Console.WriteLine(goodSurgeon.Work()); Console.WriteLine("{0} is good - {1}",goodSurgeon.Name,goodSurgeon.Cure() ); }
private static void ShowBadSurgeonsWork() { Console.WriteLine(Resources.Separator); Console.WriteLine(Resources.BadSurgeon); IBadSurgeon badSurgeon = new Surgeon(Resources.DoctorsName, Resources.DoctorsSurname, Resources.Employer); Console.WriteLine(badSurgeon.Work()); Console.WriteLine("{0} is bad - {1}", badSurgeon.Name, badSurgeon.Kill()); }
public void CallingOperateCallsGrabOnForceps() { var forcepsMock = new Mock <Forceps>(); var surgeon = new Surgeon(forcepsMock.Object); surgeon.Operate(); forcepsMock.Verify(f => f.Grab()); }
public override void RemovePerson(Person person) { if (person == nurse) { nurse = null; } else if (person == patient) { patient = null; } else { surgeon = null; } }
private static void ShowCommonSurgeonsWork() { Console.WriteLine(Resources.Separator); Console.WriteLine(Resources.Surgeon); Surgeon someSurgeon = new Surgeon(Resources.DoctorsName,Resources.DoctorsSurname,Resources.Employer); Console.WriteLine(someSurgeon.Work()); Console.WriteLine("{0} succeeded in his surgery: {1}",someSurgeon.Name,someSurgeon.Cure()); Console.WriteLine("{0} failed his surgery: {1}", someSurgeon.Name, someSurgeon.Kill()); }
public ActionResult Edit([Bind(Include = "Id,Name,MobileNo,Email,Password,Address,Specialization")] Surgeon surgeon) { if (ModelState.IsValid) { db.Entry(surgeon).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(surgeon)); }
public IHttpActionResult GetSurgeon(int id) { Surgeon surgeon = db.Surgeons.Find(id); if (surgeon == null) { return(NotFound()); } return(Ok(surgeon)); }
public ActionResult Create([Bind(Include = "Id,Name,MobileNo,Email,Password,Address,Specialization")] Surgeon surgeon) { if (ModelState.IsValid) { db.Surgeons.Add(surgeon); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(surgeon)); }
public IHttpActionResult PostSurgeon(Surgeon surgeon) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Surgeons.Add(surgeon); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = surgeon.Id }, surgeon)); }
public IHttpActionResult DeleteSurgeon(int id) { Surgeon surgeon = db.Surgeons.Find(id); if (surgeon == null) { return(NotFound()); } db.Surgeons.Remove(surgeon); db.SaveChanges(); return(Ok(surgeon)); }
// GET: AdminPanel/Surgeons/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Surgeon surgeon = db.Surgeons.Find(id); if (surgeon == null) { return(HttpNotFound()); } return(View(surgeon)); }
public override void RemovePerson(Person person) { if (person == surgeon) { surgeon = null; } else if (person == nurse) { nurse = null; } else if (person == patient) { patient = null; } }
public bool Delete(Surgeon obj) { List <Surgeon> doctors = _stream.ReadAll().ToList(); Surgeon doctorToRemove = doctors.SingleOrDefault(acc => acc.Id == obj.Id); if (doctorToRemove != null) { doctors.Remove(doctorToRemove); _stream.SaveAll(doctors); return(true); } else { return(false); } }
public IActionResult SoldierLayout(string CodeName) { switch (CodeName) { case "Terminator": { //create a terminator object Terminator term = new Terminator(); //set the soldier object to terminator soldier = term; return(View(term)); } case "RunAndGun": { //create a run and un object RunAndGun gunna = new RunAndGun(); soldier = gunna; return(View(gunna)); } case "SkullCrusher": { //create Skull crusher object SkullCrusher crush = new SkullCrusher(); soldier = crush; return(View(crush)); } case "Surgeon": { //Create surgeon object Surgeon precise = new Surgeon(); soldier = precise; return(View(precise)); } default: { return(View()); } } }
public List <Surgeon> GetAvailableSurgeons(DataTable data) { if (data == null) { return(new List <Surgeon>()); } var result = new List <Surgeon>(); for (int i = 0; i < data.Rows.Count; i++) { var surgeon = new Surgeon { FirstName = data.Rows[i]["first"].ToString(), LastName = data.Rows[i]["last"].ToString(), Specialty = data.Rows[i]["specialty"].ToString() }; result.Add(surgeon); } return(result); }
public Treatment ConvertCSVFormatToEntity(string entityCSVFormat) { string[] tokens = entityCSVFormat.Split(Delimiter.ToCharArray()); long id = long.Parse(tokens[0]); string doctorId = tokens[1]; Doctor doctor = DoctorRepository.Instance.GetDoctorById(long.Parse(doctorId)); DateTime startDate = DateTime.ParseExact(tokens[2], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture); DateTime endDate = DateTime.ParseExact(tokens[3], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture); List <Drug> prescriptionDrugs = new List <Drug>(); string prescriptionDrugString = tokens[4]; string[] prescriptionDrugParts = prescriptionDrugString.Split('|'); if (!prescriptionDrugString.Equals("")) { foreach (string drugID in prescriptionDrugParts) { Drug drug = DrugRepository.Instance.GetDrugById(long.Parse(drugID)); prescriptionDrugs.Add(drug); } } Prescription prescription = new Prescription(prescriptionDrugs); ScheduledSurgery scheduledSurgery = new ScheduledSurgery(); if (!tokens[5].Equals("")) { DateTime surgeryStartDate = DateTime.ParseExact(tokens[5], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture); DateTime surgeryEndDate = DateTime.ParseExact(tokens[6], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture); string causeForSurgery = tokens[7]; Surgeon surgeon = SurgeonRepository.Instance.GetSurgeonById(long.Parse(tokens[8])); scheduledSurgery = new ScheduledSurgery(surgeryStartDate, surgeryEndDate, causeForSurgery, surgeon); } Specialist specialist = SpecialistRepository.Instance.GetSpecialistById(long.Parse(tokens[9])); string causeForSpecialistAppointment = tokens[10]; SpecialistAppointment specialistAppointment = new SpecialistAppointment(causeForSpecialistAppointment, specialist); string causeForHospitalTreatment = tokens[11]; List <Drug> hospitalTreatmentDrugs = new List <Drug>(); string hospitalTreatmentDrugsString = tokens[12]; string[] hospitalTreatmentDrugsParts = hospitalTreatmentDrugsString.Split('|'); if (!hospitalTreatmentDrugsString.Equals("")) { foreach (string drugID in hospitalTreatmentDrugsParts) { Drug drug = DrugRepository.Instance.GetDrugById(long.Parse(drugID)); hospitalTreatmentDrugs.Add(drug); } } ReferralToHospitalTreatment referralToHospitalTreatment = new ReferralToHospitalTreatment(causeForHospitalTreatment, hospitalTreatmentDrugs); string diagnosis = tokens[13]; string review = tokens[14]; DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview(diagnosis, review); return(new Treatment(prescription, scheduledSurgery, diagnosisAndReview, referralToHospitalTreatment, startDate, endDate, id, doctor, specialistAppointment)); }
public Surgeon Save(Surgeon obj) { _stream.AppendToFile(obj); return(obj); }
static void Main() { /* * DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview("Nova dijagnoza", "Nova procedura"); * DiagnosisAndReview diagnosisAndReview2 = new DiagnosisAndReview("Nova dijagnoza2", "Nova procedura2"); * DiagnosisAndReviewRepository.Instance.Save(diagnosisAndReview); * DiagnosisAndReviewRepository.Instance.Save(diagnosisAndReview2); * // DiagnosisAndReviewRepository.Instance.Delete(2); * List<DiagnosisAndReview> diagnosisAndReviews = DiagnosisAndReviewRepository.Instance.GetAll(); * Console.WriteLine("Lista dijagnoza:"); * foreach (DiagnosisAndReview dAndR in diagnosisAndReviews) * { * Console.WriteLine(dAndR); * } * // Console.WriteLine("Dijagnoza id == 3:" + DiagnosisAndReviewRepository.Instance.GetDiagnosisAndReview(3).Id); * * Drug drug1 = new Drug(null, "Panklav 200mg", "Opis Panklava", true, 20); * Drug drug2 = new Drug(null, "Aerius 50mg", "Opis Aeriusa", false, 5); * List<Drug> drugs = new List<Drug>(); * drugs.Add(drug1); * drugs.Add(drug2); * * Prescription prescription = new Prescription(drugs); * PrescriptionRepository.Instance.Save(prescription); * List<Prescription> prescriptions = PrescriptionRepository.Instance.GetAll(); * PrescriptionRepository.Instance.Delete(3); * foreach (Prescription p in prescriptions) * { * Console.WriteLine(p); * } * } * * DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview("Nova dijagnoza", "Nova procedura"); * Drug drug1 = new Drug(null, "Panklav 200mg", "Opis Panklava", true, 20); * Drug drug2 = new Drug(null, "Aerius 50mg", "Opis Aeriusa", false, 5); * List<Drug> drugs = new List<Drug>(); * drugs.Add(drug1); * drugs.Add(drug2); * Prescription prescription = new Prescription(drugs); * Treatment treatment = new Treatment(prescription, new ScheduledSurgery(DateTime.Today, DateTime.Now, "Razlog operacije", new Surgeon("Pera", "Peric", SurgicalSpecialty.CARDIOTHORACIC)), diagnosisAndReview, new ReferralToHospitalTreatment(DateTime.Today, DateTime.Now, "Razlog bolnickog lecenja"), DateTime.Today, DateTime.Now, new Doctor("Marko", "Markovic")); * TreatmentRepository.Instance.Save(treatment); */ /* Blog blog1 = new Blog("naslov 1", "blablbalblalba", DateTime.Now); * Blog blog2 = new Blog("naslov 2", "blablbalblalba", DateTime.Now.AddHours(2)); * BlogController.Instance.Create(blog1); * BlogController.Instance.Create(blog2); * BlogController.Instance.GetBlogByTitle("naslov 1"); * BlogController.Instance.Delete(blog1); * blog2.Text = "Promenjen text"; * BlogController.Instance.Edit(blog2);*/ Drug drug1 = new Drug(213, null, "Panklav 200mg", "Opis Panklava", true, 20); Drug drug2 = new Drug(312, null, "Aerius 50mg", "Opis Aeriusa", false, 5); List <Drug> drugs = new List <Drug>(); drugs.Add(drug1); drugs.Add(drug2); DrugRepository.Instance.Save(drug1); DrugRepository.Instance.Save(drug2); Doctor doctor = new Doctor(123, "Marko", "Markovic", Model.SystemUsers.Gender.MALE, DateTime.Now); DoctorController.Instance.Create(doctor); // DoctorRepository.Instance.Save(doctor); DateTime startDate = DateTime.Now; DateTime endDate = DateTime.Now.AddDays(1); Prescription prescription = new Prescription(drugs); Surgeon surgeon = new Surgeon(222, "Pera", "Peric", Model.SystemUsers.Gender.FEMALE, DateTime.Now, SurgicalSpecialty.CARDIOTHORACIC); SurgeonController.Instance.Create(surgeon); // SurgeonRepository.Instance.Save(surgeon); ScheduledSurgery scheduledSurgery = new ScheduledSurgery(startDate, endDate, "Razlog za operaciju", surgeon); Specialist specialist = new Specialist(333, "Ana", "Jovanovic", Model.SystemUsers.Gender.FEMALE, DateTime.Now, Specialization.ENDOCRINOLOGY); SpecialistController.Instance.Create(specialist); // SpecialistRepository.Instance.Save(specialist); SpecialistAppointment specialistAppointment = new SpecialistAppointment("Razlog za specijalistu", specialist); ReferralToHospitalTreatment referralToHospitalTreatment = new ReferralToHospitalTreatment("Razlog za bolnicko lecenje", drugs); DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview("Dijagnoza", "Procedura"); Patient patient = new Patient("Sima", "Simic", 345); Treatment treatment = new Treatment(prescription, scheduledSurgery, diagnosisAndReview, referralToHospitalTreatment, startDate, endDate, 23, doctor, specialistAppointment); // TreatmentController.Instance.Create(patient, treatment); TreatmentRepository.Instance.Save(treatment); Treatment treatment2 = new Treatment(prescription, new ScheduledSurgery(), diagnosisAndReview, referralToHospitalTreatment, startDate, endDate, 23, doctor, specialistAppointment); // TreatmentController.Instance.Create(patient, treatment); TreatmentRepository.Instance.Save(treatment2); Console.WriteLine(TreatmentController.Instance.GetTreatment(treatment2).Prescription.Drugs[0].Name); Treatment treatment1 = TreatmentRepository.Instance.GetTreatment(23); foreach (Drug oneDrug in treatment1.Prescription.Drugs) { Console.WriteLine(oneDrug.Name); } Console.WriteLine("\n\n"); foreach (Drug oneDrug in treatment1.ReferralToHospitalTreatment.Drugs) { Console.WriteLine(oneDrug.Name); } Console.WriteLine("\n\n"); Console.WriteLine(treatment1.Doctor.NameAndSurname); Console.WriteLine(treatment1.ScheduledSurgery.Surgeon.NameAndSurname); Console.WriteLine(treatment1.SpecialistAppointment.Doctor.NameAndSurname); // DoctorDrugService doctorDrugService = new DoctorDrugService(new DrugService()); // doctorDrugService.LowerQuantity(drug1); DoctorDrugController doctorDrugController = new DoctorDrugController(new DrugController()); doctorDrugController.LowerQuantity(drug1); // ManagerDrugService managerDrugService = new ManagerDrugService(new DrugService()); // managerDrugService.AddDrug("Prozak", 15); ManagerDrugController managerDrugController = new ManagerDrugController(new DrugController()); managerDrugController.AddDrug("Prozak", 22); }
public ScheduledSurgery ScheduleSurgery(Model.Treatment.Treatment treatment, DateTime startDate, DateTime endDate, String cause, Surgeon surgeon, ExamOperationRoom room) { return(_service.ScheduleSurgery(treatment, startDate, endDate, cause, surgeon, room)); }
public ScheduledSurgery ScheduleSurgery(Treatment treatment, DateTime startDate, DateTime endDate, string cause, Surgeon surgeon, ExamOperationRoom room) { ScheduledSurgery scheduledSurgery = new ScheduledSurgery(startDate, endDate, cause, surgeon); treatment.ScheduledSurgery = scheduledSurgery; MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id); Patient patient = medicalRecord.Patient; Appointment surgery = new Appointment(surgeon, patient, room, TypeOfAppointment.SURGERY, startDate, endDate); AppointmentRepository.Instance.Save(surgery); return(treatment.ScheduledSurgery); }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 17, Configuration.FieldSeparator), Id, SetIdPr1.HasValue ? SetIdPr1.Value.ToString(culture) : null, ProcedureCodingMethod, ProcedureCode?.ToDelimitedString(), ProcedureDescription, ProcedureDateTime.HasValue ? ProcedureDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ProcedureFunctionalType, ProcedureMinutes.HasValue ? ProcedureMinutes.Value.ToString(Consts.NumericFormat, culture) : null, Anesthesiologist != null ? string.Join(Configuration.FieldRepeatSeparator, Anesthesiologist.Select(x => x.ToDelimitedString())) : null, AnesthesiaCode, AnesthesiaMinutes.HasValue ? AnesthesiaMinutes.Value.ToString(Consts.NumericFormat, culture) : null, Surgeon != null ? string.Join(Configuration.FieldRepeatSeparator, Surgeon.Select(x => x.ToDelimitedString())) : null, ProcedurePractitioner != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedurePractitioner.Select(x => x.ToDelimitedString())) : null, ConsentCode?.ToDelimitedString(), ProcedurePriority, AssociatedDiagnosisCode?.ToDelimitedString(), ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }