Пример #1
0
        private static Kisi DosyayıOku()
        {
            Kisi         kisi       = new Kisi();
            EgitimDurumu e          = new EgitimDurumu();
            EgitimDurumu e2         = new EgitimDurumu();
            IsDeneyimi   i          = new IsDeneyimi();
            IsDeneyimi   i2         = new IsDeneyimi();
            string       dosya_yolu = @"C:\Users\Hüseyin\Desktop\142802029-142802011\eleman.txt";
            FileStream   fs         = new FileStream(dosya_yolu, FileMode.OpenOrCreate, FileAccess.ReadWrite);
            StreamReader sr         = new StreamReader(fs);

            kisi.Ad                  = sr.ReadLine();
            kisi.Adres               = sr.ReadLine();
            kisi.DogumTarihi         = Convert.ToDateTime(sr.ReadLine());
            kisi.DogumYeri           = sr.ReadLine();
            kisi.Eposta              = sr.ReadLine();
            kisi.IlgiAlanlari        = sr.ReadLine();
            kisi.MedeniDurum         = sr.ReadLine();
            kisi.ReferansOlanKisiler = sr.ReadLine();
            kisi.Telefon             = Convert.ToInt64(sr.ReadLine());
            kisi.Uygunluk            = Convert.ToDouble(sr.ReadLine());
            kisi.Uyrugu              = sr.ReadLine();
            kisi.YabanciDil          = sr.ReadLine();

            e.BaslangicTarihi = Convert.ToDateTime(sr.ReadLine());
            e.BitisTarihi     = Convert.ToDateTime(sr.ReadLine());
            e.Bolumu          = Convert.ToString(sr.ReadLine());
            e.NotOrtalamasi   = Convert.ToDouble(sr.ReadLine());
            e.OkulAdi         = Convert.ToString(sr.ReadLine());

            e2.BaslangicTarihi = Convert.ToDateTime(sr.ReadLine());
            e2.BitisTarihi     = Convert.ToDateTime(sr.ReadLine());
            e2.Bolumu          = Convert.ToString(sr.ReadLine());
            e2.NotOrtalamasi   = Convert.ToDouble(sr.ReadLine());
            e2.OkulAdi         = Convert.ToString(sr.ReadLine());

            e.InsertLast(e);
            e.InsertLast(e2);
            kisi.Egitim_Durumu = e;

            i.Ad       = Convert.ToString(sr.ReadLine());
            i.Adres    = Convert.ToString(sr.ReadLine());
            i.Pozisyon = Convert.ToString(sr.ReadLine());

            i2.Ad       = Convert.ToString(sr.ReadLine());
            i2.Adres    = Convert.ToString(sr.ReadLine());
            i2.Pozisyon = Convert.ToString(sr.ReadLine());

            i.InsertLast(i);
            i.InsertLast(i2);
            kisi.Is_Deneyimi = i;

            sr.Close();
            fs.Close();
            File.Delete(@"C:\Users\Hüseyin\Desktop\142802029-142802011\eleman.txt");
            return(kisi);
        }
