public List <Araba> Select()
        {
            List <Araba>  list    = new List <Araba>();
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "SELECT * FROM araba",
            };
            DataTable dt = Utilty.RunDataReader(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var row     = dt.Rows[i];
                int insanId = -1;
                if (row["insanId"] != DBNull.Value)
                {
                    insanId = Convert.ToInt32(dt.Rows[i]["insanId"]);
                }

                list.Add(
                    new Araba
                {
                    insanId = Convert.ToInt32(dt.Rows[i]["id"]),
                    InsanId = insanId,
                    //Model = dt.Rows[i]["model"].ToString(),
                    //Tip = dt.Rows[i]["tip"].ToString(),
                    Plaka = dt.Rows[i]["plaka"].ToString(),
                }
                    );
            }

            return(list);
        }
        public bool Delete(int id)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "DELETE FROM insan WHERE id=@id",
            };

            command.Parameters.AddWithValue("@id", id);
            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Insert(ArabaTip entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "INSERT INTO arac_tipi (ad) values (@ad)",
            };

            command.Parameters.AddWithValue("@ad", entity.Ad);
            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Insert(Musteri entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "INSERT INTO insan (isim,telefon) values (@isim,@telefon)",
            };

            command.Parameters.AddWithValue("@isim", entity.isim);
            command.Parameters.AddWithValue("@telefon", entity.telefon);
            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Insert(HizmetTip entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "INSERT INTO hizmet_tipi (hizmetAdi,ucret) values (@hizmetAdi,@ucret)",
            };

            command.Parameters.AddWithValue("@hizmetAdi", entity.hizmetAdi);
            command.Parameters.AddWithValue("@ucret", entity.Ucret);
            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Insert(Araba entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "INSERT INTO araba (insanId,plaka) values (@insanId,@plaka)",
            };

            command.Parameters.AddWithValue("@insanId", entity.InsanId);
            command.Parameters.AddWithValue("@plaka", entity.Plaka);

            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Update(Musteri entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "UPDATE insan SET telefon = @telefon, isim =@isim WHERE id=@id ",
            };

            command.Parameters.AddWithValue("@id", entity.Id);
            command.Parameters.AddWithValue("@telefon", entity.telefon);
            command.Parameters.AddWithValue("@isim", entity.isim);

            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Update(HizmetTip entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "UPDATE hizmet_tipi SET Ucret = @Ucret, hizmetAdi =@hizmetAdi WHERE id=@id ",
            };

            command.Parameters.AddWithValue("@id", entity.Id);
            command.Parameters.AddWithValue("@hizmetAdi", entity.hizmetAdi);
            command.Parameters.AddWithValue("@Ucret", entity.Ucret);

            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Update(ArabaTip entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "UPDATE arac_tipi SET ucretFarki = @ucretFarki, Ad =@Ad WHERE id=@id ",
            };

            command.Parameters.AddWithValue("@id", entity.Id);
            command.Parameters.AddWithValue("@Ad", entity.Ad);
            command.Parameters.AddWithValue("@ucretFarki", entity.ucretFarki);

            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public bool Update(Araba entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "UPDATE araba SET model = @model, tip =@tip, plaka =@plaka, insanId=@insanId WHERE id=@id ",
            };

            command.Parameters.AddWithValue("@id", entity.insanId);
            command.Parameters.AddWithValue("@insanId", entity.insanId);
            command.Parameters.AddWithValue("@plaka", entity.Plaka);


            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
