public bool SavePrint(RawEarPrint rawEarPrint, int PatientId) { try { //Henter specifik techspec tilhørende det givne RawEarPrint og PCPR. TecnicalSpec Techspec = _dbContext.TecnicalSpecs.Single((x => x.PatientFK == PatientId && x.EarSide == rawEarPrint.EarSide)); //Sætter id i RawEarPrint rawEarPrint.TecnicalSpecFK = Techspec.HATechinalSpecID; //Gemmer RawEarPrint _dbContext.RawEarPrints.Add(rawEarPrint); _dbContext.SaveChanges(); // Sætter printed parameteren til true Techspec.Printed = true; _dbContext.TecnicalSpecs.Update(Techspec); _dbContext.SaveChanges(); return(true); } catch { return(false); } #endregion }
/// <summary> /// Der gemmes et specifikt rawEarScan i DB og efterfølgende returneres en bool som fortæller om det er gjort. /// </summary> /// <param name="rawEarPrint"></param> /// <param name="CPR"></param> /// <returns></returns> public bool SavePrint(RawEarPrint rawEarPrint, string CPR) { try { //Henter specifik techspec tilhørende det givne RawEarPrint og CPR. TecnicalSpec Techspec = _dbContext.TecnicalSpecs.OrderBy(x => x.CreateDate).Last(x => x.CPR == CPR && x.EarSide == rawEarPrint.EarSide); //Sætter id i RawEarPrint rawEarPrint.HATechnicalSpecID = Techspec.HATechinalSpecID; //Gemmer RawEarPrint _dbContext.RawEarPrints.Add(rawEarPrint); _dbContext.SaveChanges(); // Sætter printed parameteren til true Techspec.Printed = true; _dbContext.TecnicalSpecs.Update(Techspec); _dbContext.SaveChanges(); return(_dbContext.RawEarPrints.Contains(rawEarPrint)); } catch { return(false); } }
public RawEarPrint StartPrint(int printTechID, List <RawEarScan> earScans) { earPrint = new RawEarPrint(); earPrint.StaffID = printTechID; earPrint.PrintDate = timeStamp.getDate(); Thread.Sleep(3000); return(earPrint); }
public bool DBPrint(FullRawEarPrint fullRawEarPrint) { RawEarPrint print; foreach (RawEarScan rawEarScan in fullRawEarPrint.EarScans) { print = new RawEarPrint(); print.StaffLoginFK = fullRawEarPrint.PrintTechID; print.EarSide = rawEarScan.EarSide; print.TecnicalSpecFK = rawEarScan.TecnicalSpecFK; print.PrintDate = DateTime.Now; db.SavePrint(print); } return(true); }
public bool DBPrint(FullRawEarPrint fullRawEarPrint) { string CPR = fullRawEarPrint.CPR; RawEarPrint print; foreach (RawEarScan rawEarScan in fullRawEarPrint.EarScans) { print = new RawEarPrint(); print.StaffID = fullRawEarPrint.PrintTechID; print.EarSide = rawEarScan.EarSide; print.HATechnicalSpecID = rawEarScan.HATechnicalSpecID; print.PrintDate = DateTime.Now; db.SavePrint(print, CPR); } return(true); }
public void UC5AddToPrintQueueCompleted(object sender, RunWorkerCompletedEventArgs e) { HentisRunning = false; Loading.Spin = false; Loading.Visibility = Visibility.Collapsed; //FindAllPatientsB.Visibility = Visibility.Visible; printedEarPrint = (RawEarPrint)e.Result; if (printedEarPrint == null) { MessageBox.Show("Øreprop kunne ikke tilføjes til printkøen"); } else { MessageBox.Show("Øreproppen er tilføjet til printkøen"); uc5_print.DBPrint(fullRawEarPrint); } }
/// <summary> /// Der gemmes et specifikt rawEarScan i DB og efterfølgende returneres en bool som fortæller om det er gjort. /// </summary> /// <param name="rawEarPrint"></param> /// <returns></returns> public bool SavePrint(RawEarPrint rawEarPrint) { try { _dbContext.RawEarPrints.Add(rawEarPrint); _dbContext.SaveChanges(); TecnicalSpec tecnical = _dbContext.TecnicalSpecs.OrderBy(x => x.CreateDate).Last(x => x.HATechinalSpecID == rawEarPrint.TecnicalSpecFK && x.EarSide == rawEarPrint.EarSide); tecnical.Printed = true; _dbContext.TecnicalSpecs.Update(tecnical); _dbContext.SaveChanges(); return(_dbContext.RawEarPrints.Contains(rawEarPrint)); } catch { return(false); } }
static void Main(string[] args) { ClinicDBContext dbContext = new ClinicDBContext(); ClinicianDBLogic clinicianDbLogic = new ClinicianDBLogic(dbContext); ProgramHL7 program = new ProgramHL7(); program.metode(); #region Create (CRUD) #region Create patient Patient newPatient = new Patient() { CPR = "123456-2332", Name = "Accepttest", Lastname = "Patient", Adress = "Testvej 1", zipcode = 4321, Age = 20, City = "TestBy", Email = "*****@*****.**", MobilNummer = "30405060" }; clinicianDbLogic.CreatePatient(newPatient); #endregion #region Create Staff StaffLogin newStaffLogin = new StaffLogin() { Name = "Kliniker", Password = "******", StaffStatus = Status.Clinician, }; //clinicianDbLogic.CreateStaffLogin(newStaffLogin); StaffLogin nStaffLogin = new StaffLogin() { Name = "Tekniker", Password = "******", StaffStatus = Status.Technician }; //clinicianDbLogic.CreateStaffLogin(nStaffLogin); #region Create EarCast 2 EarCast newCast = new EarCast() { EarSide = Ear.Right, }; //clinicianDbLogic.CreateEarCast(newCast); #endregion #endregion #region Create GeneralSpec GeneralSpec newGeneralSpecL = new GeneralSpec() { //CPR = "111111-1111", Type = Material.AntiAllergi, Color = PlugColor.Honey, EarSide = Ear.Left, CreateDate = DateTime.Now, StaffLoginFK = 1, }; //clinicianDbLogic.CreateNewGeneralSpec(newGeneralSpecL); GeneralSpec newGeneralSpecR = new GeneralSpec() { //CPR = "111111-1111", Type = Material.AntiAllergi, Color = PlugColor.Honey, EarSide = Ear.Right, CreateDate = DateTime.Now, StaffLoginFK = 1, }; //clinicianDbLogic.CreateNewGeneralSpec(newGeneralSpecR); #endregion #region Create TecnicalSpec TecnicalSpec newTecnicalSpecR = new TecnicalSpec() { EarSide = Ear.Right, CreateDate = DateTime.Now, StaffLoginFK = 1, //CPR = "111111-1111" }; //clinicianDbLogic.CreateTechnicalSpec(newTecnicalSpecR); TecnicalSpec newTecnicalSpecL = new TecnicalSpec() { EarSide = Ear.Left, CreateDate = DateTime.Now, StaffLoginFK = 1, //CPR = "111111-1111", }; //clinicianDbLogic.CreateTechnicalSpec(newTecnicalSpecL); #endregion #region Create rawEarPrint RawEarPrint print = new RawEarPrint() { EarSide = Ear.Left, StaffLoginFK = 1, PrintDate = DateTime.Now, }; //clinicianDbLogic.SavePrint(print, "111111-1111"); #endregion #endregion #region Delete (CRUD) #region Delete patient //Patient DeletePatient = new Patient() //{ // PCPR = "110396-0000", //}; //clinicianDbLogic.DeletePatient(DeletePatient); #endregion #region Delete EarCast //EarCast DeleteEarCast = new EarCast() //{ // EarCastID = 2, //}; // clinicianDbLogic.DeleteEarCast(DeleteEarCast); #endregion #endregion #region Update (CRUD) #region Update patient //Patient UpdatePatient = new Patient() //{ // PCPR = "110396-0000", // Lastname = "Nedergaard Enevoldsen", // Adress = "Trøjbordvej 72", //}; //clinicianDbLogic.UpdatePatient(UpdatePatient); #endregion #endregion #region Retrive (CRUD) #region Retrieve Alle patienter //List<Patient> Patients = clinicianDbLogic.GetAllPatients(); //foreach (Patient patient in Patients) //{ // Console.WriteLine(patient.Name); //} #endregion #region Retrieve Patient tilhørende øre afstøbning //Patient Patient = clinicianDbLogic.GetPatientFromEarCast(2); //Console.WriteLine(Patient.Name); #endregion #region Create afstøbning //EarCast earCast = clinicianDbLogic.Get //Patient Patient = clinicianDbLogic.GetPatient("250997-0000"); // Console.WriteLine(Patient.Name); #endregion #region Retrieve Patient tilhørende øre afstøbning //Patient earPatient = clinicianDbLogic.GetPatientWithEarCast("250997-0000"); //foreach (EarCast earPatientEarCast in earPatient.EarCasts) //{ // Console.WriteLine($"PCPR: {earPatientEarCast.PCPR} Øre side: {earPatientEarCast.EarSide.ToString()} ID: {earPatientEarCast.EarCastID}"); //} #endregion #region Hent en patient med alle parametre udfyldt //Patient patient = clinicianDbLogic.GetPatientWithGeneralSpecAndTechnicalSpec("111111-1111"); #endregion #endregion }
/// <summary> /// Henter Process informationerne til det give PCPR. Metoden vil altid hente de nyeste informationer. /// </summary> /// <param name="CPR"></param> /// <returns></returns> public List <ProcesSpec> GetProcesInfo(string CPR) { Patient patient = GetPatient(CPR); List <ProcesSpec> procesSpecs = new List <ProcesSpec>(); ProcesSpec procesSpecL = new ProcesSpec(); ProcesSpec procesSpecR = new ProcesSpec(); try { try { //Venstre //Henter generalspec GeneralSpec generalSpecL = _dbContext.GeneralSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.PatientFK == patient.PatientId && x.EarSide == Ear.Left); if (generalSpecL.CreateDate != null) { procesSpecL.GeneralSpecCreateDateTime = generalSpecL.CreateDate; procesSpecL.ClinicianId = generalSpecL.StaffLoginFK; TecnicalSpec TechspecL = _dbContext.TecnicalSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.GeneralSpecFK == generalSpecL.HAGeneralSpecID); //Henter techspec if (TechspecL.CreateDate != null) { procesSpecL.TechSpecCreateDateTime = TechspecL.CreateDate; procesSpecL.TechnicalId = TechspecL.StaffLoginFK; procesSpecL.Printed = TechspecL.Printed; //Henter EarScan TechspecL.RawEarScan = _dbContext.RawEarScans.OrderBy(x => x.ScanDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecL.HATechinalSpecID); if (TechspecL.RawEarScan != null) { procesSpecL.scanTechId = TechspecL.StaffLoginFK; procesSpecL.scanDateTime = TechspecL.CreateDate; } //Henter Earprint if (procesSpecL.Printed) { RawEarPrint rawEarPrint = _dbContext.RawEarPrints.OrderBy(x => x.PrintDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecL.HATechinalSpecID && x.EarSide == Ear.Left); ; procesSpecL.PrintDateTime = rawEarPrint.PrintDate; procesSpecL.PrintTechId = rawEarPrint.StaffLoginFK; } } } procesSpecs.Add(procesSpecL); } catch { procesSpecs.Add(procesSpecL); } try { //Højre //Henter GeneralSpec GeneralSpec generalSpecR = _dbContext.GeneralSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.PatientFK == patient.PatientId && x.EarSide == Ear.Right); if (generalSpecR.CreateDate != null) { procesSpecR.GeneralSpecCreateDateTime = generalSpecR.CreateDate; procesSpecR.ClinicianId = generalSpecR.StaffLoginFK; TecnicalSpec TechspecR = _dbContext.TecnicalSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.GeneralSpecFK == generalSpecR.HAGeneralSpecID); //Henter techspec if (TechspecR.CreateDate != null) { procesSpecR.TechSpecCreateDateTime = TechspecR.CreateDate; procesSpecR.TechnicalId = TechspecR.StaffLoginFK; procesSpecR.Printed = TechspecR.Printed; //Henter EarScan TechspecR.RawEarScan = _dbContext.RawEarScans.OrderBy(x => x.ScanDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecR.HATechinalSpecID); if (TechspecR.RawEarScan != null) { procesSpecR.scanTechId = TechspecR.StaffLoginFK; procesSpecR.scanDateTime = TechspecR.CreateDate; } //Henter Earprint if (procesSpecR.Printed) { RawEarPrint rawEarPrint = _dbContext.RawEarPrints.OrderBy(x => x.PrintDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecR.HATechinalSpecID && x.EarSide == Ear.Right); procesSpecR.PrintDateTime = rawEarPrint.PrintDate; procesSpecR.PrintTechId = rawEarPrint.StaffLoginFK; } } } procesSpecs.Add(procesSpecR); } catch { procesSpecs.Add(procesSpecR); } return(procesSpecs); } catch { return(null); } }
public bool SavePrint(RawEarPrint rawEarPrint, string CPR) { return(true); }