private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "") //textboxlar boş işe
         {
             throw new Exception("Boslukları Doldurun");                                               // hata yakala
         }
         foreach (Musteri musteri in Sistem.kullaniciList.Values)                                      //kullanici listesindeki müsterilere bakma
         {
             if (Sistem.ID == musteri.KullaniciId)                                                     //sistemdeki müsteri ile aynıysa
             {
                 musteri.KullaniciAdi = textBox1.Text;                                                 //ad güncelleme
                 musteri.Sifre        = textBox2.Text;                                                 //sifre güncelleme
                 musteri.Telefon      = Convert.ToInt64(textBox3.Text);                                //telefon güncelleme
                 musteri.Email        = textBox4.Text;                                                 //email güncelleme
             }
         }
     }
     catch (Exception ex)//hata mesajı yakalayıp yazdırma
     {
         MessageBox.Show(ex.Message);
     }
     Yazdirma.Guncelleme();
 }
Exemple #2
0
        private void From1_Load(object sender, EventArgs e)
        {
            Yonetim yonetici = new Yonetim(1, "Damla", "1234", 05384942554, "*****@*****.**"); //yoneticinin sistem içindeki bilgileri

            Sistem.yoneticiList.Add(yonetici.KullaniciId, yonetici);                                   //yöneticiyi ekler

            Sistem sistem = new Sistem();

            //string[] sehiradlari = new string[5] { "İstanbul", "İzmir", "Bursa", "Antalya", "Ankara" };
            //for(int i = 0; i < 5; i++)
            //{
            //    Sehir sehir = new Sehir(i, sehiradlari[i]);
            //    sistem.SehirEkle(sehir);
            //}
            Yazdirma.Okuyucu();   //forma girdiğinde musteri okuma
            Yazdirma.OtelOkuma(); //otel okuma
            //sistem.SehirEkle(0, "Istanbul");
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            int control = 1;

            //while(control==0)
            // {

            try
            {
                if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "")                                           //textboxlar boş işe
                {
                    musteri = new Musteri(Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, Convert.ToInt64(textBox4.Text), textBox5.Text); //kullanici oluştur
                    foreach (Musteri m in Sistem.kullaniciList.Values)                                                                                  //kullanici listesindeki musterilere bak
                    {
                        if (m.KullaniciAdi == musteri.KullaniciAdi)                                                                                     // varsa hata
                        {
                            throw new Exception("Kullanici adi kullanilmakta.");
                        }
                    }
                }
                else    // eksik veya hatalıysa
                {
                    throw new Exception("Kullanici bilgilerini düzgün girin");
                }
            }
            catch (FormatException)    //formatları yanlış girdiyse
            {
                control = 0;
                MessageBox.Show("Girişte Format Hatası");
            }
            catch (Exception ex)    ///hata mesajlarını gösterme
            {
                control = 0;
                MessageBox.Show(ex.Message);
            }
            // }
            if (control == 1)
            {
                Sistem.kullaniciList.Add(musteri.KullaniciId, musteri);//sisteme kullanici ekleme
                Yazdirma.Yazma(musteri);
            }
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            //foreach(Otel otel in Sistem.sehirList[])

            Yazdirma.Yazma();
        }