Ejemplo n.º 1
0
 public void masuk()
 {
    if (!(txtUserName.Text == "" || passwordBox1.Password == ""))
    {
       if (F.checkPass(txtUserName.Text, passwordBox1.Password))
       {
          if (txtUserName.Text == "admin")
          {
             Admin a = new Admin();
             a.Show();
             this.Hide();
          }
          siapa.anda = txtUserName.Text;
          string pilih = txtUserName.Text;
          switch (pilih[1])
          {
             case '1':
                //MessageBox.Show("Dokter");
                Dokter d = new Dokter();
                d.Show();
                this.Hide();
                break;
             case '2':
                //MessageBox.Show("Perawat");
                Perawat p = new Perawat();
                p.Show();
                this.Hide();
                break;
             case '3':
                //MessageBox.Show("Karyawan");
                Karyawan k = new Karyawan();
                k.Show();
                this.Hide();
                break;
             case '4':
                //MessageBox.Show("Pasien");
                Pasien s = new Pasien();
                s.Show();
                this.Hide();
                break;
          }
       }
       else if (txtUserName.Text == "su" && passwordBox1.Password == "superuser")
       {
          Admin a = new Admin();
          a.Show();
          this.Hide();
       }
       else MessageBox.Show("Username dan Password tidak cocok", "Peringatan", MessageBoxButton.OK, MessageBoxImage.Warning);
    }
    else if (txtUserName.Text == "" && !(passwordBox1.Password == ""))
       MessageBox.Show("username kosong");
    else if (passwordBox1.Password == "" && !(txtUserName.Text == ""))
       MessageBox.Show("password kosong");
    else MessageBox.Show("username & password kosong");
 }
Ejemplo n.º 2
0
        public void masuk()
        {
            if (!(txtUserName.Text == "" || passwordBox1.Password == ""))
            {
                if (F.checkPass(txtUserName.Text, passwordBox1.Password))
                {
                    if (txtUserName.Text == "admin")
                    {
                        Admin a = new Admin();
                        a.Show();
                        this.Hide();
                    }
                    siapa.anda = txtUserName.Text;
                    string pilih = txtUserName.Text;
                    switch (pilih[1])
                    {
                    case '1':
                        //MessageBox.Show("Dokter");
                        Dokter d = new Dokter();
                        d.Show();
                        this.Hide();
                        break;

                    case '2':
                        //MessageBox.Show("Perawat");
                        Perawat p = new Perawat();
                        p.Show();
                        this.Hide();
                        break;

                    case '3':
                        //MessageBox.Show("Karyawan");
                        Karyawan k = new Karyawan();
                        k.Show();
                        this.Hide();
                        break;

                    case '4':
                        //MessageBox.Show("Pasien");
                        Pasien s = new Pasien();
                        s.Show();
                        this.Hide();
                        break;
                    }
                }
                else if (txtUserName.Text == "su" && passwordBox1.Password == "superuser")
                {
                    Admin a = new Admin();
                    a.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Username dan Password tidak cocok", "Peringatan", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else if (txtUserName.Text == "" && !(passwordBox1.Password == ""))
            {
                MessageBox.Show("username kosong");
            }
            else if (passwordBox1.Password == "" && !(txtUserName.Text == ""))
            {
                MessageBox.Show("password kosong");
            }
            else
            {
                MessageBox.Show("username & password kosong");
            }
        }