Exemple #11
0
        public bool Insert(Hizmet entity)
        {
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "INSERT INTO hizmetler (ArabaId,HizmetTipiId,MusteriId,Tarih,OdemeTipi,Ucret) values (@ArabaId,@HizmetTipiId,@MusteriId,@Tarih,@OdemeTipi,@Ucret)",
            };

            command.Parameters.AddWithValue("@ArabaId", entity.ArabaId);
            command.Parameters.AddWithValue("@HizmetTipiId", entity.HizmetTipiId);
            command.Parameters.AddWithValue("@MusteriId", entity.MusteriId);

            command.Parameters.AddWithValue("@Tarih", entity.Tarih);
            command.Parameters.AddWithValue("@OdemeTipi", entity.OdemeTipi);
            command.Parameters.AddWithValue("@Ucret", entity.Ucret);
            int result = Utilty.RunExecuteNonQuery(command);

            return(result > 0);
        }
        public List <ArabaModel> Select()
        {
            List <ArabaModel> list    = new List <ArabaModel>();
            SQLiteCommand     command = new SQLiteCommand
            {
                CommandText = "SELECT * FROM arac_modelleri",
            };
            DataTable dt = Utilty.RunDataReader(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                list.Add(
                    new ArabaModel
                {
                    Id = Convert.ToInt32(dt.Rows[i]["id"]),
                    Ad = dt.Rows[i]["ad"].ToString()
                }
                    );
            }

            return(list);
        }
        public List <Musteri> Select()
        {
            List <Musteri> list    = new List <Musteri>();
            SQLiteCommand  command = new SQLiteCommand
            {
                CommandText = "SELECT * FROM insan ",
            };
            DataTable dt = Utilty.RunDataReader(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                list.Add(
                    new Musteri
                {
                    Id      = Convert.ToInt32(dt.Rows[i]["id"]),
                    isim    = dt.Rows[i]["isim"].ToString(),
                    telefon = Convert.ToInt32(dt.Rows[i]["telefon"])
                }
                    );
            }

            return(list);
        }
        public List <HizmetTip> Select()
        {
            List <HizmetTip> list    = new List <HizmetTip>();
            SQLiteCommand    command = new SQLiteCommand
            {
                CommandText = "SELECT * FROM hizmet_tipi",
            };
            DataTable dt = Utilty.RunDataReader(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                list.Add(
                    new HizmetTip
                {
                    Id        = Convert.ToInt32(dt.Rows[i]["id"]),
                    hizmetAdi = dt.Rows[i]["hizmetAdi"].ToString(),
                    Ucret     = Convert.ToInt32(dt.Rows[i]["ucret"])
                }
                    );
            }

            return(list);
        }
        public List <Admin> Select()
        {
            List <Admin>  list    = new List <Admin>();
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = "SELECT * FROM admin",
            };
            DataTable dt = Utilty.RunDataReader(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                list.Add(
                    new Admin
                {
                    Id       = Convert.ToInt32(dt.Rows[i]["Id"]),
                    Email    = dt.Rows[i]["Email"].ToString(),
                    Password = dt.Rows[i]["Password"].ToString()
                }
                    );
            }

            return(list);
        }
Exemple #16
0
        public List <Hizmet> Select()
        {
            List <Hizmet> list    = new List <Hizmet>();
            SQLiteCommand command = new SQLiteCommand
            {
                CommandText = @"SELECT 
                                       h.*, 
                                       am.ad as arabaAdi,
                                       ht.hizmetadi as hizmetAdi,
                                       i.isim as musteriAdi
                               FROM hizmetler h
                               Left Join arac_modelleri am on am.id = h.arabaId
                               Left Join hizmet_tipi ht on ht.id = h.hizmetTipiId
                               Left Join insan i on i.id = h.musteriId",
            };
            DataTable dt = Utilty.RunDataReader(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                list.Add(
                    new Hizmet
                {
                    Id           = Convert.ToInt32(dt.Rows[i]["id"]),
                    ArabaId      = Convert.ToInt32(dt.Rows[i]["arabaId"]),
                    HizmetTipiId = Convert.ToInt32(dt.Rows[i]["hizmetTipiId"]),
                    MusteriId    = Convert.ToInt32(dt.Rows[i]["musteriId"]),
                    OdemeTipi    = dt.Rows[i]["odemeTipi"].ToString(),
                    Ucret        = Convert.ToInt32(dt.Rows[i]["ucret"]),
                    Tarih        = Convert.ToDateTime(dt.Rows[i]["tarih"]),
                    Isim         = dt.Rows[i]["musteriAdi"].ToString(),
                    Ad           = dt.Rows[i]["arabaAdi"].ToString(),
                    HizmetAdi    = dt.Rows[i]["hizmetAdi"].ToString(),
                }
                    );
            }
            return(list);
        }