コード例 #1
0
 private void ButtonBack_Click(object sender, EventArgs e)
 {
     if (LoginPage.userType.Equals("Administrator"))
     {
         MainPage_Admin main = new MainPage_Admin();
         main.Show();
         this.Close();
     }
     if (LoginPage.userType.Equals("Clerk"))
     {
         MainPage_Clerk main = new MainPage_Clerk();
         main.Show();
         this.Close();
     }
 }
コード例 #2
0
ファイル: LoginPage.cs プロジェクト: parkerirl/csci-455-emr
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            ConnectDB EMRDatabase = new ConnectDB();
            string    id          = textEmployeeId.Text;
            string    password    = textEmployeePassword.Text;

            userName = id;
            Boolean success = false;

            if (id.Equals("admin") || id.Equals("62501"))
            {
                if (password.Equals("admin"))
                {
                    userType = "Administrator";
                    this.Hide();
                    mainPageAdmin = new MainPage_Admin();
                    mainPageAdmin.Show();
                    success = true;
                }
            }
            else
            {
                userType = EMRDatabase.ValidateLogin(id, password);

                if (userType == "Administrator")
                {
                    this.Hide();
                    mainPageAdmin = new MainPage_Admin();
                    mainPageAdmin.Show();
                    success = true;
                }
                else if (userType == "Physician")
                {
                    this.Hide();
                    mainPageDoctor = new MainPage_Doctor();
                    mainPageDoctor.Show();
                    success = true;
                }
                else if (userType == "Pharmacist")
                {
                    this.Hide();
                    mainPageDoctor = new MainPage_Doctor();
                    mainPageDoctor.Show();
                    success = true;
                }
                else if (userType == "Clerk")
                {
                    this.Hide();
                    mainPageClerk = new MainPage_Clerk();
                    mainPageClerk.Show();
                    success = true;
                }
                else if (userType == "Patient")
                {
                    List <string>[] ssnList   = EMRDatabase.GetAccountSSN(id, password);
                    String          ssnToSend = ssnList[0][0];
                    this.Hide();
                    patientPage = new PatientPage(ssnToSend);
                    patientPage.Show();
                    success = true;
                }
                else
                {
                    success = false;
                }
            }

            //if (id.Equals("doctor") || id.Equals("62502"))
            //{
            //    if (password.Equals("doctor"))
            //    {
            //        this.Hide();
            //        mainPageDoctor = new MainPage_Doctor();
            //        mainPageDoctor.Show();
            //        success = true;
            //    }
            //}

            //if (id.Equals("pharmacist") || id.Equals("62503"))
            //{
            //    if (password.Equals("pharmacist"))
            //    {
            //        this.Hide();
            //        mainPageDoctor = new MainPage_Doctor();
            //        mainPageDoctor.Show();
            //        success = true;
            //    }
            //}

            //if (id.Equals("clerk") || id.Equals("62504"))
            //{
            //    if (password.Equals("patient"))
            //    {
            //        this.Hide();
            //        mainPageClerk = new MainPage_Clerk();
            //        mainPageClerk.Show();
            //        success = true;
            //    }
            //}

            //if (id.Equals("patient") || id.Equals("62505"))
            //{
            //    this.Hide();
            //    patientPage = new PatientPage();
            //    patientPage.Show();
            //    success = true;
            //}

            if (!success)
            {
                textEmployeePassword.Text = "";
                if (userType == "Inactive")
                {
                    labelBadLogin.Text = "Inactive account. Please try again.";
                }
                else
                {
                    labelBadLogin.Text = "Invalid login. Please try again.";
                }
            }
        }