private void UrunGuncelle_Load(object sender, EventArgs e) { urun = productOperations.urunGetir(urunID.ToString()); txtUrunGuncelleUrunID.Text = urun.UrunID; txtBxUrunAdiGuncelle.Text = urun.UrunAdi; txtBxStokAdediGuncelle.Text = urun.urunStok; txtBxBirimFiyatGuncelle.Text = urun.urunBirimFiyat.ToString(); }
private void cmbBxUrunler_SelectedIndexChanged(object sender, EventArgs e) { seciliUrun = urunListesi[cmbBxUrunler.SelectedIndex]; numUrunAdeti.Maximum = Convert.ToInt32(seciliUrun.urunStok); txtFiyat.Text = (Double.Parse(seciliUrun.urunBirimFiyat.ToString()) * Convert.ToInt32(numUrunAdeti.Value)).ToString(); if (Convert.ToInt32(seciliUrun.urunStok) > 0) { numUrunAdeti.Value = 1; } else { numUrunAdeti.Value = 0; } lblMevcutStok.Text = seciliUrun.urunStok; }
public void UrunlerComboboxItemsAdd(ComboBox urunlerComboBox, List <UrunModel> urunlist) { sqlConnection.Connection().Open(); SqlCommand urungetir = new SqlCommand("select * from tblurunler", sqlConnection.Connection()); SqlDataReader data = urungetir.ExecuteReader(); while (data.Read()) { UrunModel urun = new UrunModel(); urun.UrunID = data[0].ToString(); urun.UrunAdi = data[1].ToString(); urun.urunStok = data[2].ToString(); urun.urunBirimFiyat = (float)Double.Parse(data[3].ToString()); urunlist.Add(urun); urunlerComboBox.Items.Add(urun.UrunAdi); } sqlConnection.Connection().Close(); }
public UrunModel urunGetir(String Id) { UrunModel seciliUrun = new UrunModel(); sqlConnection.Connection().Open(); SqlCommand seciliUrungetir = new SqlCommand("select * from tblurunler where urunID = @p1", sqlConnection.Connection()); seciliUrungetir.Parameters.AddWithValue("@p1", Id); SqlDataReader data = seciliUrungetir.ExecuteReader(); while (data.Read()) { seciliUrun.UrunID = data[0].ToString(); seciliUrun.UrunAdi = data[1].ToString(); seciliUrun.urunStok = data[2].ToString(); seciliUrun.urunBirimFiyat = (float)Double.Parse(data[3].ToString()); } sqlConnection.Connection().Close(); return(seciliUrun); }
public void UrunleriGetir(DataGridView datagrid) { List <UrunModel> urunlerList = new List <UrunModel>(); sqlConnection.Connection().Open(); SqlCommand urungetir = new SqlCommand("select * from tblurunler", sqlConnection.Connection()); SqlDataReader data = urungetir.ExecuteReader(); while (data.Read()) { UrunModel urun = new UrunModel(); urun.UrunID = data[0].ToString(); urun.UrunAdi = data[1].ToString(); urun.urunStok = data[2].ToString(); urun.urunBirimFiyat = (float)Double.Parse(data[3].ToString()); urunlerList.Add(urun); } sqlConnection.Connection().Close(); datagrid.DataSource = urunlerList; }