Beispiel #1
0
        private void girisYapButton_Click(object sender, EventArgs e)
        {
            String nick_name = kullanıcıAdıTextBox.Text.ToString();
            String password  = sifreTextBox.Text;

            try
            {
                SQLiteConnection connect = new SQLiteConnection("Data source = TrackingSystem.db");
                connect.Open();
                var    cmd       = new SQLiteCommand(connect);
                string passwords = encryption(password);
                cmd.CommandText = "SELECT * FROM user WHERE (nick_name = '" + nick_name + "') AND (password = '******');";
                string auth;

                SQLiteDataReader sqldr = cmd.ExecuteReader();

                if (sqldr.Read())
                {
                    auth = sqldr["auth"].ToString();
                    // auth = 0 -> Secretary
                    // auth = 1 -> Dentist
                    // auth = 2 -> Admin
                    if (auth.Equals("0"))
                    {
                        SecretaryForm secretaryForm = new SecretaryForm();
                        secretaryForm.Show();
                        this.Hide();
                    }

                    else if (auth.Equals("1"))
                    {
                        DentistForm dentistForm = new DentistForm();
                        dentistForm.Show();
                        this.Hide();
                    }

                    else if (auth.Equals("2"))
                    {
                        AdminForm adminForm = new AdminForm();
                        adminForm.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Veritabanı Hatası. Uygulama Yapımcınız ile İletişime Geçin", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0, "mailto:[email protected]?subject=Diş Hekimlliği Yönetim Programı");
                    }
                    //MessageBox.Show("Giriş Başarılı", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Kullanıcı Adı veya Şifre Yanlış", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                connect.Close();
            }
            catch (SQLiteException)
            {
                MessageBox.Show("Veritabanı Hatası. Uygulama Yapımcınız ile İletişime Geçin", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0, "mailto:[email protected]?subject=Diş Hekimlliği Yönetim Programı");
            }
        }
        private void yeniToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DentistForm newForm = new DentistForm();

            newForm.Show();
        }