コード例 #1
0
        public List <Ogrenci> Listele(string where = "")
        {
            List <Ogrenci> ogrencilist = new List <Ogrenci>();

            using (SqlConnection conn = new SqlConnection(_baglanti))
            {
                conn.Open();
                SqlCommand    command = new SqlCommand("SELECT * FROM ogrenci " + where, conn);
                SqlDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    Ogrenci ogrenci = new Ogrenci()
                    {
                        no            = reader["ogrencino"].ToString(),
                        TC            = reader["TC"].ToString(),
                        adi           = reader["ogrenciadi"].ToString(),
                        soyadi        = reader["ogrencisoyadi"].ToString(),
                        cinsiyeti     = reader["cinsiyeti"].ToString(),
                        sinifi        = reader["ogrencisinifi"].ToString(),
                        alani         = reader["ogrencialani"].ToString(),
                        subesi        = reader["ogrencisubesi"].ToString(),
                        ogretmeni     = reader["sinifogretmeni"].ToString(),
                        anneadi       = reader["anneadi"].ToString(),
                        babaadi       = reader["babaadi"].ToString(),
                        velitel       = reader["velitel"].ToString(),
                        telefonu      = reader["ogrencitel"].ToString(),
                        adresi        = reader["adres"].ToString(),
                        kartno        = reader["parmakizi"].ToString(),
                        durumu        = reader["ogrencidurum"].ToString(),
                        ogrencibakiye = Convert.ToDouble(reader["ogrencibakiye"].ToString()),
                        kalangiris    = Convert.ToInt32(reader["kalangiris"]),
                        ogrenciTip    = reader["ogrenciTip"].ToString()
                    };
                    ogrencilist.Add(ogrenci);
                }
            }
            return(ogrencilist);
        }
コード例 #2
0
        public static Ogrenci Getir(string kartNo)
        {
            _baglanti = Helper.XmlOku()[0];
            Ogrenci ogrenci = new Ogrenci();

            using (SqlConnection conn = new SqlConnection(_baglanti))
            {
                conn.Open();
                SqlCommand    command = new SqlCommand("SELECT * FROM ogrenci where parmakizi='" + kartNo + "'", conn);
                SqlDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    ogrenci = new Ogrenci()
                    {
                        no            = reader["ogrencino"].ToString(),
                        TC            = reader["TC"].ToString(),
                        adi           = reader["ogrenciadi"].ToString(),
                        soyadi        = reader["ogrencisoyadi"].ToString(),
                        cinsiyeti     = reader["cinsiyeti"].ToString(),
                        sinifi        = reader["ogrencisinifi"].ToString(),
                        alani         = reader["ogrencisubesi"].ToString(),
                        subesi        = reader["ogrencialani"].ToString(),
                        ogretmeni     = reader["sinifogretmeni"].ToString(),
                        anneadi       = reader["anneadi"].ToString(),
                        babaadi       = reader["babaadi"].ToString(),
                        velitel       = reader["velitel"].ToString(),
                        telefonu      = reader["ogrencitel"].ToString(),
                        adresi        = reader["adres"].ToString(),
                        kartno        = reader["parmakizi"].ToString(),
                        durumu        = reader["ogrencidurum"].ToString(),
                        ogrencibakiye = Convert.ToDouble(reader["ogrencibakiye"].ToString()),
                        kalangiris    = Convert.ToInt32(reader["kalangiris"]),
                        ogrenciTip    = reader["ogrenciTip"].ToString()
                    };
                }
            }
            return(ogrenci);
        }
