Esempio n. 1
0
        private void BtnMIKaydet_Click(object sender, EventArgs e)
        {
            Musteriler guncelMusteri = new Musteriler(Convert.ToInt32(dgwMusteriIslemleri.CurrentRow.Cells[0].Value), tbxMIAd.Text, tbxMISoyad.Text, tbxMIAdres.Text, tbxMITel.Text);

            islemler.MusteriGuncelle(guncelMusteri);
            islemler.LoadMusteriler(dgwMusteriIslemleri);
        }
Esempio n. 2
0
        //Musteri

        public void MusteriEkle(Musteriler yeniMusteri)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("INSERT INTO Musteriler VALUES (@ad,@soyad,@adres,@telefon)", conn);

            command.Parameters.AddWithValue("ad", yeniMusteri.Ad);
            command.Parameters.AddWithValue("soyad", yeniMusteri.Soyad);
            command.Parameters.AddWithValue("adres", yeniMusteri.Adres);
            command.Parameters.AddWithValue("telefon", yeniMusteri.Telefon);
            command.ExecuteNonQuery();

            conn.Close();
        }
Esempio n. 3
0
        public void MusteriGuncelle(Musteriler yeniMusteri)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("UPDATE Musteriler SET Ad=@ad, Soyad=@soyad, Adres=@adres,Telefon=@telefon WHERE MusteriID=@musteriID", conn);


            command.Parameters.AddWithValue("musteriId", yeniMusteri.MusteriID);
            command.Parameters.AddWithValue("ad", yeniMusteri.Ad);
            command.Parameters.AddWithValue("soyad", yeniMusteri.Soyad);
            command.Parameters.AddWithValue("adres", yeniMusteri.Adres);
            command.Parameters.AddWithValue("telefon", yeniMusteri.Telefon);
            command.ExecuteNonQuery();

            conn.Close();
        }
Esempio n. 4
0
        //Get
        public List <Musteriler> GetMusteriler()
        {
            ConnectionControl();


            SqlCommand command = new SqlCommand("SELECT * FROM Musteriler", conn);

            SqlDataReader reader = command.ExecuteReader();

            List <Musteriler> Musteri = new List <Musteriler>();

            while (reader.Read())
            {
                Musteriler m = new Musteriler(Convert.ToInt32(reader["MusteriID"]), reader["Ad"].ToString(), reader["Soyad"].ToString(), reader["Adres"].ToString(), reader["Telefon"].ToString());
                Musteri.Add(m);
            }

            reader.Close();
            conn.Close();
            return(Musteri);
        }