Esempio n. 1
0
        private void btLogin_Click(object sender, System.EventArgs e)
        {
            /*Patient patient = new Patient();
             * patient.Role = "Doctor";
             * Doctor doc = new Doctor();
             * doc.Role = "Doctor";
             * this.Hide();
             * AppointmentForm appointmentForm = new AppointmentForm(doc);
             * appointmentForm.Show();*/

            if (tbLogin.Text.Trim() != "" && tbLogin.Text.Trim().Length > 4 && tbLogin.Text.Trim().Length < 31 && tbPassword.Text.Trim() != "" &&
                tbPassword.Text.Trim().Length > 4)
            {
                using (var client = new HaServiceClient())
                {
                    this.Enabled = false;
                    Patient patient = client.VerefyAuth(tbLogin.Text.Trim(), tbPassword.Text.Trim());
                    Doctor  doc     = client.VerefyAuthDoc(tbLogin.Text.Trim(), tbPassword.Text.Trim());
                    if (patient != null)
                    {
                        MessageBox.Show("Login Successful!");
                        this.Hide();
                        AppointmentForm appointmentForm = new AppointmentForm(patient);
                        appointmentForm.Show();
                    }
                    else if (doc != null)
                    {
                        this.Hide();
                        AppointmentForm appointmentForm = new AppointmentForm(doc);
                        appointmentForm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Login or Password");
                    }
                }
            }
            else
            {
                MessageBox.Show("Invalid Login or Password");
                //return;
            }
            this.Enabled = true;
        }
Esempio n. 2
0
        private void btEditDocPasConfirm_Click(object sender, EventArgs e)
        {
            using (var client = new HaServiceClient())
            {
                _doctor = client.GetDoctorById(_doctorId);
                string confirm = tbEditDocCurrentPassword.Text.Trim();
                var    hash    = client.VerefyAuthDoc(_doctor.LoginD, confirm)?.HashD;
                if (confirm.Length < 6 || confirm.Length > 30 || hash == null)
                {
                    tsslEditDocPas.ForeColor = Color.Crimson;
                    tsslEditDocPas.Text      = "Invadid password";
                    return;
                }

                if (hash == _doctor.HashD)
                {
                    tbEditDocPassword.Enabled       = true;
                    tbEditDocPasswordRepeat.Enabled = true;
                    tsslEditDocPas.ForeColor        = Color.Blue;
                    tsslEditDocPas.Text             = "Enter new password";
                }
            }
        }