コード例 #3
0
        public void OgrenciGirisi(Ogrenci ogrenci, Turnike turnike)
        {
            baslangicdegerlerinial();
            textBoxogrencinumarasikaydet.Clear();
            try
            {
                pictureBox1.Image = null;
            } catch (Exception ex) { Helper.DosyayaYaz(ex.ToString()); }

            bool turnikeizni = false;

            foreach (var tb in anabilgitb)
            {
                tb.Clear();
            }
            OgrenciIsleri ogrenciIsleri = new OgrenciIsleri(ogrenci);

            if (String.IsNullOrEmpty(ogrenci.no))
            {
                try
                {
                    {
                        ((Form1)Application.OpenForms["Form1"]).pictureBoxfoto.Image = null; ((Form1)Application.OpenForms["Form1"]).labelogrno.Text = ""; ((Form1)Application.OpenForms["Form1"]).labeladsoyad.Text = ""; ((Form1)Application.OpenForms["Form1"]).labelsinif.Text = "";
                        ((Form1)Application.OpenForms["Form1"]).labeldurum.Font      = new Font("Candara", 88, FontStyle.Bold); ((Form1)Application.OpenForms["Form1"]).labeldurum.Text = "KAYITSIZ KART"; ((Form1)Application.OpenForms["Form1"]).labeldurum.ForeColor = Color.Red;
                    }
                }
                catch (Exception ex) { Helper.DosyayaYaz(ex.ToString()); }
                return;
            }


            ((Form1)Application.OpenForms["Form1"]).labeldurum.Font = new Font("Candara", 48, FontStyle.Bold);
            int yemekSaati         = ogrenciIsleri.OgrenciPrograminiGetir();
            int bugunkuGirisSayisi = ogrenciIsleri.BugunkugirisSayisi();
            int girisYapmisMi      = ogrenciIsleri.GirisYapmisMi();

            try
            {
                pictureBox1.Image    = Helper.ResimYukle(ogrenci.no);
                textBoxogrno.Text    = ogrenci.no; textBoxogrencinumarasikaydet.Text = ogrenci.no;
                textBoxogradi.Text   = ogrenci.adi; textBoxogrsoyad.Text = ogrenci.soyadi;
                textBoxogrsinif.Text = ogrenci.sinifi; textBoxogrsube.Text = ogrenci.subesi;
            }
            catch (Exception ex) { Helper.DosyayaYaz(ex.ToString()); }

            double bakiye = (ogrenci.ogrencibakiye - ogrenciIsleri.YemekUcreti());

            if (ogrenci.no.Substring(0, 1) == "P")
            {
                ogrenci.kalangiris = 0;
            }
            if (yemekSaati > 0 || !checkBox10.Checked || ogrenci.no.Substring(0, 1) == "M")
            {
                if (bakiye >= 0 || ogrenci.kalangiris > 0 || ogrenci.no.Substring(0, 1) == "M")
                {
                    if (girisYapmisMi == 0 || ogrenci.no.Substring(0, 1) == "M" || !checkBox9.Checked)
                    {
                        try
                        {
                            ogrenciIsleri.GirisYap(turnike);
                            labeldurum.ForeColor = Color.Lime;
                            richTextBox1.Text    = ogrenci.no + "Numaralı " + ogrenci.adi + " Giriş Yaptı." + DateTime.Now + "\n" + richTextBox1.Text;
                            labeldurum.Text      = "Öğrenci Girişi Gerçekleştirildi.";
                        }
                        catch (Exception ex)
                        {
                            Helper.DosyayaYaz(ex.ToString());
                        }

                        try
                        {
                            if (checkBox3.Checked)     //BAKİYE GÖSTERİLSİN Mİ
                            {
                                if (ogrenci.ogrenciTip == "Bakiye")
                                {
                                    labeldurum.ForeColor = Color.LimeGreen; labeldurum.Text = "AFİYET OLSUN  Kalan Bakiye: \n" + ogrenci.ogrencibakiye + "  TL";
                                }
                                else if (ogrenci.ogrenciTip == "Girişsayı")
                                {
                                    labeldurum.ForeColor = Color.LimeGreen; labeldurum.Text = "AFİYET OLSUN  Kalan Giriş: \n" + ogrenci.kalangiris + "  ";
                                }
                            }
                            else
                            {
                                if (ogrenci.no.Substring(0, 1).ToString() == "P")
                                {
                                    labeldurum.ForeColor = Color.LimeGreen; labeldurum.Text = "AFİYET OLSUN  Kalan Bakiye: \n" + ogrenci.ogrencibakiye + "  TL";
                                }
                                else
                                {
                                    labeldurum.ForeColor = Color.LimeGreen; labeldurum.Text = "AFİYET OLSUN";
                                }
                            }
                        }catch (Exception ex) { Helper.DosyayaYaz(ex.ToString()); }

                        string mesaj = ""; mesaj = (ogrenci.no + " NUMARALI " + ogrenci.adi + " " + ogrenci.soyadi + " " + richTextBoxgirissms.Text + " Kalan Bakiye:" + ogrenci.ogrencibakiye);

                        if (checkBox5.Checked)
                        {
                            turnike.Ac();
                        }                                           //Turnike devrede ise aç
                        if (checkBox1.Checked)
                        {
                            { smsgonder(ogrenci.velitel, mesaj); }
                        }
                        if (checkBox2.Checked)    //Bakiye Azaldığında SMS Gönder
                        {
                            if (ogrenci.ogrenciTip == "Bakiye")
                            {
                                if (ogrenci.ogrencibakiye <= ogrenciIsleri.YemekUcreti() * 2)
                                {
                                    mesaj = ""; mesaj = (ogrenci.no + " NUMARALI " + ogrenci.adi + " " + ogrenci.soyadi + ". Kalan Bakiye:" + ogrenci.ogrencibakiye + " TL.Giriş Yapılması İçin Lütfen Bakiye Yükleyiniz."); smsgonder(ogrenci.velitel, mesaj);
                                }
                            }
                            else if (ogrenci.ogrenciTip == "Girişsayı")
                            {
                                if (ogrenci.kalangiris <= 2)
                                {
                                    mesaj = ""; mesaj = (ogrenci.no + " NUMARALI " + ogrenci.adi + " " + ogrenci.soyadi + ". Kalan Giriş Hakkı:" + ogrenci.kalangiris + ".Giriş Yapılması İçin Lütfen Bakiye Yükleyiniz."); smsgonder(ogrenci.velitel, mesaj);
                                }
                            }
                        }
                        textBoxogrdurum.Text = "İçerde";
                    }
                    else
                    {
                        try
                        {
                            if (ogrenci.no.Substring(0, 1) != "P")
                            {
                                try { labeldurum.ForeColor = Color.Red; labeldurum.Text = "ÖĞRENCİ ZATEN İÇERDE..."; } catch (Exception) { }
                            }
                            else if (ogrenci.no.Substring(0, 1) == "P")
                            {
                                try { labeldurum.ForeColor = Color.Red; labeldurum.Text = "PERSONEL ZATEN İÇERDE..."; } catch (Exception) { }
                            }
                        }
                        catch (Exception ex)
                        {
                            Helper.DosyayaYaz(ex.ToString());
                        }
                    }
                }
                else
                {
                    try{ labeldurum.ForeColor = Color.Red; labeldurum.Text = "YETERSİZ BAKİYE"; }catch (Exception) { }
                }
            }
            else
            {
                try{ labeldurum.ForeColor = Color.Red; labeldurum.Text = "YEMEK SAATİ BİTTİ. GİRİŞ YOK!"; } catch (Exception ex) { }
            }
            PaneliGuncelle(ogrenci, turnike, labeldurum.Text, labeldurum.ForeColor);
        }
コード例 #4
0
 public OgrenciIsleri(Ogrenci ogrenci)
 {
     _baglanti = Helper.XmlOku()[0];
     _ogrenci  = ogrenci;
     OgrenciPrograminiGetir();
 }