public void EditResidentPatient()
        {
            if (EditRoomNumberComboBox == null || EditPatientDepartment == null)
            {
                textValidation = "Cannot Have Empty Values";
                return;
            }
            Hospital.Patients[PatientID].Name    = PatientName = EditPatientNameTextBox;
            Hospital.Patients[PatientID].Address = PatientAddress = EditPatientAddressTextBox;
            PatientBirthDate = EditPatientBirthDatePicker.ToShortDateString();
            Hospital.Patients[PatientID].BirthDate = EditPatientBirthDatePicker;
            PatientDepartment = Hospital.Departments[EditPatientDepartment.Key].Name;
            ((ResidentPatient)Hospital.Patients[PatientID]).Department.Patients.Remove(PatientID);
            ((ResidentPatient)Hospital.Patients[PatientID]).Department = Hospital.Departments[EditPatientDepartment.Key];
            ((ResidentPatient)Hospital.Patients[PatientID]).Department.Patients.Add(PatientID, Hospital.Patients[PatientID]);
            ((ResidentPatient)Hospital.Patients[PatientID]).Room.Patients.Remove(PatientID);
            ((ResidentPatient)Hospital.Patients[PatientID]).Room = Hospital.Rooms[EditRoomNumberComboBox.Key];
            Hospital.Rooms[EditRoomNumberComboBox.Key].addPatient(Hospital.Patients[PatientID]);

            PatientRoomNumber = EditRoomNumberComboBox.Value;

            NursesList.Clear();
            foreach (Nurse nurse in ((ResidentPatient)Hospital.Patients[PatientID]).Room.Nurses.Values)
            {
                NursesList.Add(new ComboBoxPairs(nurse.ID, nurse.Name));
            }
            NursesNumber = "Nurses:" + ((ResidentPatient)Hospital.Patients[PatientID]).Room.Nurses.Count().ToString();

            HospitalDB.UpdatePatient(Hospital.Patients[PatientID]);
            Home.ViewModel.CloseRootDialog();
        }
コード例 #2
0
        // SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-89LF16D;Initial Catalog=Hospital;Integrated Security=True");

        private void ultraBtnSave_Click(object sender, EventArgs e)
        {
            objHospitalDB = new HospitalDB();
            Bed    objBed    = new Bed(objHospitalDB);
            BedRow objBedRow = new BedRow();

            objBedRow.BedName    = ultraTextBedName.Text;
            objBedRow.BedType    = ultraComboBed.Text;
            objBedRow.RatePerDay = Convert.ToInt32(ultraTextRatePerDay.Text);

            if (strFormMode == "NEW")
            {
                if (MessageBox.Show("Are you sure you want to save", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    objBed.Insert(objBedRow);
                    this.Hide();
                }
            }

            /*SqlCommand query = objHospitalDB.CreateCommand("insert into Bed Values('" + ultraTextBedName.Text + "','" + ultraTextRatePerDay.Text + "','" + ultraComboBed.Text + "')", false);
             * // SqlDataAdapter sda = new SqlDataAdapter(query, con);
             * int p = query.ExecuteNonQuery();
             * MessageBox.Show(p + "Value is registerd");
             * this.Hide();*/

            else
            {
                objBedRow.Bed_ID = Convert.ToInt32(this.id);
                objBed.Update(objBedRow);
            }
        }
コード例 #3
0
        private void ultraButtonRefreshBed_Click(object sender, EventArgs e)
        {
            dsBedList = new DataSet();
            try
            {
                objHospitalDB = new HospitalDB();
                SqlCommand cmd = objHospitalDB.CreateCommand("select * from BedInfo ", false);

                SqlDataAdapter sda = new SqlDataAdapter();
                sda.SelectCommand = cmd;
                sda.Fill(dsBedList);
                ultraGridBedList.DataSource = dsBedList.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if (objHospitalDB != null)
                {
                    objHospitalDB.Dispose();
                }
            }


            //conn.Open();
            //ultraGridBedList.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.RefreshDisplay);



            //conn.Close();
        }
コード例 #4
0
        private void ultraBtnSearch_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            if (ultraComboSearch.Value.ToString() == "Date Of Visit")
            {
                objHospitalDB = new HospitalDB();

                // Visit objVisit = new Visit(objHospitalDB);
                // string Name = ultraDateTimeSearch.Text;
                // DateTime DOB = System.Convert.ToDateTime(ultraDateTimeEditorPatient.Text);
                Visit      objVisit = new Visit(objHospitalDB);
                SqlCommand cmd      = objHospitalDB.CreateCommand("Visit_SearchByDateVisit");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@DateOfVisit", ultraDateTimeSearch.Value);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                sda.Fill(ds);
                //dt = objVisit.GetAllAsDataTable();
                ultraGridVisit.DataSource = ds.Tables[0];

                /* DataView dvVisit = dtVisit.DefaultView;
                 * dvVisit.RowFilter = "DateOfVisit = #" + Convert.ToDateTime(ultraDateTimeSearch.Value).ToString("MM/dd/yyyy") + "#";
                 * ultraGridVisit.DataSource = dvVisit.ToTable();*/
            }
            else if (ultraComboSearch.Value.ToString() == "Date Of Discharge")
            {
                SqlCommand cmd = objHospitalDB.CreateCommand("Visit_SearchByDateDischarge");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@DateOfDischarge", ultraDateTimeSearch.Value);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                sda.Fill(ds);
                ultraGridVisit.DataSource = ds.Tables[0];
            }

            else if (ultraComboSearch.Value.ToString() == "Patient Name")
            {
                objHospitalDB = new HospitalDB();

                // Visit objVisit = new Visit(objHospitalDB);
                string Name = ultraTextSearch.Text;
                // DateTime DOB = System.Convert.ToDateTime(ultraDateTimeEditorPatient.Text);
                DataTable  dt  = new DataTable();
                SqlCommand cmd = objHospitalDB.CreateCommand("Visit_SearchByName");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@PatientName", Name);
                //cmd.Parameters.AddWithValue("@DateOfBirth", DOB);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                sda.Fill(ds);
                //dt = objVisit.GetAllAsDataTable();
                ultraGridVisit.DataSource = ds.Tables[0];

                // ultraGridVisit.DataSource= objVisit.Search(objVisitRow);
                //  dvVisit.RowFilter= Convert.ToString(objVisit.//Search(objVisitRow));
                // ultraGridVisit.DataSource=  dvVisit.ToTable();

                /* DataView dvVisit = dtVisit.DefaultView;
                 * dvVisit.RowFilter = "PatientName like '" + ultraTextSearch.Text + "%'";
                 * ultraGridVisit.DataSource = dvVisit.ToTable();*/
            }
        }
コード例 #5
0
        private void ultraButtonRegister_Click(object sender, EventArgs e)
        {
            objhospdb = new HospitalDB();
            PatientVisitInfo    objpatientVisitInfo    = new PatientVisitInfo(objhospdb);
            PatientVisitInfoRow objPatientVisitInfoRow = new PatientVisitInfoRow();

            objPatientVisitInfoRow.PatientType     = Convert.ToInt32(ultraComboPatientType.Text);
            objPatientVisitInfoRow.DoctorId        = Convert.ToInt32(ultraComboEditorDoctorId.Text);
            objPatientVisitInfoRow.BedId           = Convert.ToInt32(ultraComboEditorBedId.Text);
            objPatientVisitInfoRow.DateofVisit     = ultraDateTimeEditorDOV.DateTime;
            objPatientVisitInfoRow.DateofDischarge = ultraDateTimeEditorDOD.DateTime;
            objPatientVisitInfoRow.Symptoms        = ultraTextEditorSymptoms.Text;
            objPatientVisitInfoRow.Disease         = ultraTextEditorDisease.Text;
            objPatientVisitInfoRow.Treatment       = ultraTextEditorTreatment.Text;


            objpatientVisitInfo.Insert(objPatientVisitInfoRow);

            /*
             * SqlCommand cmd = objhospdb.CreateCommand("insert into PatientVisitInfo values('" + ultraComboPatientType .Text+ "', '"+ultraComboEditorDoctorId.Text+ "','" + ultraComboEditorBedId.Text + "','" + ultraDateTimeEditorDOV .Text+ "','"+ ultraDateTimeEditorDOD .Text+ "','"+ ultraTextEditorSymptoms .Text+ "','"+ ultraTextEditorDisease .Text+ "','"+ ultraTextEditorTreatment .Text+ "')");
             * int o = cmd.ExecuteNonQuery();
             * conn.Close();*/

            MessageBox.Show(":Registered");
            openfrmMain();
        }
