public void setClinic(ClinicObj clinic) { textBox_clinicId.Text = clinic.ClinicId; textBox_clinicId.ReadOnly = true; textBox_chiName.Text = clinic.ChineseName; textBox_engName.Text = clinic.EnglishName; textBox_addr.Text = clinic.Addr; textBox_phoneNo.Text = clinic.PhoneNo; checkBox_isSuspended.Checked = clinic.IsSuspended; }
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; } }
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; } }