Esempio n. 1
0
 public void setUser(UserObj user)
 {
     textBox_userId.Text     = user.UserId;
     textBox_userId.ReadOnly = true;
     textBox_chiName.Text    = user.ChineseName;
     textBox_engName.Text    = user.EnglishName;
     textBox_regNo.Text      = user.RegNo;
     textBox_password.Clear();
     textBox_cmfPassword.Clear();
     checkBox_isSuspended.Checked = user.IsSuspended;
     if (Login.user != null && Login.user.UserId == user.UserId)
     {
         checkBox_isSuspended.Checked = false;
         checkBox_isSuspended.Enabled = false;
     }
     else
     {
         checkBox_isSuspended.Enabled = true;
     }
 }
Esempio n. 2
0
 private void button_patSys_Click(object sender, EventArgs e)
 {
     if (input_validation())
     {
         String ErrMsg = "";
         this.Enabled = false;
         clinic       = (ClinicObj)(comboBox_clinicId.SelectedItem);
         if (clinic.ClinicId == "ALL")
         {
             MessageBox.Show("系統管理員專用診所不能使用病人系統", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             user = ucMgr.getUserByUserClinicRoleId(textBox_userName.Text, clinic.ClinicId, int.Parse(((PermissibleValueObj)(comboBox_role.SelectedItem)).getValue()), ref ErrMsg);
             if (user != null)
             {
                 if (PasswordHash.getHashedPw(textBox_password.Text) == user.HashedPw)
                 {
                     Patient_mainMenu patMainMenu = new Patient_mainMenu();
                     user = null;
                     this.Hide();
                     patMainMenu.ShowDialog();
                     this.Show();
                 }
                 else
                 {
                     textBox_userName.Text = PasswordHash.getHashedPw(textBox_password.Text);
                     MessageBox.Show("密碼錯誤", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show(ErrMsg, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         this.Enabled = true;
     }
 }
Esempio n. 3
0
 private void button_login_Click(object sender, EventArgs e)
 {
     if (input_validation())
     {
         String ErrMsg = "";
         this.Enabled = false;
         clinic       = (ClinicObj)(comboBox_clinicId.SelectedItem);
         user         = ucMgr.getUserByUserClinicRoleId(textBox_userName.Text, clinic.ClinicId, int.Parse(((PermissibleValueObj)(comboBox_role.SelectedItem)).getValue()), ref ErrMsg);
         if (user != null)
         {
             if (PasswordHash.getHashedPw(textBox_password.Text) == user.HashedPw)
             {
                 if (!user.IsSuspended)
                 {
                     if (user.CurrentLoginRole != 0)
                     {
                         if (user.CurrentLoginRole == 40)
                         {
                             //SYSADM
                             SystemAdmin_MainMenu sysAdmMainMenu = new SystemAdmin_MainMenu();
                             this.Hide();
                             sysAdmMainMenu.ShowDialog();
                             this.Show();
                         }
                         else if (user.CurrentLoginRole == 10)
                         {
                             //STAFF
                             Staff_MainMenu staffMainMenu = new Staff_MainMenu();
                             this.Hide();
                             staffMainMenu.ShowDialog();
                             this.Show();
                         }
                         else if (user.CurrentLoginRole == 20)
                         {
                             //DOCTOR
                             Doctor_MainMenu drMainMenu = new Doctor_MainMenu();
                             this.Hide();
                             drMainMenu.ShowDialog();
                             this.Show();
                         }
                         else if (user.CurrentLoginRole == 30)
                         {
                             //CLINIC ADM
                             ClinicAdm_mainMenu cAdmMainMenu = new ClinicAdm_mainMenu();
                             this.Hide();
                             cAdmMainMenu.ShowDialog();
                             this.Show();
                         }
                     }
                     else
                     {
                         MessageBox.Show("此用戶沒有權限存取此診所資料", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                     }
                 }
                 else
                 {
                     MessageBox.Show("此用戶已被停用", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 }
             }
             else
             {
                 MessageBox.Show("密碼錯誤", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show(ErrMsg, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         this.Enabled = true;
     }
 }