Пример #2
0
        public bool Basvuranlar(Kisi k)
        {
            bool deger = false;

            if (currentSize == 0)
            {
                deger = false;
            }
            else
            {
                for (int i = 0; i < currentSize; i++)
                {
                    if ((heapArray[i].Deger.KisiBilgisi.Ad == k.Ad) &&
                        (heapArray[i].Deger.KisiBilgisi.Adres == k.Adres) &&
                        (heapArray[i].Deger.KisiBilgisi.DogumTarihi == k.DogumTarihi) &&
                        (heapArray[i].Deger.KisiBilgisi.DogumYeri == k.DogumYeri) &&
                        (heapArray[i].Deger.KisiBilgisi.Eposta == k.Eposta) &&
                        (heapArray[i].Deger.KisiBilgisi.IlgiAlanlari == k.IlgiAlanlari) &&
                        (heapArray[i].Deger.KisiBilgisi.MedeniDurum == k.MedeniDurum) &&
                        (heapArray[i].Deger.KisiBilgisi.ReferansOlanKisiler == k.ReferansOlanKisiler) &&
                        (heapArray[i].Deger.KisiBilgisi.Telefon == k.Telefon) &&
                        (heapArray[i].Deger.KisiBilgisi.Uyrugu == k.Uyrugu) &&
                        (heapArray[i].Deger.KisiBilgisi.YabanciDil == k.YabanciDil) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Data).BaslangicTarihi == ((EgitimDurumu)k.Egitim_Durumu.Head.Data).BaslangicTarihi) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Data).BitisTarihi == ((EgitimDurumu)k.Egitim_Durumu.Head.Data).BitisTarihi) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Data).Bolumu == ((EgitimDurumu)k.Egitim_Durumu.Head.Data).Bolumu) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Data).NotOrtalamasi == ((EgitimDurumu)k.Egitim_Durumu.Head.Data).NotOrtalamasi) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Data).OkulAdi == ((EgitimDurumu)k.Egitim_Durumu.Head.Data).OkulAdi)

                        && (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Next.Data).BaslangicTarihi == ((EgitimDurumu)k.Egitim_Durumu.Head.Next.Data).BaslangicTarihi) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Next.Data).BitisTarihi == ((EgitimDurumu)k.Egitim_Durumu.Head.Next.Data).BitisTarihi) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Next.Data).Bolumu == ((EgitimDurumu)k.Egitim_Durumu.Head.Next.Data).Bolumu) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Next.Data).NotOrtalamasi == ((EgitimDurumu)k.Egitim_Durumu.Head.Next.Data).NotOrtalamasi) &&
                        (((EgitimDurumu)heapArray[i].Deger.KisiBilgisi.Egitim_Durumu.Head.Next.Data).OkulAdi == ((EgitimDurumu)k.Egitim_Durumu.Head.Next.Data).OkulAdi)

                        && (((IsDeneyimi)heapArray[i].Deger.KisiBilgisi.Is_Deneyimi.Head.Data).Ad == ((IsDeneyimi)k.Is_Deneyimi.Head.Data).Ad) &&
                        (((IsDeneyimi)heapArray[i].Deger.KisiBilgisi.Is_Deneyimi.Head.Data).Adres == ((IsDeneyimi)k.Is_Deneyimi.Head.Data).Adres) &&
                        (((IsDeneyimi)heapArray[i].Deger.KisiBilgisi.Is_Deneyimi.Head.Data).Pozisyon == ((IsDeneyimi)k.Is_Deneyimi.Head.Data).Pozisyon)

                        && (((IsDeneyimi)heapArray[i].Deger.KisiBilgisi.Is_Deneyimi.Head.Next.Data).Ad == ((IsDeneyimi)k.Is_Deneyimi.Head.Next.Data).Ad) &&
                        (((IsDeneyimi)heapArray[i].Deger.KisiBilgisi.Is_Deneyimi.Head.Next.Data).Adres == ((IsDeneyimi)k.Is_Deneyimi.Head.Next.Data).Adres) &&
                        (((IsDeneyimi)heapArray[i].Deger.KisiBilgisi.Is_Deneyimi.Head.Next.Data).Pozisyon == ((IsDeneyimi)k.Is_Deneyimi.Head.Next.Data).Pozisyon))
                    {
                        deger = true;
                        break;
                    }
                    else
                    {
                        deger = false;
                    }
                }
            }

            return(deger);
        }
Пример #3
0
 private TreeNode AraInt(TreeNode dugum, Kisi anahtar)
 {
     if (dugum == null)
     {
         return(null);
     }
     else if (string.Compare(dugum.veri.Ad, anahtar.Ad) == 0)
     {
         return(dugum);
     }
     else if (string.Compare(dugum.veri.Ad, anahtar.Ad) == 1)
     {
         return(AraInt(dugum.sol, anahtar));
     }
     else
     {
         return(AraInt(dugum.sag, anahtar));
     }
 }
Пример #4
0
        private static void DosyayaYaz(Kisi n)
        {
            string       dosya_yolu = @"C:\Users\Hüseyin\Desktop\142802029-142802011\eleman.txt";
            FileStream   fs         = new FileStream(dosya_yolu, FileMode.Append, FileAccess.Write);
            StreamWriter sw         = new StreamWriter(fs);

            sw.WriteLine(n.Ad);
            sw.WriteLine(n.Adres);
            sw.WriteLine(n.DogumTarihi);
            sw.WriteLine(n.DogumYeri);
            sw.WriteLine(n.Eposta);
            sw.WriteLine(n.IlgiAlanlari);
            sw.WriteLine(n.MedeniDurum);
            sw.WriteLine(n.ReferansOlanKisiler);
            sw.WriteLine(n.Telefon);
            sw.WriteLine(n.Uygunluk);
            sw.WriteLine(n.Uyrugu);
            sw.WriteLine(n.YabanciDil);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Data).BaslangicTarihi);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Data).BitisTarihi);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Data).Bolumu);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Data).NotOrtalamasi);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Data).OkulAdi);

            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Next.Data).BaslangicTarihi);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Next.Data).BitisTarihi);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Next.Data).Bolumu);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Next.Data).NotOrtalamasi);
            sw.WriteLine(((EgitimDurumu)n.Egitim_Durumu.Head.Next.Data).OkulAdi);

            sw.WriteLine(((IsDeneyimi)n.Is_Deneyimi.Head.Data).Ad);
            sw.WriteLine(((IsDeneyimi)n.Is_Deneyimi.Head.Data).Adres);
            sw.WriteLine(((IsDeneyimi)n.Is_Deneyimi.Head.Data).Pozisyon);

            sw.WriteLine(((IsDeneyimi)n.Is_Deneyimi.Head.Next.Data).Ad);
            sw.WriteLine(((IsDeneyimi)n.Is_Deneyimi.Head.Next.Data).Adres);
            sw.WriteLine(((IsDeneyimi)n.Is_Deneyimi.Head.Next.Data).Pozisyon);

            sw.Flush();
            sw.Close();
            fs.Close();
        }
