Exemplo n.º 1
0
        private void BtnSguncelle_Click(object sender, EventArgs e)
        {
            Subeler sube = new Subeler(Convert.ToInt32(dgwSubeler.CurrentRow.Cells[0].Value), tbxSubeAdi.Text, tbxSubeTelefon.Text, tbxSubeAdres.Text);

            islemler.SubeGuncelle(sube);
            MessageBox.Show("Şube Güncellendi");
            islemler.LoadSubeler(dgwSubeler);
        }
Exemplo n.º 2
0
        //Sube

        public void SubeEkle(Subeler yeniSube)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("INSERT INTO Subeler VALUES (@ad,@telefon,@adres)", conn);

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

            conn.Close();
        }
Exemplo n.º 3
0
        public void SubeGuncelle(Subeler yeniSube)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("UPDATE Subeler SET Ad=@ad,Telefon=@telefon,Adres=@adres WHERE SubeID=@subeID)", conn);

            command.Parameters.AddWithValue("subeID", yeniSube.SubeID);
            command.Parameters.AddWithValue("ad", yeniSube.Ad);
            command.Parameters.AddWithValue("telefon", yeniSube.Telefon);
            command.Parameters.AddWithValue("adres", yeniSube.Adres);
            command.ExecuteNonQuery();

            conn.Close();
        }
Exemplo n.º 4
0
        public List <Subeler> GetSubeler()
        {
            ConnectionControl();


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

            SqlDataReader reader = command.ExecuteReader();

            List <Subeler> Sube = new List <Subeler>();

            while (reader.Read())
            {
                Subeler s = new Subeler(Convert.ToInt32(reader["SubeID"]), reader["Ad"].ToString(), reader["Telefon"].ToString(), reader["Adres"].ToString());
                Sube.Add(s);
            }

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