private void button2_Click(object sender, EventArgs e) { TableBusiness tb = new TableBusiness(); TableBusiness.curentTable.Taken = false; tb.UpdateTable(TableBusiness.curentTable); BillBusiness bb = new BillBusiness(); BillBusiness.currentBill.Paid = true; bb.UpdateCaffeBill(BillBusiness.currentBill); this.Hide(); }
protected void Button3_ServerClick(object sender, EventArgs e) { TableBusiness tb = new TableBusiness(); BillBusiness bb = new BillBusiness(); TableBusiness.curentTable.Taken = false; tb.UpdateTable(TableBusiness.curentTable); BillBusiness.currentBill.Paid = true; bb.UpdateCaffeBill(BillBusiness.currentBill); BillBusiness.currentBill = null; Response.Redirect("Home.aspx"); }
private void button1_Click(object sender, EventArgs e) { BillBusiness billb = new BillBusiness(); BillItemBusiness bb = new BillItemBusiness(); ArticleBusiness ab = new ArticleBusiness(); if (comboBox1.Text != "Bezalkoholna pica") { string tempname = comboBox1.Text.Split('-')[0]; CaffeArticle ca = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0]; BillBusiness.currentBill.Total_Price += ca.Price; billb.UpdateCaffeBill(BillBusiness.currentBill); try { CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1); bb.InsertBillItem(cb); } catch { CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; zeka.Quantity++; bb.UpdateBillItem(zeka); } refresh(); } if (comboBox2.Text != "Zestina") { string tempname = comboBox2.Text.Split('-')[0]; CaffeArticle ca = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0]; BillBusiness.currentBill.Total_Price += ca.Price; billb.UpdateCaffeBill(BillBusiness.currentBill); try { CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1); bb.InsertBillItem(cb); } catch { CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; zeka.Quantity++; bb.UpdateBillItem(zeka); } refresh(); } if (comboBox3.Text != "Pivo") { string tempname = comboBox3.Text.Split('-')[0]; CaffeArticle ca = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0]; BillBusiness.currentBill.Total_Price += ca.Price; billb.UpdateCaffeBill(BillBusiness.currentBill); try { CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1); bb.InsertBillItem(cb); } catch { CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; zeka.Quantity++; bb.UpdateBillItem(zeka); } refresh(); } if (comboBox4.Text != "Topli napici") { string tempname = comboBox4.Text.Split('-')[0]; CaffeArticle ca = ab.GetCaffeArticles().Where(x => x.Name == tempname).ToList()[0]; BillBusiness.currentBill.Total_Price += ca.Price; billb.UpdateCaffeBill(BillBusiness.currentBill); try { CaffeBillItem cb = new CaffeBillItem(ca.Article_ID, BillBusiness.currentBill.Bill_ID, 1); bb.InsertBillItem(cb); } catch { CaffeBillItem zeka = bb.GetCaffeBillItems().Where(x => x.Article_ID == ca.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; zeka.Quantity++; bb.UpdateBillItem(zeka); } refresh(); } }
protected void dodaj_ServerClick(object sender, EventArgs e) { ArticleRepository ab = new ArticleRepository(); BillItemRepository billItem = new BillItemRepository(); BillBusiness bp = new BillBusiness(); String s = toplinapici.Value; if (s != null && s != "Topli napici") { CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s)).ToList()[0]; BillBusiness.currentBill.Total_Price += c.Price; HtmlGenericControl par = new HtmlGenericControl("p"); par.InnerText = c.ToString(); // contentmain.Controls.Add(par); BillItemRepository br = new BillItemRepository(); try { billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1)); } catch (Exception xr) { CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; cs.Quantity = cs.Quantity + 1; billItem.UpdateBillItem(cs); } Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD"; bp.UpdateCaffeBill(BillBusiness.currentBill); } String s1 = zestina.Value; if (s1 != null && s1 != "Žestina") { CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s1)).ToList()[0]; BillBusiness.currentBill.Total_Price += c.Price; HtmlGenericControl par = new HtmlGenericControl("p"); par.InnerText = c.ToString(); // contentmain.Controls.Add(par); BillItemRepository br = new BillItemRepository(); try { billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1)); } catch (Exception xr) { CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; cs.Quantity = cs.Quantity + 1; billItem.UpdateBillItem(cs); } Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD"; bp.UpdateCaffeBill(BillBusiness.currentBill); } String s2 = Pivo.Value; if (s2 != null && s2 != "Pivo") { CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s2)).ToList()[0]; BillBusiness.currentBill.Total_Price += c.Price; HtmlGenericControl par = new HtmlGenericControl("p"); par.InnerText = c.ToString(); // contentmain.Controls.Add(par); BillItemRepository br = new BillItemRepository(); try { billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1)); } catch (Exception xr) { CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; cs.Quantity = cs.Quantity + 1; billItem.UpdateBillItem(cs); } Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD"; bp.UpdateCaffeBill(BillBusiness.currentBill); } String s3 = bezalkohola.Value; if (s3 != null && s3 != "Bezalkoholna pića") { CaffeArticle c = ab.GetCaffeArticles().Where(x => x.Name.Equals(s3)).ToList()[0]; BillBusiness.currentBill.Total_Price += c.Price; HtmlGenericControl par = new HtmlGenericControl("p"); par.InnerText = c.ToString(); // contentmain.Controls.Add(par); BillItemRepository br = new BillItemRepository(); try { billItem.InsertCaffeBillItem(new CaffeBillItem(c.Article_ID, BillBusiness.currentBill.Bill_ID, 1)); } catch (Exception xr) { CaffeBillItem cs = cb.Where(x => x.Article_ID == c.Article_ID && x.Bill_ID == BillBusiness.currentBill.Bill_ID).ToList()[0]; cs.Quantity = cs.Quantity + 1; billItem.UpdateBillItem(cs); } Label1.Text = "Total: " + BillBusiness.currentBill.Total_Price + " RSD"; bp.UpdateCaffeBill(BillBusiness.currentBill); } Response.Redirect("Bill.aspx"); }