Exemple #1
0
        private void BtnKuryeGuncel_Click(object sender, EventArgs e)
        {
            Kuryeler kurye = new Kuryeler(Convert.ToInt32(dgwKuryeler.CurrentRow.Cells[1]), tbxKuryeAd.Text, tbxKuryeSoyad.Text);

            islemler.KuryeGuncelle(kurye);
            MessageBox.Show("Güncellendi!");
        }
Exemple #2
0
        //Kurye
        public void KuryeEkle(Kuryeler yeniKurye)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("INSERT INTO Kuryeler VALUES (@subeID,@ad,@soyad)", conn);

            command.Parameters.AddWithValue("subeID", yeniKurye.SubeID);
            command.Parameters.AddWithValue("ad", yeniKurye.Ad);
            command.Parameters.AddWithValue("soyad", yeniKurye.Soyad);
            command.ExecuteNonQuery();

            conn.Close();
        }
Exemple #3
0
        public void KuryeGuncelle(Kuryeler yeniKurye)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("UPDATE Kuryeler SET SubeID=@subeID,Ad=@ad,Soyad=@soyad WHERE KuryeID=@kuryeID)", conn);

            command.Parameters.AddWithValue("kuryeID", yeniKurye.KuryeID);
            command.Parameters.AddWithValue("subeID", yeniKurye.SubeID);
            command.Parameters.AddWithValue("ad", yeniKurye.Ad);
            command.Parameters.AddWithValue("soyad", yeniKurye.Soyad);
            command.ExecuteNonQuery();

            conn.Close();
        }
Exemple #4
0
        public List <Kuryeler> GetKuryeler()
        {
            ConnectionControl();

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

            SqlDataReader reader = command.ExecuteReader();

            List <Kuryeler> Kurye = new List <Kuryeler>();

            while (reader.Read())
            {
                Kuryeler k = new Kuryeler(Convert.ToInt32(reader["KuryeID"]), Convert.ToInt32(reader["SubeID"]), reader["Ad"].ToString(), reader["Soyad"].ToString());
                Kurye.Add(k);
            }

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