Пример #1
0
        private void masaTiklama(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            Masa = btn.Name;
            using (var cafeContext = new CafeContext())
            {
                int temp   = int.Parse(Masa);
                var result = from receipts in cafeContext.Receipts
                             join orders in cafeContext.Orders
                             on receipts.ReceiptID equals orders.Receipt.ReceiptID
                             where receipts.TableNumber == temp && orders.isAlive == true
                             select receipts;
                if (result.Count() > 0)
                {
                    TableForm gcs = new TableForm();
                    gcs.ShowDialog();
                }
                else
                {
                    LoadingForm gcs = new LoadingForm();
                    gcs.ShowDialog();
                }
            }
        }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (kuver != "")
     {
         using (var cafeContext = new CafeContext())
         {
             int temp   = int.Parse(MainForm.Masa);
             var result = from receipts in cafeContext.Receipts
                          select receipts;
             cafeContext.Receipts.Add(new Receipt
             {
                 Cover       = int.Parse(kuver),
                 Date        = DateTime.Now.ToString(),
                 TableNumber = temp
             });
             cafeContext.SaveChanges();
         }
         TableForm gcs = new TableForm();
         gcs.ShowDialog();
         this.Close();
     }
 }