示例#1
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e) //Griddeki elemana Tıklama
        {
            DataGridView dgv = sender as DataGridView;

            if (dgv != null && dgv.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgv.SelectedRows[0];
                if (row != null)
                {
                    textBox16.Text    = row.Cells[0].Value.ToString();
                    pictureBox7.Image = Helper.ResimYukle(textBox16.Text);
                    Ogrenci ogrenci = OgrenciIsleri.OgrenciNoileGetir(textBox16.Text);
                    textBox17.Text = ogrenci.TC;
                    textBox18.Text = ogrenci.adi;
                    textBox19.Text = ogrenci.soyadi;
                    textBox26.Text = ogrenci.anneadi;
                    textBox20.Text = ogrenci.babaadi;
                    maskedTextBoxOgrenciTel.Text = ogrenci.telefonu;
                    maskedTextBoxVeliTel.Text    = ogrenci.velitel;
                    textBox29.Text = ogrenci.sinifi;
                    comboBox6.Text = ogrenci.alani;
                    textBox27.Text = ogrenci.subesi;
                    textBox23.Text = ogrenci.kartno;
                }
            }
        }
示例#2
0
 public void Receive()
 {
     while (true)
     {
         byte[] bytes = listener.Receive(ref groupEP);
         turnikeveri = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
         try
         {
             if (turnikeveri.Length > 3 && turnikeveri.Substring(0, 1) == "T")
             {
                 Turnike turnike = new Turnike();
                 turnike.Haberlesme           = "ETH";
                 turnike.No                   = Convert.ToInt32(turnikeveri.Substring(4, 1));
                 turnike.Reader               = Convert.ToInt32(turnikeveri.Substring(turnikeveri.IndexOf("Reader") + 7, 1));
                 turnike.KartNo               = turnikeveri.Substring(turnikeveri.IndexOf("UID:") + 4, 8);
                 textBoxparmakizikimliği.Text = turnike.KartNo;
                 Ogrenci ogrenci = OgrenciIsleri.KartNoileGetir(turnike.KartNo);
                 if (turnike.Reader == 1)
                 {
                     Thread tpd = new Thread(() => OgrenciGirisi(ogrenci, turnike)); tpd.Start();
                 }
             }
         }
         catch (Exception ex)
         {
             Helper.DosyayaYaz(ex.ToString());
         }
     }
 }
示例#3
0
        private void button19_Click(object sender, EventArgs e)
        {
            Turnike turnike = new Turnike();
            Ogrenci ogrenci = OgrenciIsleri.KartNoileGetir("6");

            OgrenciGirisi(ogrenci, turnike);
        }
示例#4
0
        } //Tarih-Saat Kontrolü

        private void button13_Click(object sender, EventArgs e)
        {
            Turnike turnike = new Turnike()
            {
                Haberlesme = haberlesme, No = 0, Reader = 0
            };
            Ogrenci ogrenci = OgrenciIsleri.OgrenciNoileGetir(textBox45.Text);

            OgrenciGirisi(ogrenci, turnike);
        }
示例#5
0
        private void buttonogrencinumarasikaydet_Click(object sender, EventArgs e)
        {
            Ogrenci ogrenci = OgrenciIsleri.OgrenciNoileGetir(textBoxogrencinumarasikaydet.Text);

            if (ogrenci.no == null)
            {
                return;
            }
            ogrenci.kartno = textBoxparmakizikimliği.Text;
            (new OgrenciIsleri(ogrenci)).OgrenciGuncelle();
        }
示例#6
0
 private void timer1_Tick(object sender, EventArgs e) //
 {
     try
     {
         labelsaat.Text  = DateTime.Now.ToString("HH:mm");
         labeltarih.Text = DateTime.Now.ToString("dd-MM-yyyy");
         SqlCommand ktemp; SqlDataReader rdtemp;
         if (DateTime.Now.ToString("HH:mm") == "00:10")
         {
             richTextBox1.Clear();
             OgrenciIsleri ogrenciIsleri = new OgrenciIsleri();
             ogrenciIsleri.OgrencileriDurumlariniSifirla();
         }
     }
     catch (Exception ex)
     {
         Helper.DosyayaYaz(ex.ToString());
     }
 } //Tarih-Saat Kontrolü
示例#7
0
        public void spislem(object sender, SerialDataReceivedEventArgs e) //SERİPORT EVENTİ
        {
            SerialPort sp      = (SerialPort)sender;
            Turnike    turnike = new Turnike();

            turnike.Haberlesme = "SER";
            turnike.PortNo     = sp.PortName;;
            string gelenmesaj = sp.ReadLine();

            try
            {
                if (gelenmesaj.Length < 4)
                {
                    return;
                }
                if (gelenmesaj.Substring(0, 4) == "<ID>")
                {
                    string modulid   = gelenmesaj.Substring(gelenmesaj.IndexOf("<ID>") + 4, 1);
                    string modulport = sp.PortName;
                    turnike.No     = Convert.ToInt32(modulid);
                    turnike.PortNo = modulport;
                }
                if (gelenmesaj.Substring(0, 4) == "TNO:")
                {
                    turnike.No     = Convert.ToInt32(gelenmesaj.Substring(4, 1));
                    turnike.KartNo = gelenmesaj.Substring(gelenmesaj.IndexOf("UID:") + 4, 8);
                    turnike.Reader = Convert.ToInt32(gelenmesaj.Substring(gelenmesaj.IndexOf("Reader") + 7, 1));
                    textBoxparmakizikimliği.Text = turnike.KartNo;
                    Ogrenci ogrenci = OgrenciIsleri.KartNoileGetir(turnike.KartNo);
                    if (turnike.Reader == 0)
                    {
                        OgrenciGirisi(ogrenci, turnike);
                    }
                }
            }
            catch (Exception ex)
            {
                Helper.DosyayaYaz(ex.ToString());
            }
        }
示例#8
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);
        }