public static string Ekle(string masaAdi, ESiparisler s) { if (s.ProductName == "" || s.Quantity < 0) { return("Hatalı işlem..."); } else { DALSiparisler.Ekle(masaAdi, s); return("Eklendi..."); } }
public static void Ekle(string masaAdi, ESiparisler s) { int urunID = DALUrun.UrunBul(s.ProductName).ID; int masaID = DALMasa.MasaBul(masaAdi).ID; SqlCommand cmd = new SqlCommand("sp_SiparisEkle", baglanti.conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("masaID", masaID); cmd.Parameters.AddWithValue("urunID", urunID); cmd.Parameters.AddWithValue("miktar", s.Quantity); baglanti.conn.Open(); cmd.ExecuteNonQuery(); baglanti.conn.Close(); }
private void btnEkle_Click(object sender, EventArgs e) { ESiparisler s = new ESiparisler(); s.ProductName = cmbUrun.Text; s.Quantity = Convert.ToInt32(numMiktar.Value); string cevap = BLLSiparisler.Ekle(Form1.masaAdi, s); MessageBox.Show(cevap); frmMasaDetay fmd = Application.OpenForms["frmMasaDetay"] as frmMasaDetay; fmd.Doldur(); Form1 f1 = Application.OpenForms["Form1"] as Form1; f1.Doldur(); }
public static List <ESiparisler> SiparisleriBul(string masaAdi) { SqlCommand cmd = new SqlCommand("sp_SiparisleriBul", baglanti.conn); cmd.CommandType = CommandType.StoredProcedure; baglanti.conn.Open(); cmd.Parameters.AddWithValue("masaAdi", masaAdi); SqlDataReader dr = cmd.ExecuteReader(); List <ESiparisler> sListe = new List <ESiparisler>(); while (dr.Read()) { ESiparisler s = new ESiparisler(); s.ProductName = dr["ProductName"].ToString(); s.Quantity = Convert.ToInt32(dr["Quantity"]); sListe.Add(s); } dr.Close(); baglanti.conn.Close(); return(sListe); }