示例#1
0
        public static void koltukEkle(Dugum aktif, int konum)
        {
            Koltuk yeniKoltuk = new Koltuk();

            if (aktif.koltuk == null)
            {
                yeniKoltuk.koltukNo = konum;
                yeniKoltuk.sefer    = aktif.seferNo;

                aktif.koltuk = yeniKoltuk;
            }
            else
            {
                yeniKoltuk.koltukNo = konum;
                yeniKoltuk.sefer    = aktif.seferNo;

                Koltuk ilk = aktif.koltuk;

                while (ilk.next != null)
                {
                    ilk = ilk.next;
                }
                ilk.next = yeniKoltuk;
            }
        }
示例#2
0
        private void duzenleBtn_Click(object sender, EventArgs e)
        {
            if (sfrView.CheckedItems.Count == 1)
            {
                string sefernumarasi = sfrView.CheckedItems[0].SubItems[0].Text;


                Dugum seciliSefer = LinkedList.dugumuGetir(sefernumarasi);
                if (otbsTip.SelectedIndex != 0 && guzergah.SelectedIndex != 0 && fytBox.Text != "" && ylcBox.Text != "" && plkBox.Text != "" && sfrBox.Text != "" && kptBox.Text != "")
                {
                    double fiyat = double.Parse(fytBox.Text);
                    int    yolcu = Int32.Parse(ylcBox.Text);
                    if (yolcu > 56)
                    {
                        yolcu = 56;
                    }
                    if (!LinkedList.sfrKontrol(sfrBox.Text) && seciliSefer.seferNo != sfrBox.Text)
                    {
                        MessageBox.Show("Bu sefer numarasına kayıtlı bir sefer bulunmaktadır!\nLütfen farklı bir sefer numarası girin.", "Sefer Numarası", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        sfrBox.Text = "";
                    }
                    else
                    {
                        LinkedList.dugumDuzenle(seciliSefer, sfrBox.Text.ToUpper(), trhBox.Value, plkBox.Text.ToUpper(), kptBox.Text, otbsTip.SelectedItem.ToString(), guzergah.SelectedItem.ToString(), yolcu, fiyat);
                        duzenPanel.Visible = false;
                        ListSefer();
                    }
                }
            }
            else
            {
                MessageBox.Show("Lütfen sadece 1 sefer seçin!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#3
0
        public static bool koltukBosalt(Dugum aktif, int kolno)
        {
            bool   deger     = false;
            Koltuk ilk       = aktif.koltuk;
            Koltuk ilkKoltuk = aktif.koltuk;

            while (ilk != null)
            {
                if (ilk.koltukNo == kolno)
                {
                    break;
                }
                ilk = ilk.next;
            }

            if (ilk != null)
            {
                aktif.koltuk         = ilk;
                aktif.koltuk.mail    = null;
                aktif.koltuk.tcNo    = null;
                aktif.koltuk.adSoyad = null;
                aktif.koltuk.cepTel  = null;
                aktif.koltuk.cins    = null;
                aktif.koltuk.dTarih  = null;

                aktif.koltuk = ilkKoltuk;
                deger        = true;
            }

            return(deger);
        }
示例#4
0
        public static Dugum sonSefer()
        {
            Dugum aktif = head;

            while (aktif.next != null)
            {
                aktif = aktif.next;
            }
            return(aktif);
        }
示例#5
0
        public static void dugumYazdir()
        {
            Dugum aktif = head; //listenin başına sarıyor!

            while (aktif != null)
            {
                MessageBox.Show(aktif.seferNo + "-");
                aktif = aktif.next;
            }
        }
示例#6
0
        public static ArrayList getir()
        {
            ArrayList dugumlist = new ArrayList();
            Dugum     aktif     = head;

            while (aktif != null)
            {
                dugumlist.Add(aktif);
                aktif = aktif.next;
            }
            return(dugumlist);//Liste olarak döndürülüyor.
        }
示例#7
0
        public static void dugumDuzenle(Dugum aktif, string sfrNo, DateTime sfrTrh, string plk, string kpt, string otbs, string guzrgh, int ylcKpt, double bltFyt)
        {
            aktif.guzergah      = guzrgh;
            aktif.seferNo       = sfrNo;
            aktif.seferTarih    = sfrTrh;
            aktif.yolcuKapasite = ylcKpt;
            aktif.biletFiyati   = bltFyt;
            aktif.plaka         = plk;
            aktif.kaptan        = kpt;
            aktif.otobus        = otbs;

            MessageBox.Show("Düzenleme işlemi başarılı.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#8
0
        public static int gecmisSfrSayi()
        {
            int   seferCount = 0;
            Dugum aktif      = eskihead;

            while (aktif != null)
            {
                aktif = aktif.next;
                seferCount++;
            }

            return(seferCount);
        }
示例#9
0
        public static int seferSayisi()
        {
            int   seferCount = 0;
            Dugum aktif      = head;

            while (aktif != null)
            {
                aktif = aktif.next;
                seferCount++;
            }

            return(seferCount);
        }
示例#10
0
        public static void DosyaKayit()
        {
            var    path       = @"c:\Users\DELL\Desktop\ders\yazgel2-otobüs\kayitlar\" + DateTime.Now.Date.ToString("dd/MM/yyyy") + ".txt";
            string strdetails = "{0, -20}{1, -20}{2,-20}{3, -20}{4, -20}{5, -20}{6, -20}{7, -20}";

            List <string> satirlar = new List <string>();

            satirlar.Add(String.Format(strdetails, "Sefer No", "Sefer Tarih", "Guzergah", "Plaka", "OtobusTip", "BiletFiyat", "YolcuKapasite", "Kaptan"));



            Dugum aktif = head;

            //int i = 1;

            while (aktif != null)
            {
                Koltuk ilk = aktif.koltuk;
                satirlar.Add(String.Format(strdetails, aktif.seferNo, aktif.seferTarih, aktif.guzergah, aktif.plaka, aktif.otobus, aktif.biletFiyati, aktif.yolcuKapasite, aktif.kaptan));
                while (ilk != null)
                {
                    if (ilk.tcNo != null)
                    {
                        satirlar.Add(String.Format(strdetails, "Koltuk", ilk.koltukNo, ilk.tcNo, ilk.adSoyad, ilk.cepTel, ilk.cins, ilk.dTarih, ilk.mail));
                    }
                    else
                    {
                        satirlar.Add(String.Format(strdetails, "Koltuk", ilk.koltukNo, "Boş", "", "", "", "", ""));
                    }
                    ilk = ilk.next;
                }

                aktif = aktif.next;
            }
            if (!File.Exists(path))
            {
                using (StreamWriter sw = File.CreateText(path))
                {
                    foreach (string item in satirlar)
                    {
                        sw.WriteLine(item);
                    }
                }
                MessageBox.Show("Kayıt başarılı.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Gün sonu kayıt işlemi yapılmıştır!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#11
0
        public static ArrayList koltukGetir(Dugum aktif)
        {
            Dugum     ilk        = aktif;
            ArrayList koltuklist = new ArrayList();
            Koltuk    ilkKoltuk  = aktif.koltuk;

            while (ilk.koltuk != null)
            {
                koltuklist.Add(ilk.koltuk);
                ilk.koltuk = ilk.koltuk.next;
            }
            aktif.koltuk = ilkKoltuk;
            return(koltuklist);
        }
示例#12
0
        public static Dugum dugumuGetir(string sfrNo)
        {
            Dugum aktif = head;

            while (aktif != null)
            {
                if (aktif.seferNo == sfrNo)
                {
                    break;
                }
                aktif = aktif.next;
            }
            return(aktif);
        }
示例#13
0
        public static bool sfrKontrol(string no)
        {
            bool  deger = true;
            Dugum aktif = head;

            while (aktif != null)
            {
                if (aktif.seferNo == no)
                {
                    deger = false;
                }
                aktif = aktif.next;
            }
            return(deger);
        }
示例#14
0
        public static int koltukSayi(Dugum aktif)
        {
            Koltuk ilk = aktif.koltuk;

            int sayac = 0;

            while (ilk != null)
            {
                if (ilk.tcNo == null)
                {
                    sayac++;
                }
                ilk = ilk.next;
            }
            return(sayac);
        }
示例#15
0
        public static bool tcKontrol(Dugum aktif, string tcno)
        {
            Koltuk ilk       = aktif.koltuk;
            Koltuk ilkKoltuk = aktif.koltuk;
            bool   deger     = true;

            while (ilk != null)
            {
                if (ilk.tcNo == tcno)
                {
                    deger = false;
                }
                ilk = ilk.next;
            }
            aktif.koltuk = ilkKoltuk;
            return(deger);
        }
示例#16
0
        public static void OneEkle(string sfrNo, DateTime sfrTrh, string plk, string kpt, string otbs, string guzrgh, int ylcKpt, double bltFyt)
        {
            Dugum addit = new Dugum();

            addit.biletFiyati   = bltFyt;
            addit.guzergah      = guzrgh;
            addit.kaptan        = kpt;
            addit.otobus        = otbs;
            addit.plaka         = plk;
            addit.seferNo       = sfrNo;
            addit.seferTarih    = sfrTrh;
            addit.yolcuKapasite = ylcKpt;


            addit.next = head;

            head = addit;
        }
示例#17
0
        private void editBtn_Click(object sender, EventArgs e)
        {
            if (sfrView.CheckedItems.Count > 1 || sfrView.CheckedItems.Count == 0)
            {
                MessageBox.Show("Lütfen bir sefer seçiniz!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ListSefer();
            }
            else
            {
                trhBox.MinDate      = DateTime.Now.Date;
                trhBox.Format       = DateTimePickerFormat.Custom;
                trhBox.CustomFormat = "dd/MM/yyyy HH:mm";

                guzergah.DropDownStyle = ComboBoxStyle.DropDownList;
                otbsTip.DropDownStyle  = ComboBoxStyle.DropDownList;
                guzergah.Items.AddRange(new Object[] { "---Seçiniz---", "Kocaeli - Ankara", "Kocaeli - İstanbul", "Kocaeli - İzmir" });
                guzergah.SelectedIndex = 0;
                otbsTip.Items.AddRange(new Object[] { "---Seçiniz---", "Minibüs", "Midibüs", "Otobüs", "Körüklü Otobüs" });
                otbsTip.SelectedIndex = 0;
                sfrBox.TabIndex       = 1;
                guzergah.TabIndex     = 2;
                otbsTip.TabIndex      = 3;
                ylcBox.TabIndex       = 4;
                kptBox.TabIndex       = 5;
                plkBox.TabIndex       = 6;
                fytBox.TabIndex       = 7;
                trhBox.TabIndex       = 8;
                geriBtn.TabIndex      = 9;
                duzenleBtn.TabIndex   = 10;
                ylcBox.MaxLength      = 2;

                string sefernumarasi = sfrView.CheckedItems[0].SubItems[0].Text;
                Dugum  seciliSefer   = LinkedList.dugumuGetir(sefernumarasi);
                sfrBox.Text           = seciliSefer.seferNo;
                ylcBox.Text           = seciliSefer.yolcuKapasite.ToString();
                kptBox.Text           = seciliSefer.kaptan;
                plkBox.Text           = seciliSefer.plaka;
                fytBox.Text           = seciliSefer.biletFiyati.ToString();
                trhBox.Value          = seciliSefer.seferTarih;
                guzergah.SelectedItem = seciliSefer.guzergah;
                otbsTip.SelectedItem  = seciliSefer.otobus;
                duzenPanel.Visible    = true;
            }
        }
示例#18
0
        private void removeBtn_Click(object sender, EventArgs e)
        {
            //var item = sfrView.CheckedItems[0];
            //MessageBox.Show(item.SubItems[0].Text);

            foreach (ListViewItem item in sfrView.CheckedItems)
            {
                Dugum suanki = LinkedList.dugumuGetir(item.SubItems[0].Text);

                if (LinkedList.koltukSayi(suanki) == suanki.yolcuKapasite)
                {
                    sfrView.Items.Remove(item);
                    LinkedList.silme(item.SubItems[0].Text);
                }
                else
                {
                    MessageBox.Show("Silinmek istenen sefer/sefeler de bilet satışı yapılmıştır.\nSefer silinemez!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#19
0
 public void sfrGetir()
 {
     if (LinkedList.seferSayisi() > 0)
     {
         Dugum  son    = LinkedList.sonSefer();
         string sferNo = son.seferNo;
         string newStr = sferNo.Substring(3, 1);
         int    no     = Int32.Parse(newStr);
         no++;
         string yeniSfre = "sfr" + no.ToString();
         sfrBox.Text      = yeniSfre;
         sfrBox.Enabled   = false;
         sfrNoGtr.Visible = false;
     }
     else
     {
         MessageBox.Show("Sefer numarası bulunamadı dosyadan getirmek için butonu kullanın yada el ile yazınız.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         sfrNoGtr.Visible = true;
     }
 }
示例#20
0
        public static void koltukDoldur(Dugum aktif, int kolno, string tcno, string ceptel, string ad, string cinsiyet, string dtarih, string Mail)
        {
            Koltuk ilk       = aktif.koltuk;
            Koltuk ilkKoltuk = aktif.koltuk;

            while (ilk.koltukNo != kolno)
            {
                ilk = ilk.next;
            }
            aktif.koltuk         = ilk;
            aktif.koltuk.mail    = Mail;
            aktif.koltuk.tcNo    = tcno;
            aktif.koltuk.adSoyad = ad;
            aktif.koltuk.cepTel  = ceptel;
            aktif.koltuk.cins    = cinsiyet;
            aktif.koltuk.dTarih  = dtarih;

            aktif.koltuk = ilkKoltuk;

            MessageBox.Show("İşlem onaylanmıştır.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#21
0
        public static double toplamGelir()
        {
            Dugum  aktif = head;
            double sayac = 0;

            while (aktif != null)
            {
                Koltuk ilk = aktif.koltuk;

                while (ilk != null)
                {
                    if (ilk.tcNo != null)
                    {
                        sayac += aktif.biletFiyati;
                    }
                    ilk = ilk.next;
                }

                aktif = aktif.next;
            }

            return(sayac);
        }
示例#22
0
        public static int toplamYolcu()
        {
            Dugum aktif = head;
            int   sayac = 0;

            while (aktif != null)
            {
                Koltuk ilk = aktif.koltuk;

                while (ilk != null)
                {
                    if (ilk.tcNo != null)
                    {
                        sayac++;
                    }
                    ilk = ilk.next;
                }

                aktif = aktif.next;
            }

            return(sayac);
        }
示例#23
0
        private void araBtn_Click(object sender, EventArgs e)
        {
            sefer = LinkedList.dugumuGetir(sfrBox.Text);
            if (sefer == null)
            {
                MessageBox.Show("Sefer numarası bulunamadı!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                blt.Text = sefer.biletFiyati.ToString();

                koltuk = LinkedList.koltukGetir(sefer);

                foreach (Koltuk item in koltuk)
                {
                    if (item.tcNo == tcBox.Text)
                    {
                        kolno   = item.koltukNo;
                        ad.Text = item.adSoyad;
                        break;
                    }
                }
                if (ad.Text == "")
                {
                    MessageBox.Show("Kayıtlı Tc no bulunamadı!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    ad.Visible         = true;
                    blt.Visible        = true;
                    adSoyad.Visible    = true;
                    biletFiyat.Visible = true;
                    iptalEtBtn.Visible = true;
                }
            }
        }
示例#24
0
        //public void arayaEkle(, string sfrNo, string sfrTrh, string plk, string kpt, string otbs, string guzrgh, int ylcKpt, float bltFyt)
        //{
        //    Dugum eklenecek = new Dugum();

        //    eklenecek.biletFiyati = bltFyt;
        //    eklenecek.guzergah = guzrgh;
        //    eklenecek.kaptan = kpt;
        //    eklenecek.otobus = otbs;
        //    eklenecek.plaka = plk;
        //    eklenecek.seferNo = sfrNo;
        //    eklenecek.seferTarih = sfrTrh;
        //    eklenecek.yolcuKapasite = ylcKpt;

        //    Dugum aktif = head;

        //    while (aktif.next != aranan)
        //    {

        //    }

        //}

        public static void silme(string sfrno)
        {
            Dugum deleted = new Dugum();

            deleted.seferNo = sfrno;

            Dugum iter = head;

            Dugum prev = null;

            while (iter.next != null)
            {
                if (iter.seferNo == deleted.seferNo)
                {
                    break;
                }
                prev = iter;
                iter = iter.next;
            }

            if (iter != null)
            {
                if (prev == null)
                {
                    head = head.next;
                }
                else
                {
                    prev.next = iter.next;
                }
            }
            else
            {
                MessageBox.Show("Silinecek veri bulunumadı lütfen tekrar deneyiniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#25
0
        public void oturusGoster(ListViewItem secili)
        {
            //seferGoster sefergosterUC = new seferGoster();
            //Controls.Add(sefergosterUC);
            string sefernumarasi = secili.SubItems[0].Text;

            seciliSefer     = LinkedList.dugumuGetir(sefernumarasi);
            seciliKoltuklar = LinkedList.koltukGetir(seciliSefer);

            // ilkKolonbası = "12;43";
            // ikinciKolonbası = "50;43";
            fiyatlbl.Text = seciliSefer.biletFiyati.ToString();

            int i      = 0;
            int j      = 1;
            int k      = 0;
            int firstx = 12;
            int firsty = 43;

            foreach (Koltuk item in seciliKoltuklar)
            {
                int numara = item.koltukNo;

                Button dynamicButton = new Button();

                dynamicButton.Name      = string.Format("koltukBtn{0}", numara);
                dynamicButton.Text      = " " + numara.ToString();
                dynamicButton.Location  = new Point(firstx, firsty);
                dynamicButton.Size      = new Size(32, 32);
                dynamicButton.FlatStyle = FlatStyle.Flat;
                dynamicButton.FlatAppearance.BorderSize = 0;
                if (item.tcNo != null)
                {
                    if (item.cins == "Kadın")
                    {
                        dynamicButton.Image = Image.FromFile("C:/Users/DELL/Desktop/ders/yazgel2-otobüs/images/icons8-person-female-30.png");
                    }
                    else if (item.cins == "Erkek")
                    {
                        dynamicButton.Image = Image.FromFile("C:/Users/DELL/Desktop/ders/yazgel2-otobüs/images/icons8-administrator-male-30.png");
                    }
                    else
                    {
                        dynamicButton.Image = Image.FromFile("C:/Users/DELL/Desktop/ders/yazgel2-otobüs/images/icons8-red-circle-30.png");
                    }
                    dynamicButton.Text = "";
                }
                else
                {
                    dynamicButton.Image  = Image.FromFile("C:/Users/DELL/Desktop/ders/yazgel2-otobüs/images/icons8-green-circle-30.png");
                    dynamicButton.Click += btn_secilmis;
                }
                dynamicButton.ImageAlign = ContentAlignment.MiddleCenter;

                koltukPanel.Controls.Add(dynamicButton);

                if (j % 2 != 0)
                {
                    firstx += 38;
                    j++;
                }
                else
                {
                    firstx -= 38;
                    firsty += 37;
                    j       = 1;
                    i++;
                }

                if (i == 7)
                {
                    if (k == 1)
                    {
                        firstx += 40;
                        k       = 0;
                    }
                    else
                    {
                        k++;
                    }
                    firstx += 100;
                    firsty  = 43;
                    i       = 0;
                }
            }
        }
示例#26
0
        public static void SonaEkle(string sfrNo, DateTime sfrTrh, string plk, string kpt, string otbs, string guzrgh, int ylcKpt, double bltFyt)
        {
            if (head == null)
            {
                Dugum first = new Dugum();

                first.guzergah      = guzrgh;
                first.biletFiyati   = bltFyt;
                first.guzergah      = guzrgh;
                first.kaptan        = kpt;
                first.otobus        = otbs;
                first.plaka         = plk;
                first.seferNo       = sfrNo;
                first.seferTarih    = sfrTrh;
                first.yolcuKapasite = ylcKpt;

                for (int i = 1; i <= first.yolcuKapasite; i++)
                {
                    koltukEkle(first, i);
                }


                head = first;

                MessageBox.Show("Sefer eklenmiştir!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                Dugum addit = new Dugum();

                addit.biletFiyati   = bltFyt;
                addit.guzergah      = guzrgh;
                addit.kaptan        = kpt;
                addit.otobus        = otbs;
                addit.plaka         = plk;
                addit.seferNo       = sfrNo;
                addit.seferTarih    = sfrTrh;
                addit.yolcuKapasite = ylcKpt;

                for (int i = 1; i <= addit.yolcuKapasite; i++)
                {
                    koltukEkle(addit, i);
                }

                Dugum aktif = head;

                while (aktif.next != null)
                {
                    aktif = aktif.next;
                }

                aktif.next = addit;

                if (aktif.next != addit)
                {
                    MessageBox.Show("Sefer eklenemedi tekrar deneyiniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Sefer eklenmiştir", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }