示例#1
0
        public int Sorgu(SirketAraci s)
        {
            int k = 0;

            try
            {
                cmd.CommandText = "Select Plaka, Giriskm From Sirket Where ID IN(select TOP 1 Max(ID) from Sirket where Plaka = '" + s.Plaka + "')  group by Plaka,Giriskm";
                cmd.CommandType = CommandType.Text;
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    k = Convert.ToInt32(reader[1]);
                }

                return(k);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
示例#2
0
 public void Guncelle(SirketAraci s)
 {
     try
     {
         cmd.CommandText = "Update Sirket SET Girisaati='" + s.Girisaati + "',Giriskm='" + s.Giriskm + "' Where ID='" + s.ID + "'and Tarih='" + s.Tarih + "'and Adisoyadi='" + s.Adisoyadi + "' and Plaka='" + s.Plaka + "' and Istikamet='" + s.Ekbilgi + "'and Cikisaati='" + s.Cikisaati + "'and Girisaati='GİRİŞ YAPILMADI'";
         cmd.CommandType = CommandType.Text;
         con.Open();
         cmd.ExecuteNonQuery();
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         if (con != null)
         {
             con.Close();
         }
     }
 }
示例#3
0
 public void Ekle(SirketAraci s)
 {
     try
     {
         cmd.CommandText = "INSERT INTO Sirket (Tarih,Adisoyadi,Plaka,Istikamet,Cikisaati,Girisaati,Cikiskm,Giriskm) VALUES('" + s.Tarih + "','" + s.Adisoyadi + "','" + s.Plaka + "','" + s.Ekbilgi + "','" + s.Cikisaati + "','" + s.Girisaati + "','" + s.Cikiskm + "','" + s.Giriskm + "')";
         cmd.CommandType = CommandType.Text;
         con.Open();
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     finally
     {
         if (con != null)
         {
             con.Close();
         }
     }
 }
示例#4
0
 public void Sil(SirketAraci s)
 {
     try
     {
         cmd.CommandText = "DELETE FROM Sirket WHERE ID='" + s.ID + "'";
         cmd.CommandType = CommandType.Text;
         con.Open();
         cmd.ExecuteNonQuery();
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         if (con != null)
         {
             con.Close();
         }
     }
 }
示例#5
0
        public List <SirketAraci> Listele()
        {
            try
            {
                List <SirketAraci> SirketAraciListesi = new List <SirketAraci>();
                cmd.CommandText = "SELECT * FROM Sirket WHERE Girisaati= 'GİRİŞ YAPILMADI'";
                cmd.CommandType = CommandType.Text;
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    SirketAraci s = new SirketAraci();
                    s.ID        = Convert.ToInt32(reader[0]);
                    s.Tarih     = reader[1].ToString();
                    s.Adisoyadi = reader[2].ToString();
                    s.Plaka     = reader[3].ToString();
                    s.Ekbilgi   = reader[4].ToString();
                    s.Cikisaati = reader[5].ToString();
                    s.Girisaati = reader[6].ToString();
                    s.Giriskm   = reader[7].ToString();
                    s.Cikiskm   = reader[8].ToString();

                    SirketAraciListesi.Add(s);
                }

                return(SirketAraciListesi);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
示例#6
0
        public List <SirketAraci> Listele5(string a, string b, string c, string plaka)
        {
            try
            {
                List <SirketAraci> Sirketaracisorgu = new List <SirketAraci>();
                cmd.CommandText = "select * from sirketplakas('" + a + "','" + b + "','" + c + "','" + plaka + "') Order by Convert(INT,REPLACE(CIKISAATİ,':','0')) asc";
                cmd.CommandType = CommandType.Text;
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    SirketAraci s = new SirketAraci();

                    s.Tarih     = reader[0].ToString();
                    s.Plaka     = reader[1].ToString();
                    s.Adisoyadi = reader[2].ToString();
                    s.Ekbilgi   = reader[3].ToString();
                    s.Cikisaati = reader[4].ToString();
                    s.Cikiskm   = reader[5].ToString();
                    s.Girisaati = reader[6].ToString();
                    s.Giriskm   = reader[7].ToString();
                    Sirketaracisorgu.Add(s);
                }

                return(Sirketaracisorgu);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }