private void btnKoltukSecimi_Click(object sender, EventArgs e)
        {
            if (Metotlar.BosAlanVarMi2(panelYolcu))
            {
                MessageBox.Show("Tüm bilgileri giriniz!!!");
            }
            else
            {
                _context         = new Context();
                uow              = new UnitOfWork(_context);
                _yolcuRepository = new Repository <Yolcu>(_context);

                Yolcu yolcuEkle = new Yolcu
                {
                    YolcuAdi    = txtAd.Text,
                    YolcuSoyadi = txtSoyad.Text,
                    DogumTarihi = dtDogumTarihi.Value,
                    Cinsiyet    = rdbBay.Checked ? false : true,
                    TcNo        = mskTc.Text,
                    Email       = txtEmail.Text,
                    Telefon     = mskTelefon.Text
                };

                _yolcuRepository.Add(yolcuEkle);
                int islem = uow.SaveChanges();
                a--;
                Metotlar.Temizle(panelYolcu);

                KoltukSecimi kSecim = new KoltukSecimi(this);
                kSecim.Show();
                this.Hide();
            }
        }
Esempio n. 2
0
        private void btnGiris_Click(object sender, EventArgs e)
        {
            _context            = new Context();
            uow                 = new UnitOfWork(_context);
            kullaniciRepository = new Repository <Kullanici>(_context);


            if (Metotlar.BosAlanVarMi(pnlUyeKayit))
            {
                MessageBox.Show("Lütfen kayıt için tüm alanları doldurunuz!");
            }
            else
            {
                Kullanici kullaniciEkle = new Kullanici
                {
                    KullaniciAdi = txtKullaniciAdi.Text,
                    Parola       = txtParola.Text
                };

                if (_context.Kullanicilar.FirstOrDefault(x => x.KullaniciAdi == txtKullaniciAdi.Text) != null)
                {
                    MessageBox.Show("Aynı kullanıcı adıyla kayıt oluşturulamaz");
                }
                else
                {
                    kullaniciRepository.Add(kullaniciEkle);
                    int islem = uow.SaveChanges();
                    MessageBox.Show("Üye kaydınız oluşturulmuştur.");
                }
            }
        }
        private void btnDevam_Click(object sender, EventArgs e)
        {
            if (Metotlar.BosAlanVarMi2(panelYolcu))
            {
                MessageBox.Show("Tüm bilgileri giriniz!!!");
            }
            else
            {
                lblYolcuBilgileri.Text = (a - 1) + " Yolcu Bilgilerini Giriniz";
                a--;
                _context         = new Context();
                uow              = new UnitOfWork(_context);
                _yolcuRepository = new Repository <Yolcu>(_context);

                Yolcu yolcuEkle = new Yolcu
                {
                    YolcuAdi    = txtAd.Text,
                    YolcuSoyadi = txtSoyad.Text,
                    DogumTarihi = dtDogumTarihi.Value,
                    Cinsiyet    = rdbBay.Checked ? false : true,
                    TcNo        = mskTc.Text,
                    Email       = txtEmail.Text,
                    Telefon     = mskTelefon.Text
                };

                _yolcuRepository.Add(yolcuEkle);
                Metotlar.Temizle(panelYolcu);

                if (a > 1)
                {
                    int islem = uow.SaveChanges();
                    MessageBox.Show(" yolcunun bilgileri eklendi");
                    btnKoltukSecimi.Enabled = false;
                }
                else if (a == 1)
                {
                    btnDevam.Visible        = false;
                    btnKoltukSecimi.Enabled = true;
                    int islem = uow.SaveChanges();
                    MessageBox.Show(" yolcunun bilgileri eklendi");
                }
            }
        }