コード例 #1
0
ファイル: Yonetici.cs プロジェクト: DokuzEylulCsc/proje2-end
        // Otel eklendiginde Json olarak JSONVeri\Oteller klasorune Otel eklenecek
        public void OtelEkle(Otel otel)
        {
            OtelRezervasyon otelRez  = new OtelRezervasyon();
            string          filePath = System.IO.Directory.GetCurrentDirectory();

            filePath = System.IO.Directory.GetCurrentDirectory().Substring(0, filePath.LastIndexOf("bin")) + @"JSONVeri\Oteller\";

            // ...\JSONVeri\TumOtellereAitOdalar\OtelIsim-uniqueID.json
            // Guid.NewGuid().ToString("N") her bir json dosyasina unique isim vermek icin kullanildi.
            File.WriteAllText(filePath + otel.OtelIsmi + "-" + Guid.NewGuid().ToString("N") + ".json", this.Serialize(otel));
        }
コード例 #2
0
ファイル: AnaGiris.cs プロジェクト: DokuzEylulCsc/proje2-end
        private void button_giris_Click(object sender, EventArgs e)
        {
            if (textBox_KullaniciTcNo.Text == string.Empty || textBox_Sifre.Text == string.Empty)
            {
                MessageBox.Show("Kullanıcı Adinizi veya Şifrenizi Yazmadınız.");
                kayit.logOlustur("Giriş yaparken Kullanici adini veya şifresini yazmadı", DateTime.Now.ToString());
            }
            else
            {
                string kullanici_TcNo  = textBox_KullaniciTcNo.Text;
                string kullanici_Sifre = textBox_Sifre.Text;

                string filePath = System.IO.Directory.GetCurrentDirectory();
                filePath = System.IO.Directory.GetCurrentDirectory().Substring(0, filePath.LastIndexOf("bin")) + @"JSONVeri\Uyeler\";

                string[] fileEntries = Directory.GetFiles(filePath);

                bool kullaniciGirisiSaglandi = false;

                // kullanici girisi yapildi.
                foreach (var temp in fileEntries)
                {
                    Uye uye = JsonConvert.DeserializeObject <Uye>(File.ReadAllText(temp));
                    if (kullanici_TcNo == "admin" && kullanici_Sifre == "admin")
                    {
                        MessageBox.Show("Yonetici girişi yaptınız!");
                        formYonetici.Show();
                        kullaniciGirisiSaglandi = true;
                        break;
                    }
                    else if (uye.TcNo == kullanici_TcNo && uye.Sifre == kullanici_Sifre)
                    {
                        MessageBox.Show("Sayın " + uye.Ad + " " + uye.Soyad + " Hoşgeldiniz");
                        kullaniciGirisiSaglandi = true;

                        rez = new OtelRezervasyon(uye);
                        rez.Show();
                        break;
                    }
                }

                if (kullaniciGirisiSaglandi == false)
                {
                    MessageBox.Show("Kullanıcı bilgileriniz yanlış lütfen tekrar deneyiniz.");
                    kayit.logOlustur("Giriş yaparken kullanici adini veya şifresini yanlış girdi", DateTime.Now.ToString());
                }
            }
        }