Пример #1
0
 public Insan(string id, string ad, string soyad, AkilliKart kart, string eposta, string password)
 {
     this.id       = id;
     this.ad       = ad;
     this.soyad    = soyad;
     this.kart     = kart;
     this.eposta   = eposta;
     this.password = password;
 }
Пример #2
0
        private void loginButton_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textboxPassword.Text) || string.IsNullOrEmpty(textboxUsername.Text))
            {
                return;
            }
            else if (textboxPassword.Text == adminPassword && textboxUsername.Text == adminUserName)
            {
                AdminPage adminPage = new AdminPage(this);
                adminPage.Show();
                this.Hide();
                CheckRememberMeState();
                return;
            }
            else if (textboxPassword.Text == "0")
            {
                TestForm testForm = new TestForm();
                this.Hide();
                testForm.Show();
                CheckRememberMeState();
                return;
            }

            try {
                string           connString = ConfigurationManager.ConnectionStrings["MyKey"].ConnectionString;
                NpgsqlConnection connection = new NpgsqlConnection(connString);
                connection.Open();
                NpgsqlCommand command, command2;

                if (IsNumeric(textboxUsername.Text))  //ak_id
                {
                    command  = new NpgsqlCommand("SELECT * FROM kisi WHERE ak_id = " + textboxUsername.Text, connection);
                    command2 = new NpgsqlCommand("SELECT bakiye FROM akillikart,kisi WHERE akillikart.id = kisi.ak_id AND ak_id=" + textboxUsername.Text, connection);
                }
                else    //eposta
                {
                    command  = new NpgsqlCommand("SELECT * FROM kisi WHERE eposta = '" + textboxUsername.Text + "'", connection);
                    command2 = new NpgsqlCommand("SELECT bakiye FROM akillikart,kisi WHERE akillikart.id = kisi.ak_id AND eposta = '" + textboxUsername.Text + "'", connection);
                }
                NpgsqlDataReader reader = command2.ExecuteReader();
                reader.Read();
                float bakiye = float.Parse(reader[0].ToString());
                reader.Close();

                reader = command.ExecuteReader();
                reader.Read();

                if (reader[0] != null)
                {
                    string password = reader[5].ToString();

                    if (password == textboxPassword.Text)
                    {
                        string     id     = reader[0].ToString();
                        string     ad     = reader[1].ToString();
                        string     soyad  = reader[2].ToString();
                        AkilliKart kart   = new AkilliKart(bakiye, reader[3].ToString());
                        string     eposta = reader[4].ToString();
                        int        tip    = int.Parse(reader[6].ToString());
                        switch (tip)
                        {
                        case 0:    //ogrenci
                            aktifKullanici = new Ogrenci(id, ad, soyad, kart, eposta, password);
                            break;

                        case 1:    //ogretim gorevlisi
                            aktifKullanici = new OgretimUyesi(id, ad, soyad, kart, eposta, password);
                            break;

                        case 2:    //memur
                            aktifKullanici = new Memur(id, ad, soyad, kart, eposta, password);
                            break;

                        default:
                            throw new Exception("Böyle bir tip yok");
                        }


                        //ktifKullanici = new Insan(id, ad, soyad, kart, eposta, password);
                        //MessageBox.Show("Basarili bir sekilde giris yapildi");
                        CheckRememberMeState();
                        UserPage userPage = new UserPage(this, aktifKullanici);
                        Hide();
                        userPage.Show();
                    }
                    else
                    {
                        MessageBox.Show("Lütfen bilgilerinizi kontrol ediniz");
                    }
                }
                else
                {
                    MessageBox.Show("Veri gelmedi");
                }
                reader.Close();
                connection.Close();
            } catch (Exception ex) {
                MessageBox.Show(ex.Message.ToString());
            }
        }
        public static int oduncSuresi = 90; // default : 90 gün


        public OgretimUyesi(string id, string ad, string soyad, AkilliKart kart, string eposta, string password) : base(id, ad, soyad, kart, eposta, password)
        {
        }
Пример #4
0
 public Memur(string id, string ad, string soyad, AkilliKart kart, string eposta, string password) : base(id, ad, soyad, kart, eposta, password)
 {
 }