public ActionResult Tamamla(SiparisDetay siparisDetay) { var siparis = GetSiparis(); if (siparis.sepet_s.Count == 0) { ModelState.AddModelError("", "Sepetinizde Ürün Bulunmamaktadır"); } if (ModelState.IsValid) { var login = User.Identity.Name; var bilgiler = bilgiYonetimi.HepsiniGetir(); if (bilgiler != null) { foreach (var item in bilgiler) { if (item.Musteri.KullaniciAdi.Equals(login)) { if (GetSiparis().SiparisGetir(login) != null) { return(View("Hatali")); } else { GetSiparis().SiparisTamamla(); siparis.Temizle(); return(View("Tamamlandi")); } } } } GetSiparis().SiparisTamamla(); MasayaOtur(siparisDetay); siparis.Temizle(); return(View("Tamamlandi")); } else { return(View(siparisDetay)); } }
private void btnMusteriKaldir_Click(object sender, EventArgs e) { for (int i = 0; i < _masaBilgileri.Count; i++) { if (_id == _masaBilgileri[i].Masa.MasaId) { masaBilgiYonetimi.Sil(_masaBilgileri[i]); } } _masaBilgileri = masaBilgiYonetimi.HepsiniGetir(); flwToplamSiparisler.Controls.Clear(); flwMusteriler.Controls.Clear(); }
private void ButonOlustur() { masalar = masaYonetimi.HepsiniGetir(); masaBilgiler = masaBilgiYonetimi.HepsiniGetir(); siparisler = siparisYonetimi.HepsiniGetir(); for (int i = 0; i < masalar.Count; i++) { RoundedButton2 yeniButon = new RoundedButton2(); yeniButon.Width = 85; yeniButon.Height = 85; yeniButon.Margin = new Padding(10, 0, 0, 10); yeniButon.FlatStyle = FlatStyle.Flat; yeniButon.FlatAppearance.BorderSize = 0; yeniButon.Font = new Font("Ebrima", 13, FontStyle.Bold); yeniButon.Text = masalar[i].MasaId; yeniButon.Name = masalar[i].MasaId; yeniButon.ForeColor = Color.White; yeniButon.MouseEnter += (sender, e) => yeniButon.ForeColor = Color.Black; yeniButon.MouseLeave += (sender, e) => yeniButon.ForeColor = Color.White; if (masalar[i].MusaitlikDurumu) { yeniButon.BackColor = Color.FromArgb(135, 160, 116, 63); } else { yeniButon.BackColor = Color.FromArgb(135, 35, 116, 35); } flwMasalar.Controls.Add(yeniButon); yeniButon.Click += YeniButon_Click; } for (int j = 0; j < masaBilgiler.Count; j++) { if (masaBilgiler[j].Musteri != null) { siparisVermis = false; for (int k = 0; k < siparisler.Count; k++) { if (masaBilgiler[j].Musteri.MusteriId == siparisler[k].Musteri.MusteriId) { siparisVermis = true; RoundedButton2 masa = flwMasalar.Controls.Find(masaBilgiler[j].Masa.MasaId, true).FirstOrDefault() as RoundedButton2; masa.BackColor = Color.FromArgb(200, 25, 25); } } if (siparisVermis == false) { var zaman = Convert.ToDateTime(masaBilgiler[j].AcilmaZamani); var simdi = DateTime.Now; TimeSpan ts = simdi.Subtract(zaman); if (ts.TotalMinutes > 1f && ts.TotalMinutes <= 2f) { RoundedButton2 masa = flwMasalar.Controls.Find(masaBilgiler[j].Masa.MasaId, true).FirstOrDefault() as RoundedButton2; masa.BackColor = Color.FromArgb(155, 30, 30, 90); } else if (ts.TotalMinutes > 2f && ts.TotalMinutes <= 3f) { RoundedButton2 masa = flwMasalar.Controls.Find(masaBilgiler[j].Masa.MasaId, true).FirstOrDefault() as RoundedButton2; masa.BackColor = Color.FromArgb(175, 40, 85, 100); } else if (ts.TotalMinutes > 3f && ts.TotalMinutes <= 4f) { RoundedButton2 masa = flwMasalar.Controls.Find(masaBilgiler[j].Masa.MasaId, true).FirstOrDefault() as RoundedButton2; masa.BackColor = Color.FromArgb(195, 50, 75, 140); } else if (ts.TotalMinutes > 3f && ts.TotalMinutes <= 4f) { RoundedButton2 masa = flwMasalar.Controls.Find(masaBilgiler[j].Masa.MasaId, true).FirstOrDefault() as RoundedButton2; masa.BackColor = Color.FromArgb(225, 50, 65, 160); } else if (ts.TotalMinutes > 4f) { RoundedButton2 masa = flwMasalar.Controls.Find(masaBilgiler[j].Masa.MasaId, true).FirstOrDefault() as RoundedButton2; masa.BackColor = Color.FromArgb(255, 50, 55, 235); } } } } }