コード例 #6
0
        private void ultraBtnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                objHospitalDB = new HospitalDB();
                Doctor    objDoctor    = new Doctor(objHospitalDB);
                DoctorRow objDoctorRow = new DoctorRow();
                ultraGridDoc.DataSource = objDoctor.GetAll();

                /* dsDoctor = new DataSet();
                 * SqlCommand cmd = objHospitalDB.CreateCommand("Select * from [Hospital].[dbo].[Doctor]", false);
                 * SqlDataAdapter sda = new SqlDataAdapter();
                 * sda.SelectCommand = cmd;
                 * sda.Fill(dsDoctor);
                 * ultraGridDoc.DataSource = dsDoctor.Tables[0];*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if (objHospitalDB != null)
                {
                    objHospitalDB.Dispose();
                }
            }
        }
コード例 #7
0
        public static void InitializeAppointments()
        {
            List <Appointment> appointmentList = HospitalDB.FetchAppointments();

            foreach (Appointment appointment in appointmentList)
            {
                // Fetching Appointment Patient
                String patientID = HospitalDB.FetchAppointmentPatient(appointment.ID);
                appointment.Patient = (AppointmentPatient)Patients[patientID];
                ((AppointmentPatient)Patients[patientID]).addAppointment(appointment);

                // Fetching Appointment Doctor
                String doctorID = HospitalDB.FetchAppointmentDoctor(appointment.ID);
                appointment.Doctor = (Doctor)Employees[doctorID];
                ((Doctor)Employees[doctorID]).addAppointment(appointment);

                // Adding Doctor, Patient Relations
                if (((Doctor)Employees[doctorID]).Patients.ContainsKey(patientID) == false)
                {
                    ((Doctor)Employees[doctorID]).addPatient(Patients[patientID]);
                }

                if (((AppointmentPatient)Patients[patientID]).Doctors.ContainsKey(doctorID) == false)
                {
                    Patients[patientID].assignDoctor((Doctor)Employees[doctorID]);
                }

                Appointments.Add(appointment.ID, appointment);
            }
        }
コード例 #8
0
        public static async void InitializeData()
        {
            Employees    = new Dictionary <String, Employee>();
            Patients     = new Dictionary <String, Patient>();
            Appointments = new Dictionary <String, Appointment>();
            Departments  = new Dictionary <String, Department>();
            Rooms        = new Dictionary <String, Room>();
            Config       = new Config
            {
                StandardWardCapacity    = 4,
                StandardWardPrice       = 50,
                SemiPrivateRoomCapacity = 2,
                SemiPrivateRoomPrice    = 90,
                PrivateRoomCapacity     = 1,
                PrivateRoomPrice        = 150,
                AppointmentHourPrice    = 40
            };

            Home.ViewModel.Content   = new LoadingViewModel();
            Home.ViewModel.IsLoading = true;
            await Task.Run(() =>
            {
                Config = HospitalDB.FetchConfig();
                InitializeDepartments();
                InitializeRooms();
                InitializeEmployees();
                InitializePatients();
                InitializeAppointments();
            });

            Home.ViewModel.IsLoading = false;
            Home.ViewModel.GoBack();
        }
コード例 #9
0
        /// <summary>
        /// Lägger till 30 patienter. Ändra på NumberOfPatientsToSimulate om man vill köra större simulering.
        /// </summary>
        public void AddPatients()
        {
            using (var db = new HospitalDB())
            {
                Console.WriteLine("Loading Patients....");

                for (int i = 0; i < NumberOfPatientsToSimulate; i++)
                {
                    Thread.Sleep(150); //För att det inte ska bli dubletter av Patient. Random arbetar med clockcykler
                    var patient = new Patient(Randomers.GenerateName(), Randomers.GenerateSSN(), Randomers.GenerateSymptomLevel());
                    db.Patients.Add(patient);
                    CurrentQueue.PatientsInQueue.Add(patient);
                }

                //sorterar databasen för att det skulle vara lättare att följa under testning osv. fyller ingen funktion för programmets funktionalitet.
                CurrentQueue.PatientsInQueue = CurrentQueue.PatientsInQueue.OrderByDescending(x => x.SymptomLevel).ThenBy(x => x.BirthDate).ToList(); //Sorterar före inläggning i db.
                db.Queue.Add(CurrentQueue);
                db.IVA.Add(CurrrentIva);
                db.Sanatorium.Add(CurrentSanatorium);
                db.AfterLife.Add(CurrentAfterLife);
                db.Healthy.Add(CurrentHealthy);
                //Lägger till alla avdelningar i databasen så dom finns att ladda in senare.
                db.SaveChanges();
            }
        }
コード例 #10
0
        public void EditRooms()
        {
            if (String.IsNullOrEmpty(editedRoomNumber))
            {
                textValidation = "Room Number can't be Empty";
                return;
            }
            bool ValideRoom = true;

            foreach (Room room in Hospital.Rooms.Values)
            {
                if (int.Parse(editedRoomNumber) == room.RoomNumber)
                {
                    ValideRoom = false;
                    break;
                }
            }
            if (!ValideRoom && editedRoomNumber != RoomNumber)
            {
                textValidation = ("ROOM NUMBER IS ALREADY EXIST");
            }
            else
            {
                RoomNumber = editedRoomNumber;
                Hospital.Rooms[RoomID].RoomNumber = int.Parse(editedRoomNumber);
                HospitalDB.UpdateRoom(Hospital.Rooms[RoomID]);
                Home.ViewModel.CloseRootDialog();
            }
        }
コード例 #11
0
 /// <summary>
 /// Uppdaterar patienternas symptomLevelel.
 /// </summary>
 public void UpdateSymptomLevelsForPatient()
 {
     using (var db = new HospitalDB())
     {
         //Laddar in listan för varje avdelning. och för varje patient i denna lista kör vi metoden SymptomUpdater += patient.SymptomLevel.
         var queue = db.Queue.Find(CurrentQueue.Id);
         db.Entry(queue).Collection(x => x.PatientsInQueue).Load();
         foreach (var patient in queue.PatientsInQueue)
         {
             patient.SymptomLevel += SymptomUpdater(1); //1 för kö
             db.SaveChanges();
         }
         var iva = db.IVA.Find(CurrrentIva.Id);
         db.Entry(iva).Collection(x => x.Patients).Load();
         foreach (var patient in iva.Patients)
         {
             patient.SymptomLevel += SymptomUpdater(2); //1 för kö
             db.SaveChanges();
         }
         var sana = db.Sanatorium.Find(CurrentSanatorium.Id);
         db.Entry(sana).Collection(x => x.Patients).Load();
         foreach (var patient in sana.Patients)
         {
             patient.SymptomLevel += SymptomUpdater(3); //1 för kö
             db.SaveChanges();
         }
     }
 }
コード例 #12
0
        private void ultraBtnPRefresh_Click(object sender, EventArgs e)
        {
            dsPatient = new DataSet();
            try
            {
                ultraTextPSearch.Text      = "";
                ultraDateTimePSearch.Value = "";
                objHospitalDB = new HospitalDB();
                Patient    objPatient    = new Patient(objHospitalDB);
                PatientRow objPatientRow = new PatientRow();
                dtPatient = objPatient.GetAllAsDataTable();
                ultraGridPatient.DataSource = dtPatient;

                /*SqlCommand cmd = objHospitalDB.CreateCommand("Select * from [Hospital].[dbo].[Patient]", false);
                 * SqlDataAdapter sda = new SqlDataAdapter();
                 * sda.SelectCommand = cmd;
                 * sda.Fill(dsPatient);
                 * ultraGridPatient.DataSource = dsPatient.Tables[0];*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if (objHospitalDB != null)
                {
                    objHospitalDB.Dispose();
                }
            }
        }
コード例 #13
0
        private void ultraBtnPSearch_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            if (ultraComboPSearch.Value.ToString() == "Patient Name")
            {
                try
                {
                    objHospitalDB = new HospitalDB();
                    Patient    objPatient = new Patient(objHospitalDB);
                    SqlCommand cmd        = objHospitalDB.CreateCommand("Patient_Search");
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FullName", ultraTextPSearch.Text);
                    SqlDataAdapter sda = new SqlDataAdapter(cmd);
                    sda.Fill(ds);
                    ultraGridPatient.DataSource = ds.Tables[0];
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (ultraComboPSearch.Value.ToString() == "Date Of Registration")
            {
                objHospitalDB = new HospitalDB();
                Patient    objPatient = new Patient(objHospitalDB);
                SqlCommand cmd        = objHospitalDB.CreateCommand("Patient_SearchByDate");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@DOR", ultraDateTimePSearch.Value);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                sda.Fill(ds);
                ultraGridPatient.DataSource = ds.Tables[0];
            }
        }
コード例 #14
0
        private void ultraBtnBDelete_Click(object sender, EventArgs e)
        {
            try
            {
                objHospitalDB = new HospitalDB();
                Bed    objBed    = new Bed(objHospitalDB);
                BedRow objBedRow = new BedRow();
                objBedRow.Bed_ID = Convert.ToInt32(this.bed_id);
                objBed.Delete(objBedRow);
                ultraGridBed.DataSource = objBed.GetAll();

                /*ultraGridBed.Rows[this.ultraGridBed.ActiveRow.Index].Delete(true);
                 * SqlCommand query = objHospitalDB.CreateCommand("delete from Bed where Bed_ID='" + this.bed_id + "';", false);
                 * int p = query.ExecuteNonQuery();
                 * MessageBox.Show(p + "Deleted");*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if (objHospitalDB != null)
                {
                    objHospitalDB.Dispose();
                }
            }
        }
コード例 #15
0
        private void ultraButtonSearch_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet ddsPatientList = new DataSet();


                objHospDB = new HospitalDB();

                SqlCommand cmd = objHospDB.CreateCommand("dbo.PatientInfoSearchAll");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Name", SqlDbType.VarChar).Value         = ultraTextEditorPatientName.Text;
                cmd.Parameters.AddWithValue("@DateOfBirth", SqlDbType.DateTime).Value = DateTime.Parse(uDTEDOR.Text);
                SqlDataAdapter sda = new SqlDataAdapter();
                sda.SelectCommand = cmd;

                sda.Fill(ddsPatientList);

                ultraGridPatientList.DataSource = ddsPatientList.Tables[0];
                ultraGridPatientList.DataBind();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #16
0
        private void ultraBtnVDelete_Click(object sender, EventArgs e)
        {
            objHospitalDB = new HospitalDB();
            ultraGridVisit.Rows[this.ultraGridVisit.ActiveRow.Index].Delete(true);
            SqlCommand query = objHospitalDB.CreateCommand("delete from Visit where VisitorID='" + this.Vis_id + "';", false);
            int        p     = query.ExecuteNonQuery();

            MessageBox.Show(p + "Deleted");
        }
コード例 #17
0
        public static void InitializeRooms()
        {
            List <Room> roomList = HospitalDB.FetchRooms();

            foreach (Room room in roomList)
            {
                Rooms.Add(room.ID, room);
            }
        }
コード例 #18
0
        public static void InitializePatients()
        {
            List <Patient> patientList = HospitalDB.FetchPatients();

            foreach (Patient patient in patientList)
            {
                // Assigning Patient's Doctors
                List <String> doctorsIDs = HospitalDB.FetchPatientDoctors(patient.ID);
                foreach (String doctorID in doctorsIDs)
                {
                    patient.assignDoctor((Doctor)Employees[doctorID]);
                    ((Doctor)Employees[doctorID]).addPatient(patient);
                }

                if (patient.GetType() == typeof(ResidentPatient))
                {
                    // Fetching Patient's Department
                    String departmentID = HospitalDB.FetchPersonDepartment(patient.ID);
                    if (Departments.ContainsKey(departmentID))
                    {
                        ((ResidentPatient)patient).Department = Departments[departmentID];
                        Departments[departmentID].Patients.Add(patient.ID, patient);
                    }

                    // Fetching Patient's Room from Database
                    String roomID = HospitalDB.FetchPatientRoom(patient.ID);

                    if (Rooms.ContainsKey(roomID))
                    {
                        Rooms[roomID].addPatient(patient);
                        ((ResidentPatient)patient).Room = Rooms[roomID];

                        // Assigning Patients to Nurses in the Same Room
                        foreach (Nurse nurse in Rooms[roomID].Nurses.Values)
                        {
                            nurse.addPatient(patient);
                        }
                    }


                    // Fetching Patient's Medicine from Database
                    List <Medicine> medicineList = HospitalDB.FetchMedicine(patient.ID);
                    foreach (Medicine medicine in medicineList)
                    {
                        ((ResidentPatient)patient).addMedicine(new Medicine
                        {
                            ID           = medicine.ID,
                            Name         = medicine.Name,
                            StartingDate = medicine.StartingDate,
                            EndingDate   = medicine.EndingDate
                        });
                    }
                }

                Patients.Add(patient.ID, patient);
            }
        }
コード例 #19
0
        private void frmVisitView_Load(object sender, EventArgs e)
        {
            objHospitalDB = new HospitalDB();
            Visit     objVisit = new Visit(objHospitalDB);
            DataTable dtVisit  = new DataTable();

            dtVisit = objVisit.GetAllAsDataTable();
            ultraGridVisit.DataSource = dtVisit;
        }
コード例 #20
0
        /// <summary>Obtener lista del personal</summary>
        /// <param></param>
        /// <returns>Lista del personal</returns>
        public IEnumerable <PersonalDTO> GetPersonal()
        {
            List <PersonalDTO> personal = new List <PersonalDTO>();

            using (var hospitalDB = new HospitalDB())
            {
                personal = hospitalDB.personal.ToList();
            }
            return(personal);
        }
コード例 #21
0
        /// <summary>
        /// Obtener una sola persona del Personal
        /// </summary>
        /// <param name="id_personal">Id del usuario a buscar</param>
        /// <returns></returns>
        public PersonalDTO GetPersonal(int id_personal)
        {
            PersonalDTO personal = new PersonalDTO();

            using (var hospitalDB = new HospitalDB())
            {
                personal = hospitalDB.personal.Find(id_personal);
            }
            return(personal);
        }
 public void EditAppointmentPatient()
 {
     Hospital.Patients[PatientID].Name    = PatientName = EditPatientNameTextBox;
     Hospital.Patients[PatientID].Address = PatientAddress = EditPatientAddressTextBox;
     PatientBirthDate = EditPatientBirthDatePicker.ToShortDateString();
     Hospital.Patients[PatientID].BirthDate = EditPatientBirthDatePicker;
     Hospital.Patients[PatientID].Diagnosis = PatientDiagnosis = EditPatientDiagnosisTextBox;
     HospitalDB.UpdatePatient(Hospital.Patients[PatientID]);
     Home.ViewModel.CloseRootDialog();
 }
コード例 #23
0
        /// <summary>
        /// Obtiene una sección
        /// </summary>
        /// <param name="id_seleccion">Id de la selección</param>
        /// <returns></returns>
        public SeccionDTO getSeleccion(int id_seleccion)
        {
            SeccionDTO seccion = new SeccionDTO();

            using (var hospitalDB = new HospitalDB())
            {
                seccion = hospitalDB.seccion.Find(id_seleccion);
            }
            return(seccion);
        }
コード例 #24
0
        private void frmBedView_Load(object sender, EventArgs e)
        {
            objHospitalDB = new HospitalDB();
            SqlCommand     cmd  = objHospitalDB.CreateCommand("SELECT * FROM Bed");
            SqlDataAdapter sdab = new SqlDataAdapter(cmd);

            dtBed = new DataTable();
            sdab.Fill(dtBed);
            ultraGridBed.DataSource = dtBed;
        }
コード例 #25
0
        /// <summary>
        /// Obtiene todas las secciones
        /// </summary>
        /// <returns></returns>
        public IEnumerable <SeccionDTO> getSecciones()
        {
            List <SeccionDTO> secciones = new List <SeccionDTO>();

            using (var hospitalDB = new HospitalDB())
            {
                secciones = hospitalDB.seccion.ToList();
            }
            return(secciones);
        }
コード例 #26
0
        private void ultraButtonRegister_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.strFormMode == "Edit")
                {
                    ultraButtonRegister.Text = "Update";
                    objHospDB = new HospitalDB();
                    // SqlCommand cmd =objHospDB.CreateCommand("update  PatientInfo set Name='" + ultraTextEditorName.Text + "',Address='" + ultraTextEditorAddress.Text + "',DateOfBirth='" + ultraDateTimeEditorPatientRgister.DateTime + "',Phone='" + classPhone.Text + "',EmergencyContact='" + classEmergencyContact.Text + "',DateOfRegistration='" + ultraDateTimeEditorDORPR.DateTime + "' where ID= '" + classtextEditorID.Text + "'");
                    // int obj = cmd.ExecuteNonQuery();
                    PatientInfo    objPatietntInfo   = new PatientInfo(objHospDB);
                    PatientInfoRow objPatientInforow = new PatientInfoRow();

                    objPatientInforow.Id                 = Convert.ToInt32(classtextEditorID.Text);
                    objPatientInforow.Name               = ultraTextEditorName.Text;
                    objPatientInforow.Address            = ultraTextEditorAddress.Text;
                    objPatientInforow.DateOfBirth        = ultraDateTimeEditorPatientRgister.DateTime;
                    objPatientInforow.Phone              = Convert.ToInt32(classPhone.Text);
                    objPatientInforow.EmergencyContact   = Convert.ToInt32(classEmergencyContact.Text);
                    objPatientInforow.DateOfRegistration = ultraDateTimeEditorDORPR.DateTime;

                    objPatietntInfo.Update(objPatientInforow);

                    MessageBox.Show(":updated");
                    //openfrmPatientList();
                    openPatientList();
                }
                else
                {
                    //conn.Open();
                    objHospDB = new HospitalDB();
                    PatientInfo    objPatietntInfo   = new PatientInfo(objHospDB);
                    PatientInfoRow objPatientInforow = new PatientInfoRow();


                    objPatientInforow.Name               = ultraTextEditorName.Text;
                    objPatientInforow.Address            = ultraTextEditorAddress.Text;
                    objPatientInforow.DateOfBirth        = ultraDateTimeEditorPatientRgister.DateTime;
                    objPatientInforow.Phone              = Convert.ToInt32(classPhone.Text);
                    objPatientInforow.EmergencyContact   = Convert.ToInt32(classEmergencyContact.Text);
                    objPatientInforow.DateOfRegistration = ultraDateTimeEditorDORPR.DateTime;
                    //SqlCommand cmd = objHospDB.CreateCommand("Insert into PatientInfo values('" + ultraTextEditorName.Text + "','" + ultraTextEditorAddress.Text + "','" + ultraDateTimeEditorPatientRgister.DateTime + "','" + classPhone.Text + "','" + classEmergencyContact.Text + "','" + ultraDateTimeEditorDORPR.DateTime + "')");

                    objPatietntInfo.Insert(objPatientInforow);
                    MessageBox.Show(":Registered");
                    //openfrmPatientList();
                    openPatientList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("error");
            }
        }
コード例 #27
0
        public async void DeleteRooms()
        {
            object result = await DialogHost.Show(new DeleteMessageBox(), "RootDialog");

            if (result.Equals(true))
            {
                Hospital.DeleteRoom(RoomID);
                Home.ViewModel.Content = new RoomsViewModel();
                HospitalDB.DeleteRoom(RoomID);
            }
        }
コード例 #28
0
        private void ultraButtonDeleteBed_Click(object sender, EventArgs e)
        {
            ultraGridBedList.Rows[this.ultraGridBedList.ActiveRow.Index].Delete(true);
            //conn.Open();
            objHospitalDB = new HospitalDB();
            SqlCommand cmd = objHospitalDB.CreateCommand("delete from BedInfo where BedIDD='" + this.id + "';");
            int        o   = cmd.ExecuteNonQuery();

            conn.Close();
            MessageBox.Show(o + ":deleted");
        }
コード例 #29
0
        public static void InitializeDepartments()
        {
            List <Department> departmentList = HospitalDB.FetchDepartments();

            foreach (Department department in departmentList)
            {
                if (department != null)
                {
                    Departments.Add(department.ID, department);
                }
            }
        }
コード例 #30
0
        public static void InitializeEmployees()
        {
            List <Doctor> doctorList = HospitalDB.FetchDoctors();

            foreach (Doctor doctor in doctorList)
            {
                // Fetching Doctor's Department
                String departmentID = HospitalDB.FetchPersonDepartment(doctor.ID);

                // Assigning Doctor to his Department
                if (Departments.ContainsKey(departmentID))
                {
                    doctor.Department = Departments[departmentID];
                    Departments[departmentID].addDoctor(doctor);

                    // Checking if the Doctor is the Department's Head
                    if (doctor.IsHead)
                    {
                        Departments[departmentID].HeadID = doctor.ID;
                    }
                }


                Employees.Add(doctor.ID, doctor);
            }

            List <Nurse> nurseList = HospitalDB.FetchNurses();

            foreach (Nurse nurse in nurseList)
            {
                // Fetching Nurse's Department
                String departmentID = HospitalDB.FetchPersonDepartment(nurse.ID);

                // Assigning Nurse to her Department
                if (Departments.ContainsKey(departmentID))
                {
                    nurse.Department = Departments[departmentID];
                    Departments[departmentID].addNurse(nurse);
                }

                // Fetching Nurse's Rooms
                List <String> roomsID = HospitalDB.FetchNurseRooms(nurse.ID);

                // Assigning Nurses to their Rooms
                foreach (String roomID in roomsID)
                {
                    nurse.addRoom(Rooms[roomID]);
                    Rooms[roomID].addNurse(nurse);
                }

                Employees.Add(nurse.ID, nurse);
            }
        }