private void Facilities_Load(object sender, EventArgs e)
        {
            using (var MedDB = new MedicalEntities())
            {
                try
                {
                    if (MedDB.Facilities.Count() == 0)
                    {
                        AddFacility("Hospitality Hospital", "35101 place way", "12345", "3145442183", "Kansas City", "Kansas");
                        AddFacility("Gamble Hospital", "666 casino avenue", "77777", "2175343133", "Timbuktu", "Missouri");
                        AddFacility("Cavendish Memorial Hospital", "61253 Musa acuminata road", "73457", "5175643233", "Triploid", "California");
                        EmployeesForm.AddEmployee(MedDB.Facilities.First().FacilityID, "Sammy", "Lea", "Roberts", "315-223-9193", 0, 99.99m, "Janitor Sir", true);
                        PatientsForm.AddPatient(MedDB.Facilities.First().FacilityID, "Kenneth", "William", "Sweet", MedDB.Employees.First().EmployeeID);
                    }
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.Message);
                    throw;
                }

                UpdateFacilities();

                // filters out the Navigation properties id fields
                dgvFacilities.Columns["FacilityID"].Visible     = false;
                dgvFacilities.Columns["FacilityEvents"].Visible = false;
                dgvFacilities.Columns["Patients"].Visible       = false;
                dgvFacilities.Columns["Drugs"].Visible          = false;
                dgvFacilities.Columns["Employees"].Visible      = false;

                // enable after population
            }
        }
Beispiel #2
0
        private void btnPatients_Click(object sender, EventArgs e)
        {
            PatientsForm patForm = new PatientsForm(_facility);

            patForm.FormClosed += new FormClosedEventHandler((object _sender, FormClosedEventArgs _e) => this.Show());
            this.Hide();
            patForm.ShowDialog();
        }