Пример #1
0
        public static void DischargedPatient(this Patient patient, string who)  //Discharged User from hospital
        {
            EventLog ev = new EventLog()
            {
                EventText = "Discharged Patient from hospital"
            };
            ApplicationUser user;

            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                patient                      = patient.FindPatientById();
                ev.UserId                    = patient.UserId;
                patient.User.Status          = "discharged";
                patient.User.DateOfExcluding = DateTime.Now;
                user = patient.User;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
            }
            Doctor doc = new Doctor()
            {
                DoctorId = Guid.Parse(patient.DoctorId)
            };

            doc = doc.DoctorByDoctorId();
            doc.NumberOfPatients--;
            ev.FixEvent(who);
            EditUsers.Doctor(doc, who);
        }
Пример #2
0
        public static void Patient(Patient patient, string who)  //Add new patien and create medical card
        {
            EventLog ev = new EventLog() { EventText = "Add new patient", UserId = patient.UserId };
            MedicalCard md = new MedicalCard();
            md.CardId = Guid.Parse(patient.MedicalCardID);
            md.UserId = patient.UserId;
            md.Health_Complaint = patient.Health_Complaint;            
            Doctor doc = new Doctor() { DoctorId = Guid.Parse(patient.DoctorId)};
            Doctor nurse = doc;            
            doc = doc.DoctorByDoctorId();
            nurse = nurse.DoctorByDoctorId();
            doc.NumberOfPatients++;
            nurse.NumberOfPatients++;
            EditUsers.Doctor(doc, who);
            EditUsers.Doctor(nurse, who);

            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                db.Patients.Add(patient);
                db.MedicalCard.Add(md);
                db.SaveChanges();
            }

            ev.FixEvent(who);
        }