コード例 #1
0
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            //PatientManagement pm = new PatientManagement();
            SecretaryController sc = new SecretaryController();

            string firstName = textBoxFirstName.Text;
            string lastName  = textBoxLastName.Text;
            string jmbg      = textBoxJMBG.Text;


            string username = textBoxFirstName.Text + textBoxLastName.Text;
            string password = "******";


            string date = BoxDateTime.Text;

            string[] entries = date.Split('/');
            int      year    = Int32.Parse(entries[2]);
            int      month   = Int32.Parse(entries[0]);
            int      day     = Int32.Parse(entries[1]);
            DateTime myDate  = new DateTime(year, month, day);



            int n = sc.GetAllPatients().Count;
            int idPatient;

            if (n > 0)
            {
                idPatient = Int32.Parse(sc.GetAllPatients()[n - 1].Id) + 1;
            }
            else
            {
                idPatient = 0;
            }


            TypeOfPerson typeOfPerson = (TypeOfPerson)Enum.Parse(typeof(TypeOfPerson), "Patient");


            AccountType typeAccc = (AccountType)Enum.Parse(typeof(AccountType), "guestAccount");

            List <Allergen> listAllergens = new List <Allergen>();

            MedicalRecord mr = new MedicalRecord(idPatient.ToString(), typeAccc, 0, firstName, lastName, "empty", jmbg, myDate, "empty", "empty", "empty", 0);

            Patient p = new Patient(typeAccc, firstName, lastName, idPatient.ToString(), myDate, "Empty", "Empty", "Empty", typeOfPerson, username, password, jmbg, 0, mr, listAllergens);

            sc.CreatePatient(p);



            aPw.UpdateView();

            Close();
        }
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            //PatientManagement pm = new PatientManagement();
            SecretaryController sc = new SecretaryController();

            string firstName = textBoxFirstName.Text;
            string lastName  = textBoxLastName.Text;
            string jmbg      = textBoxJMBG.Text;

            string date = BoxDateTime.Text;

            string[] entries = date.Split('/');
            int      year    = Int32.Parse(entries[2]);
            int      month   = Int32.Parse(entries[0]);
            int      day     = Int32.Parse(entries[1]);
            DateTime myDate  = new DateTime(year, month, day);

            string placeOfResidance = textBoxPlaceOfResidance.Text;
            string email            = textBoxEmail.Text;
            string phoneNumber      = textBoxPhoneNumber.Text;
            string username         = textBoxUsername.Text;
            string password         = textBoxPassword.Text;

            SexType sex = SexType.male;

            if (Convert.ToBoolean(MSex.IsChecked))
            {
                sex = SexType.male;
            }
            else if (Convert.ToBoolean(FSex.IsChecked))
            {
                sex = SexType.female;
            }

            int n = sc.GetAllPatients().Count;
            int idPatient;

            if (n > 0)
            {
                idPatient = Int32.Parse(sc.GetAllPatients()[n - 1].Id) + 1;
            }
            else
            {
                idPatient = 0;
            }

            TypeOfPerson typeOfPerson = (TypeOfPerson)Enum.Parse(typeof(TypeOfPerson), "Patient");

            List <Allergen> listAllergens = new List <Allergen>();
            MedicalRecord   mr            = new MedicalRecord(idPatient.ToString(), 0, 0, firstName, lastName, "empty", jmbg, myDate, "empty", placeOfResidance, phoneNumber, sex);
            Patient         p             = new Patient(0, firstName, lastName, idPatient.ToString(), myDate, phoneNumber, email, placeOfResidance, typeOfPerson, username, password, jmbg, sex, mr, listAllergens);



            sc.CreatePatient(p);


            aPw.UpdateView();

            Close();
        }