Beispiel #1
0
 public void Ekle(Otel kok, Otel yeni)
 {
     if (yeni.Adi == null)
     {
         return;
     }
     if (Sırala(kok.Adi) < Sırala(yeni.Adi))
     {
         if (kok.Sag == null)
         {
             kok.Sag = yeni;
             return;
         }
         Ekle(kok.Sag, yeni);
     }
     else
     {
         if (kok.Sol == null)
         {
             kok.Sol = yeni;
             return;
         }
         Ekle(kok.Sol, yeni);
     }
 }
Beispiel #2
0
 public void OtelGetir(Otel dugum)
 {
     if (dugum == null)
     {
         return;
     }
     OtelGetir(dugum.Sol);
     OtelZiyaret(dugum);
     OtelGetir(dugum.Sag);
 }
Beispiel #3
0
        private void OtelZiyaret(Otel dugum)
        {
            PropertyInfo[] proplar = typeof(Otel).GetProperties();
            DataRow        row     = Oteltable.NewRow();

            foreach (PropertyInfo p in proplar)
            {
                row[p.Name] = p.GetValue(dugum);
            }
            Oteltable.Rows.Add(row);
        }
        public void OtelAktar(DataTable dt, Otel kok)
        {
            OtellerAgac ana = new OtellerAgac();

            PersonelAktar();
            YorumAktar();
            int sutun = dt.Rows.Count;

            for (int i = 0; i < sutun; i++)
            {
                Personeller personeller = new Personeller();
                Yorumlar    yorumlar    = new Yorumlar();
                Otel        dal         = new Otel();
                if (i == 0)
                {
                    Araclar.PropertyDoldur <Otel>(kok, dt, i);
                    for (int k = 0; k < Pdizi.Length; k++)
                    {
                        if (kok.id == Pdizi[k].Otelid)
                        {
                            kok.personeller = personeller.InsertFirst(Pdizi[k]);
                        }
                    }
                    for (int h = 0; h < ydizi.Length; h++)
                    {
                        if (kok.id == ydizi[h].Otelid)
                        {
                            kok.Yorumlar = yorumlar.InsertFirst(ydizi[h]);
                        }
                    }
                }
                else
                {
                    Araclar.PropertyDoldur <Otel>(dal, dt, i);
                    for (int k = 0; k < Pdizi.Length; k++)
                    {
                        if (dal.id == Pdizi[k].Otelid)
                        {
                            dal.personeller = personeller.InsertFirst(Pdizi[k]);
                        }
                    }
                    for (int h = 0; h < ydizi.Length; h++)
                    {
                        if (dal.id == ydizi[h].Otelid)
                        {
                            dal.Yorumlar = yorumlar.InsertFirst(ydizi[h]);
                        }
                    }
                    ana.Ekle(kok, dal);
                }
            }
            ana.OtelGetir(kok);
        }
Beispiel #5
0
 public void YorumGetir(Otel dugum, int id)
 {
     if (dugum == null)
     {
         return;
     }
     if (dugum.id == id)
     {
         YorumZiyaret(dugum.Yorumlar);
         return;
     }
     YorumGetir(dugum.Sol, id);
     YorumGetir(dugum.Sag, id);
 }
Beispiel #6
0
 public void PersonelGetir(Otel dugum, int id)
 {
     if (dugum == null)
     {
         return;
     }
     if (dugum.id == id)
     {
         PersonelZiyaret(dugum.personeller);
         return;
     }
     PersonelGetir(dugum.Sol, id);
     PersonelGetir(dugum.Sag, id);
 }
        private void button1_Click(object sender, EventArgs e)
        {
            var     otel = new Otel();
            OtelORM orm  = new OtelORM();

            Aktar(otel);
            if (orm.Ekle(otel))
            {
                MessageBox.Show("Ekleme Başarılı");
            }
            else
            {
                MessageBox.Show("HATA");
            }
        }
Beispiel #8
0
        void OtelGetir()
        {
            asd = new HashMapChain();
            DataTable table = OtellerAgac.Oteltable;

            Otel[] oteller = new Otel[table.Rows.Count];

            for (int i = 0; i < table.Rows.Count; i++)
            {
                Otel otel = new Otel();
                Araclar.PropertyDoldur <Otel>(otel, table, i);
                oteller[i] = otel;
                asd.OtelEkle(oteller[i].Il, oteller[i].Ilce, oteller[i]);
            }
        }
Beispiel #9
0
        private void puanVerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PuanForm frm = new PuanForm();
            OtelORM  orm = new OtelORM();

            frm.ShowDialog();
            Otel otel = new Otel();

            Araclar.PropertyDoldur <Otel>(otel, dataGridView1);
            otel.OtelPuani = Convert.ToInt32(frm.button1.Tag);
            if (orm.Guncelle(otel, Convert.ToInt32(dataGridView1.CurrentRow.Cells["id"].Value.ToString())))
            {
                dataGridView1.DataSource = orm.Listele();
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Otel    otel = new Otel();
            OtelORM orm  = new OtelORM();

            Aktar(otel);
            otel.id = Convert.ToInt32(button1.Tag);
            if (orm.Guncelle(otel, Convert.ToInt32(button1.Tag)))
            {
                MessageBox.Show("Guncelleme Başarılı");
            }
            else
            {
                MessageBox.Show("HATA");
            }
        }
Beispiel #11
0
        private void MusteriAnaForm_Load(object sender, EventArgs e)
        {
            otel = new Otel();
            OtelORM orm = new OtelORM();

            PropertyInfo[] proplar = typeof(Otel).GetProperties();
            foreach (PropertyInfo item in proplar)
            {
                OtellerAgac.Oteltable.Columns.Add(item.Name);
            }
            Aktar aktar = new Aktar();

            aktar.OtelAktar(orm.Listele(), otel);
            dataGridView1.DataSource = OtellerAgac.Oteltable;
            OtelGetir();
        }
Beispiel #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            otel = new Otel();
            OtelORM orm = new OtelORM();

            PropertyInfo[] proplar = typeof(Otel).GetProperties();
            OtellerAgac.Oteltable.Columns.Clear();
            OtellerAgac.Oteltable.Rows.Clear();
            foreach (PropertyInfo item in proplar)
            {
                OtellerAgac.Oteltable.Columns.Add(item.Name);
            }
            Aktar aktar = new Aktar();

            aktar.OtelAktar(orm.Listele(), otel);
            dataGridView1.DataSource = OtellerAgac.Oteltable;
            OtelGetir();
            radiopuan.Checked   = false;
            radioyildiz.Checked = false;
        }
        void Aktar(Otel otel)
        {
            int sayac = 0;

            PropertyInfo[] pr = typeof(Otel).GetProperties();
            foreach (Control item in this.Controls)
            {
                if (item is TextBox || item is MaskedTextBox)
                {
                    pr[++sayac].SetValue(otel, item.Text);
                }
                else if (item is ComboBox)
                {
                    pr[++sayac].SetValue(otel, ((ComboBox)item).SelectedValue);
                }
                else if (item is NumericUpDown)
                {
                    pr[++sayac].SetValue(otel, (Convert.ToInt32(item.Text)));
                }
            }
        }
 public Otel()
 {
     Sag = null;
     Sol = null;
 }
Beispiel #15
0
 public Otel()
 {
     Aktif = true;
     Sag   = null;
     Sol   = null;
 }