Exemplo n.º 1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            using (var db = new TrenBiletiSatisSistemiEntities6())
            {
                if (!db.GiseGorevlileri.Any(gorevli => gorevli.UserId == userTxtBox.Text))
                {
                    if (passTxtBox.Text == textBox2.Text)
                    {
                        var yeniGorevli = new GiseGorevlileri()
                        {
                            UserId       = userTxtBox.Text,
                            Password     = passTxtBox.Text,
                            Görevli_Ismi = textBox1.Text
                        };

                        db.GiseGorevlileri.Add(yeniGorevli);
                        db.SaveChanges();
                        label4.Visible = true;
                    }
                    else
                    {
                        MessageBox.Show("GİRİLEN ŞİFRELER AYNI OLMALIDIR!", "ŞİFRE HATASI", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        passTxtBox.Text = "";
                        textBox2.Text   = "";
                    }
                }
                else
                {
                    label3.Visible  = true;
                    userTxtBox.Text = "";
                    passTxtBox.Text = "";
                }
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var isNumeric = Int32.TryParse(textBox1.Text, out var n);

            if (isNumeric)
            {
                int biletNum = Convert.ToInt32(textBox1.Text);
                using (var db = new TrenBiletiSatisSistemiEntities6())
                {
                    var ticketToRemove = db.Biletler.SingleOrDefault(x => x.BiletNumarasi == biletNum);
                    if (ticketToRemove != null)
                    {
                        db.Biletler.Remove(ticketToRemove);
                        db.SaveChanges();
                        MessageBox.Show(ticketToRemove.BiletNumarasi + " NUMARALI, " + ticketToRemove.Musteri_Adı + " ADINA KESİLMİŞ BİLET İPTAL EDİLMİŞTİR!", "BİLET İPTAL EDİLDİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("BU BİLET NUMARASINA SAHİP BİR BİLET BULUNMAMAKTADIR!", "BİLET NUMARASI HATASI", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        textBox1.Text = "";
                    }
                }
            }
            else
            {
                MessageBox.Show("LÜTFEN BİLET NUMARASINI SAYISAL BİR DEĞER GİRİNİZ!", "BİLET NUMARASI HATASI", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBox1.Text = "";
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            using (var db = new TrenBiletiSatisSistemiEntities6())
            {
                if (!db.Seferler.Any(sefer => sefer.Nerden == textBox1.Text && sefer.Nereye == textBox2.Text && sefer.Saati == textBox3.Text))
                {
                    var yeniSefer = new Seferler()
                    {
                        Nerden          = textBox1.Text,
                        Nereye          = textBox2.Text,
                        Saati           = textBox3.Text,
                        Yetişkin_Fiyatı = textBox4.Text.ToString(),
                        Cocuk_Fiyatı    = textBox5.Text.ToString()
                    };

                    db.Seferler.Add(yeniSefer);
                    db.SaveChanges();
                    MessageBox.Show(textBox1.Text + " - " + textBox2.Text + " SEFERİ VERİ TABANINA EKLENMİŞTİR!", "SEFER EKLENDİ", MessageBoxButtons.OK, MessageBoxIcon.Information);


                    if (!db.Seferler.Any(sefer => sefer.Nerden == textBox2.Text && sefer.Nereye == textBox1.Text && sefer.Saati == textBox3.Text) && radioButton2.Checked && textBox1.Text != null && textBox2.Text != null && textBox3.Text != null)
                    {
                        var yeni2Sefer = new Seferler()
                        {
                            Nerden          = textBox2.Text,
                            Nereye          = textBox1.Text,
                            Saati           = textBox3.Text,
                            Yetişkin_Fiyatı = textBox4.Text.ToString(),
                            Cocuk_Fiyatı    = textBox5.Text.ToString()
                        };

                        db.Seferler.Add(yeni2Sefer);
                        db.SaveChanges();
                    }
                    else if (radioButton2.Checked == true)
                    {
                        MessageBox.Show(textBox2.Text + " - " + textBox1.Text + " SEFERİ ZATEN VARDIR, " + textBox1.Text + " - " + textBox2.Text + " SEFERİ EKLENMİŞTİR!",
                                        "SEFER BULUNDU", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("BÖYLE BİR SEFER BULUNMAKTADIR!", "SEFER BULUNDU", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                    textBox4.Text = "";
                    textBox5.Text = "";
                }
            }
        }
Exemplo n.º 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     using (var db = new TrenBiletiSatisSistemiEntities6())
     {
         GiseGorevlileri giseGorevlisi = db.GiseGorevlileri.SingleOrDefault(gorevli => gorevli.UserId.ToString() == textBox1.Text.ToString());
         if (giseGorevlisi != null && giseGorevlisi.UserId == textBox1.Text.ToString() && giseGorevlisi.Password == textBox2.Text)
         {
             this.Visible = false;
             GorevliIslemleri gorevliPenceresi = new GorevliIslemleri();
             kullanıcıAdı = giseGorevlisi.UserId;
             gorevliPenceresi.Show();
         }
         else
         {
             textBox2.Text       = "";
             gorevliHata.Visible = true;
         }
     }
 }
Exemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     label2.Visible = false;
     using (var db = new TrenBiletiSatisSistemiEntities6())
     {
         var itemToRemove = db.GiseGorevlileri.SingleOrDefault(x => x.UserId == textBox1.Text);
         if (itemToRemove != null)
         {
             db.GiseGorevlileri.Remove(itemToRemove);
             db.SaveChanges();
             label2.Visible = true;
         }
         else
         {
             MessageBox.Show("BU KULLANICI ADINA SAHİP GİŞE GÖREVLİSİ BULUNMAMAKTADIR!", "KULLANICI ADI HATASI", MessageBoxButtons.OK, MessageBoxIcon.Error);
             textBox1.Text = "";
         }
     }
 }
 private void button2_Click(object sender, EventArgs e)
 {
     using (var db = new TrenBiletiSatisSistemiEntities6())
     {
         var itemToRemove = db.Seferler.SingleOrDefault(x => x.Nerden == textBox6.Text && x.Nereye == textBox7.Text && x.Saati == textBox8.Text);
         if (itemToRemove != null)
         {
             db.Seferler.Remove(itemToRemove);
             db.SaveChanges();
             MessageBox.Show(textBox6.Text + " - " + textBox7.Text + " SEFERİ VERİ TABANINDAN SİLİNMİŞTİR!", "SEFER SİLİNDİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("BÖYLE BİR SEFER BULUNMAMAKTADIR!", "SEFER BULUNAMADI", MessageBoxButtons.OK, MessageBoxIcon.Error);
             textBox6.Text = "";
             textBox7.Text = "";
             textBox8.Text = "";
         }
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            using (var db = new TrenBiletiSatisSistemiEntities6())
            {
                GiseGorevlileri guncellenecekGorevli = db.GiseGorevlileri.SingleOrDefault(gorevli => gorevli.UserId.ToString() == textBox1.Text.ToString());

                if (db.GiseGorevlileri.Any(giseci => giseci.UserId == textBox1.Text.ToString()))
                {
                    if (guncellenecekGorevli != null && guncellenecekGorevli.Password == textBox2.Text)
                    {
                        if (textBox3.Text == textBox4.Text)
                        {
                            guncellenecekGorevli.Password = textBox3.Text;
                            db.SaveChanges();
                            label6.Visible      = true;
                            pictureBox1.Visible = true;
                        }
                        else
                        {
                            textBox3.Text = "";
                            textBox4.Text = "";
                            MessageBox.Show("Girilen şifreler aynı değil!", "ŞİFRE HATASI", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        textBox2.Text = "";
                        textBox3.Text = "";
                        textBox4.Text = "";
                        MessageBox.Show("Şifre hatalı girildi!", "ŞİFRE HATASI", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(textBox1.Text + " kullanıcı adına sahip bir gişe görevlisi bulunmamaktadır!", "GİŞE GÖREVLİSİ BULUNMUYOR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            String direction = null, dönüşTarihi = null, dönSaati = null;
            int    totalAmount = 0, biletSayısı = 0, ticketNum = 0;;

            if (radioButton1.Checked == true)
            {
                dönüşTarihi = "-";
                dönSaati    = "-";
                direction   = "Tek Yön";
                biletSayısı = (int)numericUpDown1.Value + (int)numericUpDown2.Value;
                totalAmount = tamTutar * (int)numericUpDown1.Value + cocukTutar * (int)numericUpDown2.Value;
            }
            else
            {
                dönüşTarihi = dateTimePicker2.Text;
                dönSaati    = comboBox4.Text;
                direction   = "Gidiş - Dönüş";
                biletSayısı = 2 * ((int)numericUpDown1.Value + (int)numericUpDown2.Value);
                totalAmount = 2 * (tamTutar * (int)numericUpDown1.Value + cocukTutar * (int)numericUpDown2.Value);
            }

            using (var db = new TrenBiletiSatisSistemiEntities6())
            {
                ticketNum = db.Biletler.Count(c => c.BiletNumarasi != 0) + 1;

                if (dateTimePicker1.Text.CompareTo(dateTimePicker2.Text) != 1 || radioButton1.Checked == true)
                {
                    if (db.Biletler.Any(bilet => bilet.BiletNumarasi == ticketNum))
                    {
                        while (db.Biletler.Any(bilet => bilet.BiletNumarasi == ticketNum))
                        {
                            ticketNum++;
                        }
                    }
                    var yeniBilet = new Biletler()
                    {
                        Musteri_Adı   = textBox1.Text,
                        BiletNumarasi = ticketNum,
                        GidisTarihi   = dateTimePicker1.Text,
                        KalkisNoktasi = comboBox1.SelectedItem.ToString(),
                        VarisNoktasi  = comboBox2.SelectedItem.ToString(),
                        DonusTarihi   = dönüşTarihi,
                        YonBilgisi    = direction,
                        İslemYapanId  = GirişEkranı.kullanıcıAdı,
                        KisiSayisi    = (int)numericUpDown1.Value,
                        CocukSayisi   = (int)numericUpDown2.Value,
                        Bilet_Sayısı  = biletSayısı,
                        Tutar         = totalAmount,
                        Saati         = comboBox3.SelectedItem.ToString(),
                        DönüşSaati    = dönSaati
                    };

                    db.Biletler.Add(yeniBilet);
                    db.SaveChanges();
                    MessageBox.Show(ticketNum + " NUMARALI BİLET BAŞARIYLA OLUŞTURULDU!", "BİLET HAZIR", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox1.Text        = "";
                    dateTimePicker1.Text = "";
                    dateTimePicker2.Text = "";
                    comboBox1.Text       = "";
                    comboBox2.Text       = "";
                    comboBox3.Text       = "";
                    comboBox4.Text       = "";
                    numericUpDown1.Value = 0;
                    numericUpDown2.Value = 0;
                }
                else
                {
                    MessageBox.Show("LÜTFEN DÖNÜŞ TARİHİNİZİ GİDİŞ TARİHİNDEN SONRAKİ BİR GÜN SEÇİNİZ!", "DÖNÜŞ TARİHİ HATASI", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }