private void button1_Click(object sender, EventArgs e)
        {
            var soru = MessageBox.Show("BİLETİ İPTAL ETMEK İSTEDİĞİNİZE EMİN MİSİNİZ", "UYARI", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (soru == DialogResult.Yes)
            {
                if (frmBilet.idBilet.id != 0)
                {
                    int sil = frmBilet.idBilet.id;

                    ent.tbBiletler.Remove(ent.tbBiletler.Find(sil));
                    ent.SaveChanges();

                    frmBilet frm = new frmBilet();
                    frmBilet f1  = (frmBilet)Application.OpenForms["frmBilet"];
                    f1.koltuk();
                    Close();
                }
                else
                {
                    MessageBox.Show("BİLİNMEYEN BİR HATA OLUŞTU");
                }
            }
            else
            {
                return;
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmBilet frm = new frmBilet();

            frm.label1.Text = label1.Text;
            frm.Show();
            Hide();
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            tbBiletler dene = ent.tbBiletler.Where(x => x.sefer_id.ToString() == label5.Text && x.koltuk_no.ToString() == label6.Text).FirstOrDefault();

            if (dene == null)
            {
                if (textBox1.Text != null && textBox4.Text != null && maskedTextBox1 != null && maskedTextBox2.Text != null)
                {
                    bool cinsiyet = false;
                    if (comboBox1.Text == "ERKEK")
                    {
                        cinsiyet = true;
                    }
                    else if (comboBox1.Text == "KADIN")
                    {
                        cinsiyet = false;
                    }
                    else
                    {
                        MessageBox.Show("CİNSİYETİ ERKEK VAYA KADIN OLARAK SEÇİNİZ");
                    }
                    tbBiletler bilet = new tbBiletler();
                    bilet.sefer_id  = Convert.ToInt32(label5.Text);
                    bilet.koltuk_no = Convert.ToInt32(label6.Text);
                    bilet.ucret     = Convert.ToInt32(label9.Text);
                    bilet.ad        = textBox1.Text;
                    bilet.soyad     = textBox4.Text;
                    bilet.tc        = maskedTextBox1.Text;
                    bilet.cinsiyet  = cinsiyet;
                    bilet.telefon   = maskedTextBox2.Text;
                    Form1 frm = new Form1();
                    bilet.kullanici_adi = Form1.adi.ad;
                    ent.tbBiletler.Add(bilet);
                    int kayıt = ent.SaveChanges();
                    if (kayıt > 0)
                    {
                        MessageBox.Show("BİLET SATIŞ İŞLEMİ TAMAMLANDI!");
                        frmBilet f1 = (frmBilet)Application.OpenForms["frmBilet"];
                        f1.koltuk();
                        Hide();
                    }
                    else
                    {
                        MessageBox.Show("BİLİNMEYEN BİR HATAYLA KARŞILAŞILDI!");
                    }
                }
            }
            else
            {
                MessageBox.Show("AYNI KOLTUĞU İKİ KİŞİYE SATAMAZSINIZ");
            }
        }
Example #4
0
        private void button50_Click(object sender, EventArgs e)
        {
            panel3.Controls.Clear();
            int xz = panel1.Controls.Count;

            for (int j = 0; j < xz; j++)
            {
                panel1.Controls[j].BackColor = Color.Lime;
            }
            i = 0;

            frmBilet  frm   = new frmBilet();
            tbSubeler sube  = ent.tbSubeler.Where(z => z.sube_ad == comboBox1.Text).FirstOrDefault();
            tbSubeler sube2 = ent.tbSubeler.Where(z => z.sube_ad == comboBox2.Text).FirstOrDefault();

            var sefer = ent.tbSeferler.Where(x => x.sefer_baslangic_sube == sube.sube_id && x.sefer_bitis_sube == sube2.sube_id && x.sefer_tarih == dateTimePicker1.Value).ToList();

            if (sefer != null)
            {
                foreach (var item in sefer)
                {
                    i++;
                    btn      = new Button();
                    btn.Name = item.sefer_id.ToString();
                    Point btnyer = new Point(50, 100);
                    btn.Dock      = System.Windows.Forms.DockStyle.Top;
                    btn.BackColor = Color.Red;
                    btn.Font      = new Font(btn.Font.FontFamily, 20);
                    btn.ForeColor = Color.White;
                    btn.FlatStyle = FlatStyle.Flat;
                    btn.Height    = 50;
                    btn.Text      = "" + item.sefer_id + " " + sube.sube_ad + " - " + sube2.sube_ad + "  " + item.sefer_tarih.ToString().Remove(10) + "  " + item.sefer_saat + "  " + item.fiyat + "TL";
                    btn.Location  = btnyer;
                    panel3.Controls.Add(btn);
                    id         = ActiveControl.Name;
                    btn.Click += Btn_Click1;
                }
                if (i == 0)
                {
                    MessageBox.Show("ARADIĞINIZ KRİTERLERE UYGUN SEFER BULUNAMADI", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private void btn_giris_Click_1(object sender, EventArgs e)
        {
            if (textBox2.Text != "")
            {
                label2.ForeColor = Color.Lime;
            }
            else
            {
                return;
            }
            tbKullanicilar k = ent.tbKullanicilar.Where(x => x.kullanici_adi == textBox1.Text && x.kullanici_sifresi == textBox2.Text).SingleOrDefault();

            if (k == null)
            {
                label2.ForeColor = Color.Red;
                label1.ForeColor = Color.Red;
                MessageBox.Show("KULLANICI BULUNAMADI\n LÜTFEN KULLANICI ADINIZI ŞİFRENİZİ DOĞRU YAZINIZ", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (k != null)
            {
                frmBilet frm  = new frmBilet();
                Form2    frm2 = new Form2();

                adi.ad = k.kullanici_adi;
                if (k.kullanici_admin == true)
                {
                    frm2.label1.Text = "HOŞ  GELDİNİZ  SAYIN " + k.kullanici_ad_soyad.ToUpper() + "  " + DateTime.Now;

                    frm2.Show();
                    this.Hide();
                }
                else if (k.kullanici_admin == false)
                {
                    frm.button51.Visible = false;
                    frm.label1.Text      = "HOŞ  GELDİNİZ  " + k.kullanici_ad_soyad.ToUpper() + "  " + DateTime.Now;
                    frm.Show();
                    this.Hide();
                }
            }
        }