Пример #1
0
        private void SignUp_Click(object sender, EventArgs e)
        {
            string   name      = NewName.Text;
            DateTime birthDate = NewDateBirth.Value;
            Male     male      = NewMale.Checked ? Male.Male : Male.Female;
            byte     height    = byte.Parse(NewHeight.Text);
            byte     weight    = byte.Parse(NewWeight.Text);

            _container = new EntityModelContainer();
            Patient newPatient = InformationSystem.CreatePatient(name, birthDate, male, height, weight, user);

            InformationSystem.AddPatient(newPatient, user);

            DeviceFunction deviceType = 0;

            switch (NewDeviceType.SelectedIndex)
            {
            case 0:
                deviceType = DeviceFunction.Glucometer;
                break;

            case 1:
                deviceType = DeviceFunction.HeartRateMonitor;
                break;

            case 2:
                deviceType = DeviceFunction.BloodPressureMonitor;
                break;
            }

            Device newDevice = InformationSystem.CreateDevice(newPatient, deviceType);

            InformationSystem.AddDevice(newDevice, newPatient);

            DoctorMessage informMessage = InformationSystem.CreatePatientMessage(user, newPatient, AllowAccess.Checked);

            InformationSystem.AddDoctorMessage(informMessage);

            MessageBox.Show("Пациент успешно зарегистрирован");

            this.Close();
        }