Пример #5
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            Heap         h  = new Heap(10);
            EgitimDurumu ed = new EgitimDurumu();

            ed.OkulAdi         = txtLiseAdi.Text;
            ed.Bolumu          = txtBolum.Text;
            ed.BaslangicTarihi = Convert.ToDateTime(dateTimeBaslangic.Text);
            ed.BitisTarihi     = Convert.ToDateTime(dateTimeBitis.Text);
            ed.NotOrtalamasi   = Convert.ToDouble(txtNotOrt.Text);
            ed.InsertLast(ed);

            EgitimDurumu ed2 = new EgitimDurumu();

            ed2.OkulAdi         = txtUniAdi.Text;
            ed2.Bolumu          = txtBolum2.Text;
            ed2.BaslangicTarihi = Convert.ToDateTime(dateTimeBaslangic2.Text);
            ed2.BitisTarihi     = Convert.ToDateTime(dateTimeBitis2.Text);
            ed2.NotOrtalamasi   = Convert.ToDouble(txtNotOrt2.Text);
            ed.InsertLast(ed2);


            IsDeneyimi id = new IsDeneyimi();

            id.Ad       = txtIsAdi.Text;
            id.Adres    = txtIsAdresi.Text;
            id.Pozisyon = txtPozisyon.Text;
            id.InsertLast(id);

            IsDeneyimi id2 = new IsDeneyimi();

            id2.Ad       = txtIsAdi2.Text;
            id2.Adres    = txtIsAdresi2.Text;
            id2.Pozisyon = txtPozisyon2.Text;
            id.InsertLast(id2);


            k                     = new Kisi();
            a                     = new Object();
            k.Ad                  = txtAd.Text;
            k.Adres               = txtAdres.Text;
            k.DogumTarihi         = Convert.ToDateTime(dateTimePicker1.Text);
            k.DogumYeri           = txtDogumYeri.Text;
            k.Eposta              = txtEposta.Text;
            k.IlgiAlanlari        = txtIlgiAlanlari.Text;
            k.MedeniDurum         = txtMedeniDurum.Text;
            k.ReferansOlanKisiler = txtReferans.Text;
            k.Telefon             = Convert.ToInt64(txtTelefon.Text);
            k.Uyrugu              = txtUyrugu.Text;
            k.YabanciDil          = txtYabanciDil.Text;
            k.Egitim_Durumu       = ed;
            k.Is_Deneyimi         = id;
            DosyayaYaz(k);
            a.KisiBilgisi = DosyayıOku();
            bool isApply = false;

            a.IlanBilgisi = frmIlanVer.c.IlanBilgisi;

            if (frmIlanVer.dizi[0] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap1.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count1++;
                    frmIlanVer.heap1.Insert(a);
                    h = frmIlanVer.heap1;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[1] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap2.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count2++;
                    frmIlanVer.heap2.Insert(a);
                    h = frmIlanVer.heap2;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[2] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap3.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count3++;
                    frmIlanVer.heap3.Insert(a);
                    h = frmIlanVer.heap3;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[3] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap4.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count4++;
                    frmIlanVer.heap4.Insert(a);
                    h = frmIlanVer.heap4;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[4] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap5.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count5++;
                    frmIlanVer.heap5.Insert(a);
                    h = frmIlanVer.heap5;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[5] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap6.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count6++;
                    frmIlanVer.heap6.Insert(a);
                    h = frmIlanVer.heap6;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[6] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap7.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count7++;
                    frmIlanVer.heap7.Insert(a);
                    h = frmIlanVer.heap7;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[7] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap8.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count8++;
                    frmIlanVer.heap8.Insert(a);
                    h = frmIlanVer.heap8;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[8] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap9.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count9++;
                    frmIlanVer.heap9.Insert(a);
                    h = frmIlanVer.heap9;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }
            if (frmIlanVer.dizi[9] == frmIlanVer.c.IlanBilgisi)
            {
                isApply = frmIlanVer.heap10.Basvuranlar(k);
                if (isApply == false)
                {
                    frmDetaylar.count10++;
                    frmIlanVer.heap10.Insert(a);
                    h = frmIlanVer.heap10;
                    ka.Ekle(a.KisiBilgisi);
                    MessageBox.Show("Kaydedildi!");
                }
                else
                {
                    MessageBox.Show("Daha önce böyle bir başvuru alınmıştır. Tekrar aynı ilana başvuru yapamazsınız.");
                }
            }

            frmAnasayfa.hash.AddBilgi(frmIlanVer.c.IlanBilgisi.IlanNo, h);
            txtAd.ReadOnly         = txtAdres.ReadOnly = txtBolum.ReadOnly = txtBolum2.ReadOnly = txtDogumYeri.ReadOnly =
                txtEposta.ReadOnly = txtIlgiAlanlari.ReadOnly = txtIsAdi.ReadOnly = txtIsAdi2.ReadOnly = txtIsAdresi.ReadOnly
                                                                                                             = txtIsAdresi2.ReadOnly = txtLiseAdi.ReadOnly = txtMedeniDurum.ReadOnly = txtNotOrt.ReadOnly = txtNotOrt2.ReadOnly
                                                                                                                                                                                                                = txtPozisyon.ReadOnly = txtPozisyon2.ReadOnly = txtReferans.ReadOnly = txtTelefon.ReadOnly = txtUniAdi.ReadOnly
                                                                                                                                                                                                                                                                                                                  = txtUyrugu.ReadOnly = txtYabanciDil.ReadOnly = true;
            dateTimeBaslangic.Enabled = dateTimeBaslangic2.Enabled = dateTimeBitis.Enabled = dateTimeBitis2.Enabled
                                                                                                 = dateTimePicker1.Enabled = false;
        }
Пример #6
0
 private void btnIseAl_Click(object sender, EventArgs e)
 {
     if (frmIlanVer.dizi[0] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap1.Root();
         MessageBox.Show(frmIlanVer.heap1.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count1--;
     }
     if (frmIlanVer.dizi[1] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap2.Root();
         MessageBox.Show(frmIlanVer.heap2.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count2--;
     }
     if (frmIlanVer.dizi[2] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap3.Root();
         MessageBox.Show(frmIlanVer.heap3.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count3--;
     }
     if (frmIlanVer.dizi[3] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap4.Root();
         MessageBox.Show(frmIlanVer.heap4.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count4--;
     }
     if (frmIlanVer.dizi[4] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap5.Root();
         MessageBox.Show(frmIlanVer.heap5.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count5--;
     }
     if (frmIlanVer.dizi[5] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap6.Root();
         MessageBox.Show(frmIlanVer.heap6.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count6--;
     }
     if (frmIlanVer.dizi[6] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap7.Root();
         MessageBox.Show(frmIlanVer.heap7.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count7--;
     }
     if (frmIlanVer.dizi[7] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap8.Root();
         MessageBox.Show(frmIlanVer.heap8.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count8--;
     }
     if (frmIlanVer.dizi[8] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap9.Root();
         MessageBox.Show(frmIlanVer.heap9.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count9--;
     }
     if (frmIlanVer.dizi[9] == frmIlanVer.c.IlanBilgisi)
     {
         k = frmIlanVer.heap10.Root();
         MessageBox.Show(frmIlanVer.heap10.GetMax());
         frmBasvuruYap.ka.Sil(k);
         count10--;
     }
 }
 public TreeNode(Kisi k)
 {
     this.veri = k;
     sol       = null;
     sag       = null;
 }
Пример #8
0
        public bool Sil(Kisi deger)
        {
            TreeNode current = kok;
            TreeNode parent  = kok;
            bool     issol   = true;

            //DÜĞÜMÜ BUL
            while (current.veri.Ad != deger.Ad)
            {
                parent = current;
                if (string.Compare(deger.Ad, current.veri.Ad) == -1)
                {
                    issol   = true;
                    current = current.sol;
                }
                else if (string.Compare(deger.Ad, current.veri.Ad) == 1)
                {
                    issol   = false;
                    current = current.sag;
                }
                else
                {
                    current.veri = deger;
                }
                if (current == null)
                {
                    return(false);
                }
            }
            //DURUM 1: YAPRAK DÜĞÜM
            if (current.sol == null && current.sag == null)
            {
                if (current == kok)
                {
                    kok = null;
                }
                else if (issol)
                {
                    parent.sol = null;
                }
                else
                {
                    parent.sag = null;
                }
            }
            //DURUM 2: TEK ÇOCUKLU DÜĞÜM
            else if (current.sag == null)
            {
                if (current == kok)
                {
                    kok = current.sol;
                }
                else if (issol)
                {
                    parent.sol = current.sol;
                }
                else
                {
                    parent.sag = current.sol;
                }
            }
            else if (current.sol == null)
            {
                if (current == kok)
                {
                    kok = current.sag;
                }
                else if (issol)
                {
                    parent.sol = current.sag;
                }
                else
                {
                    parent.sag = current.sag;
                }
            }
            //DURUM 3: İKİ ÇOCUKLU DÜĞÜM
            else
            {
                TreeNode successor = Successor(current);
                if (current == kok)
                {
                    kok = successor;
                }
                else if (issol)
                {
                    parent.sol = successor;
                }
                else
                {
                    parent.sag = successor;
                }
                successor.sol = current.sol;
            }
            return(true);
        }
Пример #9
0
 public TreeNode Ara(Kisi anahtar)
 {
     return(AraInt(kok, anahtar));
 }
Пример #10
0
        public void Ekle(Kisi deger)
        {
            //Yeni eklenecek düğümün parent'ı
            TreeNode tempParent = new TreeNode();
            //Kökten başla ve ilerle
            TreeNode tempSearch = kok;

            if (deger.Ad == "")
            {
                MessageBox.Show("Isim girilmemiştir..");
                return;
            }
            char[] chrDeger = new char[deger.Ad.Length];
            chrDeger = deger.Ad.ToCharArray();
            while (tempSearch != null)
            {
                tempParent = tempSearch;
                char[] chrTempSearch = new char[tempSearch.veri.Ad.Length];
                chrTempSearch = tempSearch.veri.Ad.ToCharArray();
                if (deger.Ad != tempSearch.veri.Ad)
                {
                    int lenght = 0;
                    if (deger.Ad.Length > tempSearch.veri.Ad.Length)
                    {
                        lenght = deger.Ad.Length;
                    }
                    else
                    {
                        lenght = tempSearch.veri.Ad.Length;
                    }

                    for (int i = 0; i < lenght; i++)
                    {
                        if ((int)chrDeger[i] == (int)chrTempSearch[i])
                        {
                            continue;
                        }
                        else if ((int)chrDeger[i] < (int)chrTempSearch[i])
                        {
                            tempSearch = tempSearch.sol;
                            break;
                        }
                        else
                        {
                            tempSearch = tempSearch.sag;
                            break;
                        }
                    }
                }
                else
                {
                    if (deger.Telefon == tempSearch.veri.Telefon)
                    {
                        return;
                    }
                    else if (deger.Telefon < tempSearch.veri.Telefon)
                    {
                        tempSearch = tempSearch.sol;
                    }
                    else
                    {
                        tempSearch = tempSearch.sag;
                    }
                }
            }
            TreeNode eklenecek = new TreeNode(deger);

            if (tempParent.veri != null)
            {
                char[] chrTempParent = new char[tempParent.veri.Ad.Length];
                chrTempParent = tempParent.veri.Ad.ToCharArray();
                //Ağaç boş, köke ekle
                if (deger.Ad != tempParent.veri.Ad)
                {
                    int boyut = 0;
                    if (deger.Ad.Length > tempParent.veri.Ad.Length)
                    {
                        boyut = deger.Ad.Length;
                    }
                    else
                    {
                        boyut = tempParent.veri.Ad.Length;
                    }

                    for (int i = 0; i < boyut; i++)
                    {
                        if (kok == null)
                        {
                            kok = eklenecek;
                            break;
                        }
                        else if ((int)chrDeger[i] == (int)chrTempParent[i])
                        {
                            continue;
                        }
                        else if ((int)chrDeger[i] < (int)chrTempParent[i])
                        {
                            tempParent.sol = eklenecek;
                            break;
                        }
                        else
                        {
                            tempParent.sag = eklenecek;
                            break;
                        }
                    }
                }
                else
                {
                    if (deger.Telefon == tempParent.veri.Telefon)
                    {
                        return;
                    }
                    else if (deger.Telefon < tempParent.veri.Telefon)
                    {
                        tempParent.sol = eklenecek;
                    }
                    else
                    {
                        tempParent.sag = eklenecek;
                    }
                }
            }
            else
            {
                kok = eklenecek;
            }
        }