예제 #1
0
        private void btnAdmissionsReport_Click(object sender, EventArgs e)
        {
            frmAdmissions frmAdmissions = new frmAdmissions();

            frmAdmissions.Visible = true;
            frmAdmissions.Activate();
        }
예제 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            frmAdmissions admissionsForm = new frmAdmissions();

            admissionsForm.Visible = true;
            admissionsForm.Activate();
        }
예제 #3
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            string strUser;
            string strPass;
            string sMsg = "";

            strUser = txtUserID.Text;
            strPass = txtPassword.Text;

            DataSet ds_Find = new DataSet();
            Users   oUsers  = new Users();

            try
            {
                ds_Find = oUsers.FindData(strUser, strPass);
                sMsg    = "Welcome " + strUser;

                switch (strUser)
                {
                case "Admissions":
                    frmAdmissions admitForm = new frmAdmissions();
                    admitForm.Visible = true;
                    admitForm.Activate();
                    break;

                case "Admin":
                    frmMenu a_menuForm = new frmMenu();
                    a_menuForm.oCurrent.UserName = strUser;
                    a_menuForm.Visible           = true;
                    a_menuForm.Activate();
                    a_menuForm.SelectUser();
                    break;

                case "Nurse":
                    frmMenu n_menuForm = new frmMenu();
                    n_menuForm.oCurrent.UserName = strUser;
                    n_menuForm.Visible           = true;
                    n_menuForm.Activate();
                    n_menuForm.SelectUser();
                    break;

                case "Doctor":
                    frmMenu d_menuForm = new frmMenu();
                    d_menuForm.oCurrent.UserName = strUser;
                    d_menuForm.Visible           = true;
                    d_menuForm.Activate();
                    d_menuForm.SelectUser();
                    break;
                }
            }

            catch
            {
                if (cnt == 0)
                {
                    sMsg = "User not in database. Please try again.";
                }
                if (cnt == 1)
                {
                    sMsg = "User not in database. One try left.";
                }
                if (cnt == 2)
                {
                    sMsg = "Application is closing. Please contact your supervisor.";
                }
                txtUserID.Text   = "";
                txtPassword.Text = "";
            }
            finally
            {
                MessageBox.Show(sMsg, "", MessageBoxButtons.OK);
                txtUserID.Text   = "";
                txtPassword.Text = "";
            }

            if (cnt > 2)
            {
                Application.Exit();
            }
        }