/// <summary> /// Siparişi ekler sonrasında ürün fiyatını alır masanın hesabına ekler /// </summary> /// <param name="tableID"></param> /// <param name="productID"></param> /// <param name="catID"></param> /// <param name="total"></param> /// <param name="date"></param> /// <returns></returns> public static int yeniSiparisEkle(int tableID, int productID, int catID, int total, string date) { sorgu = "INSERT INTO Orders(tableID,productID,catID,total,date) VALUES ('" + tableID + "','" + productID + "','" + catID + "','" + total + "','" + date + "')"; double price; double.TryParse(Product.urunFiyatGetir(productID).Replace(".", ","), out price); Tables.masaFiyatEkle((price * total).ToString(), tableID); return(db.cmd(sorgu)); }
public static int sipariseEkle(int tableID, int productID, int total, string date) { total += siparisUrunAdetAlMasaBilgisineGore(productID, tableID); sorgu = "UPDATE Orders SET total = '" + total + "' , date = '" + date + "' WHERE productID = '" + productID + "' AND tableID = '" + tableID + "'"; double price; double.TryParse(Product.urunFiyatGetir(productID).Replace(".", ","), out price); Tables.masaFiyatEkle((price * total).ToString(), tableID); return(db.cmd(sorgu)); }
/// <summary> /// tableID ve productID ile adet kadar sipariş siler /// </summary> /// <param name="tableID"></param> /// <param name="productID"></param> /// <returns></returns> public static int siparisSil(int tableID, int productID, int total) { int totalEski = siparisUrunAdetAlMasaBilgisineGore(productID, tableID); sorgu = "SELECT orderID FROM Orders WHERE productID = '" + productID + "' AND tableID = '" + tableID + "'"; int orderID = Int32.Parse(db.GetDataCell(sorgu)); if (totalEski <= total) { double price; double.TryParse(Product.urunFiyatGetir(productID).Replace(".", ","), out price); Tables.masaFiyatCikar((price * total).ToString(), tableID); return(siparisIDileSil(orderID)); } else { double price; double.TryParse(Product.urunFiyatGetir(productID).Replace(".", ","), out price); Tables.masaFiyatCikar((price * total).ToString(), tableID); total = totalEski - total; sorgu = "UPDATE Orders SET total ='" + total + "' WHERE orderID = '" + orderID + "'"; return(db.cmd(sorgu)); } }