Beispiel #1
0
        public Siparis SiparisGetir(string kulAd)
        {
            var list = siparisYonetimi.HepsiniGetir();

            foreach (var item in list)
            {
                if (item.Musteri.KullaniciAdi.Equals(kulAd))
                {
                    return(item);
                }
            }
            return(null);
        }
Beispiel #2
0
        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);
                        }
                    }
                }
            }
        }