private void btn_Sorgula_Click(object sender, EventArgs e)
        {
            using (DurakIhlalTespitiEntities1 database = new DurakIhlalTespitiEntities1())
            {
                var bilgi = (from b in database.Arac_cezalı
                             where b.plaka == txtBoxPlakaSorgu.Text
                             select new
                {
                    b.plaka,
                    b.gun,
                    b.ay,
                    b.yıl
                });

                if (bilgi == null)
                {
                    MessageBox.Show("Plakaya ait Ceza bulunmamakta", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    dataGridViewSorgu.DataSource          = bilgi.ToList();
                    dataGridViewSorgu.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                    dataGridViewSorgu.Visible             = true;
                }
            }
        }
        private void btnKameralistesi_Click(object sender, EventArgs e)
        {
            DurakIhlalTespitiEntities1 libraryentity = new DurakIhlalTespitiEntities1();

            var kamera = from x in libraryentity.Kamera_bilgi
                         select new
            {
                x.Kamera_kodu,
                x.Il,
                x.Ilce,
                x.Cadde,
                x.Arıza_durum
            };

            dataGridViewkamera.DataSource          = kamera.ToList();
            dataGridViewkamera.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            //lblCountofuser.Text = users.Count().ToString();
        }
Exemple #3
0
        public void splitjson(string veri)
        {
            string[] arac = veri.Split('}');
            string[] seri2;
            string[] seri1;
            for (int i = 0; i < arac.Length; i++)
            {
                try
                {
                    seri1   = arac[i].Split('"');
                    arackey = seri1[1];
                    plaka   = seri1[5];
                    ay      = seri1[8];
                    gun     = seri1[10];
                    seri2   = seri1[12].Split('}');
                    yıl     = seri2[0];
                    using (DurakIhlalTespitiEntities1 entity = new DurakIhlalTespitiEntities1())
                    {
                        Arac_cezalı cz_arac = new Arac_cezalı();
                        cz_arac.ID    = Convert.ToString(sayac);
                        cz_arac.plaka = this.Plaka;
                        cz_arac.gun   = this.Gun;
                        cz_arac.ay    = this.Ay;
                        cz_arac.yıl   = this.Yıl;
                        entity.Arac_cezalı.Add(cz_arac);

                        entity.SaveChanges();
                    }
                }
                catch
                {
                }


                sayac++;
            }
        }
 private void dataGridViewSorgu_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (seciliislem == "Gunluk")
     {
         string deger = dataGridViewSorgu.CurrentRow.Cells["Gun"].Value.ToString();
         using (DurakIhlalTespitiEntities1 en = new DurakIhlalTespitiEntities1())
         {
             var bilgiler = (from b in en.Arac_cezalı
                             where b.gun == deger
                             select new
             {
                 b.plaka,
                 b.gun,
                 b.ay,
                 b.yıl
             });
             dataGridViewSecilPlaka.DataSource          = bilgiler.ToList();
             dataGridViewSecilPlaka.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
             dataGridViewSecilPlaka.Visible             = true;
             btnKapat.Visible        = true;
             PanelSeciliArac.Visible = true;
         }
     }
     else if (seciliislem == "Aylık")
     {
         string deger = dataGridViewSorgu.CurrentRow.Cells["Ay"].Value.ToString();
         using (DurakIhlalTespitiEntities1 en = new DurakIhlalTespitiEntities1())
         {
             var bilgiler = (from b in en.Arac_cezalı
                             where b.ay == deger
                             select new
             {
                 b.plaka,
                 b.gun,
                 b.ay,
                 b.yıl
             });
             dataGridViewSecilPlaka.DataSource          = bilgiler.ToList();
             dataGridViewSecilPlaka.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
             dataGridViewSecilPlaka.Visible             = true;
             btnKapat.Visible        = true;
             PanelSeciliArac.Visible = true;
         }
     }
     else if (seciliislem == "Yıllık")
     {
         string deger = dataGridViewSorgu.CurrentRow.Cells["Yıl"].Value.ToString();
         using (DurakIhlalTespitiEntities1 en = new DurakIhlalTespitiEntities1())
         {
             var bilgiler = (from b in en.Arac_cezalı
                             where b.yıl == deger
                             select new
             {
                 b.plaka,
                 b.gun,
                 b.ay,
                 b.yıl
             });
             dataGridViewSecilPlaka.DataSource          = bilgiler.ToList();
             dataGridViewSecilPlaka.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
             dataGridViewSecilPlaka.Visible             = true;
             btnKapat.Visible        = true;
             PanelSeciliArac.Visible = true;
         }
     }
     else
     {
         string deger = dataGridViewSorgu.CurrentRow.Cells["Plaka"].Value.ToString();
         using (DurakIhlalTespitiEntities1 en = new DurakIhlalTespitiEntities1())
         {
             var bilgiler = (from b in en.Arac_cezalı
                             where b.plaka == deger
                             select new
             {
                 b.plaka,
                 b.gun,
                 b.ay,
                 b.yıl
             });
             dataGridViewSecilPlaka.DataSource          = bilgiler.ToList();
             dataGridViewSecilPlaka.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
             dataGridViewSecilPlaka.Visible             = true;
             btnKapat.Visible        = true;
             PanelSeciliArac.Visible = true;
         }
     }
 }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DurakIhlalTespitiEntities1 entityihlal = new DurakIhlalTespitiEntities1();

            if (radioButton_Gunluk.Checked == true)
            {
                seciliislem = "Gunluk";
                var ihlal = from p in entityihlal.Arac_cezalı
                            group p by p.gun into g
                            select new
                {
                    Gun          = g.Key,
                    İhlal_Sayısı = g.Count()
                };
                dataGridViewSorgu.DataSource          = ihlal.ToList();
                dataGridViewSorgu.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dataGridViewSorgu.Visible             = true;
                radioButton_Gunluk.Checked            = false;
            }
            else if (radioButton_Aylik.Checked == true)
            {
                seciliislem = "Aylık";
                var ihlal = from p in entityihlal.Arac_cezalı
                            group p by p.ay into g
                            select new
                {
                    Ay           = g.Key,
                    İhlal_Sayısı = g.Count()
                };
                dataGridViewSorgu.DataSource          = ihlal.ToList();
                dataGridViewSorgu.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dataGridViewSorgu.Visible             = true;
                radioButton_Aylik.Checked             = false;
            }
            else if (radioButton_Yillik.Checked == true)
            {
                seciliislem = "Yıllık";
                var ihlal = from p in entityihlal.Arac_cezalı
                            group p by p.yıl into g
                            select new
                {
                    Yıl          = g.Key,
                    İhlal_Sayısı = g.Count()
                };
                dataGridViewSorgu.DataSource          = ihlal.ToList();
                dataGridViewSorgu.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dataGridViewSorgu.Visible             = true;
                radioButton_Yillik.Checked            = false;
            }
            else
            {
                var ihlal = from tablo in entityihlal.Arac_cezalı
                            select new
                {
                    tablo.plaka,
                    tablo.gun,
                    tablo.ay,
                    tablo.yıl
                };
                dataGridViewSorgu.DataSource          = ihlal.ToList();
                dataGridViewSorgu.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dataGridViewSorgu.Visible             = true;
            }
        }