Exemple #1
0
        public static List <Garson> SayfaNumarasiIleGarsonlariGetir(int sayfaNumarasi, int sayfaBasinaGarsonSayisi)
        {
            using (var connection = CreateConnection())
            {
                SqlCommand cmd = new SqlCommand(@"SELECT GSL.ID, Bahsis, Ad, IseGirisTarihi FROM 
                                                   Garsonlar GSL INNER JOIN Calisanlar CLS ON GSL.ID = CLS.GorevTabloID                      WHERE CLS.GorevID = 2 ORDER BY GSL.ID 
                                                   OFFSET(@sayfaSayisi * @sayfaBasinaGarsonSayisi) 
                                                   ROWS FETCH NEXT 20 ROWS ONLY", connection);

                cmd.Parameters.AddWithValue("@sayfaSayisi", sayfaNumarasi - 1);
                cmd.Parameters.AddWithValue("@sayfaBasinaGarsonSayisi", sayfaBasinaGarsonSayisi);

                SqlDataReader reader = cmd.ExecuteReader();

                List <Garson> garsonlar = new List <Garson>();

                while (reader.Read())
                {
                    Garson garson = new Garson(reader["Ad"].ToString(), (DateTime)reader["IseGirisTarihi"], AktifKafeyiGetir());

                    garson.ID     = (int)reader["ID"];
                    garson.Bahsis = Convert.ToSingle(reader["Bahsis"]);

                    garsonlar.Add(garson);
                }

                return(garsonlar);
            }
        }
Exemple #2
0
        private static void GarsonEkle()
        {
            Console.Clear();

            Console.Write("Isim: ");
            string isim = Console.ReadLine();

            var garson = new Garson(isim, DateTime.Now, DataManager.AktifKafeyiGetir());

            DataManager.GarsonEkle(garson);

            Console.ReadLine();
        }
Exemple #3
0
        private static void CokluGarsonEkle()
        {
            Random rnd = new Random();

            for (int i = 0; i < 210; i++)
            {
                Garson garson = new Garson(FakeData.NameData.GetFirstName(), DateTime.Now, DataManager.AktifKafeyiGetir());

                garson.Bahsis = rnd.Next(0, 100);

                DataManager.GarsonEkle(garson);
            }
        }
Exemple #4
0
        private static void GarsonEkle()
        {
            Console.Clear();

            Console.Write("Adı :");
            string ad = Console.ReadLine();

            Garson garson = new Garson(ad, DateTime.Now, DataManager.AktifKafeyiGetir());

            garson.Durum = CalisanDurum.Uygun;

            int sonuc = DataManager.GarsonEkle(garson);

            Console.WriteLine((sonuc > 0) ? "Garson Başarılı Bir Şekilde Eklendi" : "Garson Ekleme Başarısız!!");
        }
Exemple #5
0
        public static int GarsonEkle(Garson garson)
        {
            using (var connection = CreateConnection())
            {
                var commandGarson = new SqlCommand($@" 
                            INSERT INTO Garson (Bahsis) VALUES (@bahsis); 
                            DECLARE @id int;
                            SET @id= scope_identity();
                            INSERT INTO Calisan (Isim, IseGirisTarihi, MesaideMi, KafeId, Durum, GorevId, GorevTabloId) VALUES (@Isim, @IseGirisTarihi, @MesaideMi, @KafeId, @Durum, @GorevId, @id); SELECT scope_identity()", connection);
                commandGarson.Parameters.AddWithValue("@bahsis", garson.Bahsis);
                commandGarson.Parameters.AddWithValue("@Isim", garson.Isim);
                commandGarson.Parameters.AddWithValue("@IseGirisTarihi", garson.IseGirisTarihi);
                commandGarson.Parameters.AddWithValue("@MesaideMi", garson.MesaideMi);
                commandGarson.Parameters.AddWithValue("@KafeId", garson.Kafe.Id);
                commandGarson.Parameters.AddWithValue("@Durum", garson.Durum);
                commandGarson.Parameters.AddWithValue("@GorevId", 2);

                var result = Convert.ToInt32(commandGarson.ExecuteScalar());

                return(result);
            }
        }
Exemple #6
0
        public static List <Garson> GarsonListele()
        {
            using (var conn = CreateConnection())
            {
                var command = new SqlCommand("SELECT Isim , IseGirisTarihi, Bahsis FROM Calisan INNER JOIN Garson ON Calisan.GorevTabloId = Garson.Id WHERE Calisan.GorevId = 2", conn);

                var list = new List <Garson>();

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var garson = new Garson(reader["Isim"].ToString(), (DateTime)reader["IseGirisTarihi"], AktifKafeyiGetir());
                        garson.Bahsis = Convert.ToInt32(reader["Bahsis"]);

                        list.Add(garson);
                    }

                    return(list);
                }
            }
        }
Exemple #7
0
        public static List <Garson> GarsonlariGetir()
        {
            using (var connection = CreateConnection())
            {
                List <Garson> garsonlar = new List <Garson>();

                SqlCommand cmd = new SqlCommand(@"SELECT GLS.ID, Ad, IseGirisTarihi, Bahsis FROM Calisanlar CLS INNER JOIN Garsonlar GSL ON CLS.GorevID = GSL.ID WHERE CLS.GorevID = 2", connection);

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Garson garson = new Garson(reader["Ad"].ToString(), (DateTime)reader["IseGirisTarihi"], AktifKafeyiGetir());

                    garson.ID     = (int)reader["ID"];
                    garson.Bahsis = Convert.ToSingle(reader["Bahsis"]);

                    garsonlar.Add(garson);
                }

                return(garsonlar);
            }
        }
Exemple #8
0
        public static int GarsonEkle(Garson garson)
        {
            using (var connection = CreateConnection())
            {
                SqlCommand cmd = new SqlCommand(@"
                            INSERT INTO Garsonlar (Bahsis) VALUES(@bahsis);
                            DECLARE @eklenenGarsonID int;
                            SET @eklenenGarsonID = scope_identity();
                            INSERT INTO Calisanlar (Ad, IseGirisTarihi, MesaideMi, KafeID, Durum, GorevID, GorevTabloID) VALUES (@Ad, @IseGirisTarihi, @MesaideMi, @KafeId, @Durum, @GorevId, @eklenenGarsonID); SELECT scope_identity()", connection);

                cmd.Parameters.AddWithValue("@bahsis", garson.Bahsis);
                cmd.Parameters.AddWithValue("@Ad", garson.Ad);
                cmd.Parameters.AddWithValue("@IseGirisTarihi", garson.IseGirisTarihi);
                cmd.Parameters.AddWithValue("@MesaideMi", garson.MesaideMi);
                cmd.Parameters.AddWithValue("@KafeId", garson.Kafe.ID);
                cmd.Parameters.AddWithValue("@Durum", garson.Durum);
                cmd.Parameters.AddWithValue("@GorevId", 2);

                var result = Convert.ToInt32(cmd.ExecuteScalar());

                return(result);
            }
        }
        private void MasaSec(object sender, EventArgs e)
        {
            ControlMasaButton button = (ControlMasaButton)sender;

            btnGarsonSecim.Visible          = true;
            btnMusteri.Visible              = true;
            gridControl1.DataSource         = worker.UrunHareketService.BindingList();
            gridControlOdeme.DataSource     = worker.OdemeHareketService.BindingList();
            navigationKategori.SelectedPage = pageKategoriUrunler;
            if (button.MasaDurum == MasaDurum.Bos)
            {
                secilenAdisyon        = new Adisyon();
                secilenAdisyon.Id     = Guid.NewGuid();
                secilenMasa           = worker.MasaService.Get(c => c.Id == button.MasaId);
                secilenAdisyon.MasaId = button.MasaId;
                btnGarsonSecim.Text   = "Garson Seçilmedi";
                button.AdisyonId      = secilenAdisyon.Id;
                btnMusteri.Load();
                ToplamlarıSifirla();
                btnMusteri.Clear();

                navigationMain.SelectedPage = pageAdisyonAyrinti;
            }
            else if (button.MasaDurum == MasaDurum.Dolu)
            {
                worker.UrunHareketService.Load(c => c.AdisyonId == button.AdisyonId, c => c.Urun, c => c.Porsiyon, c => c.Porsiyon.Birim, c => c.EkMalzemeHareketleri);
                worker.AdisyonService.Load(c => c.Id == button.AdisyonId);
                worker.OdemeHareketService.Load(c => c.AdisyonId == button.AdisyonId, c => c.OdemeTuru);
                worker.EkMalzemeHareketService.Load(null);
                secilenAdisyon = worker.AdisyonService.Get(c => c.Id == button.AdisyonId);
                secilenMasa    = worker.MasaService.Get(c => c.Id == button.MasaId);
                Garson garson = worker.GarsonService.Get(c => c.Id == secilenAdisyon.GarsonId);
                if (garson != null)
                {
                    btnGarsonSecim.Adi      = garson.Adi;
                    btnGarsonSecim.Soyadi   = garson.Soyadi;
                    btnGarsonSecim.GarsonId = garson.Id;
                }
                else
                {
                    btnGarsonSecim.Text = "Garson Seçilmedi";
                }
                if (secilenAdisyon.MusteriId != Guid.Empty)
                {
                    Musteri musteri = worker.MusteriService.Get(c => c.Id == secilenAdisyon.MusteriId);
                    if (musteri != null)
                    {
                        btnMusteri.MusteriId  = musteri.Id;
                        btnMusteri.Adi        = musteri.Adi;
                        btnMusteri.Soyadi     = musteri.Soyadi;
                        btnMusteri.MusteriTip = musteri.MusteriTip;
                        btnMusteri.Load();
                    }
                }

                button.AdisyonId            = secilenAdisyon.Id;
                navigationMain.SelectedPage = pageAdisyonAyrinti;
                layoutView1.RefreshData();
                UrunHareketToplamlariGetir();
            }
        }