Beispiel #1
0
        public void login(string email, string password)
        {
            loggedIn = selectedHospital.retrievePatientInfo(email, password);
            if (loggedIn == null)
            {
                throw new Exception("User account does not exist");
            }

            updateFields();
        }
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (validateInput() == null)
            {
                errorMessage.Text = "";
            }
            else
            {
                errorMessage.Text = validateInput();
                return;
            }


            if (generalRegisterControls.Gender == "")
            {
                errorMessage.Text = "There are required fields not filled in";
                return;
            }
            else
            {
                errorMessage.Visible = false;
            }


            Model.Gender  gender  = (generalRegisterControls.Gender == "Male") ? Model.Gender.M : Model.Gender.F;
            Model.Patient patient = new Model.Patient(generalRegisterControls.FirstName, generalRegisterControls.LastName, email.Text, gender, generalRegisterControls.DateofBirth);

            try
            {
                hospital.addPatient(patient, password.Text);
                bool redoAppointment = false;


                using (SuccessfulTransactionView result = new SuccessfulTransactionView("Register Another Patient", String.Format(" Patient Information:\n Name:{0} {1}\n Email:{2}", patient.FirstName, patient.LastName, patient.Email)))
                {
                    result.redoButton.Click += (object obj, EventArgs events) =>
                    {
                        redoAppointment = true;
                    };



                    result.ShowDialog();

                    if (redoAppointment)
                    {
                        ClearForm();
                    }
                    else
                    {
                        hospital.WritePatientsInformation();

                        from.login(email.Text, password.Text);

                        this.Close();
                    }
                    //After registering, auto login.
                }
            }
            catch (Exception err)
            {
                errorMessage.Text = err.Message;
            }
        }
Beispiel #3
0
        private void logoutButton_Click(object sender, EventArgs e)
        {
            loggedIn = null;

            updateFields();
        }
Beispiel #4
0
 public Homepage(Model.Patient loggedIn)
 {
     this.loggedIn = loggedIn;
     InitializeComponent();
 }