private async void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //butonların tıklanıp tıklanmadığı kontrol ediliyor
                if (button3.BackColor != Color.Red && button4.BackColor != Color.Red && button5.BackColor != Color.Red && button6.BackColor != Color.Red && button7.BackColor != Color.Red && button8.BackColor != Color.Red && button9.BackColor != Color.Red && button10.BackColor != Color.Red && button11.BackColor != Color.Red && button12.BackColor != Color.Red && button13.BackColor != Color.Red && button14.BackColor != Color.Red && button15.BackColor != Color.Red && button16.BackColor != Color.Red && button17.BackColor != Color.Red && button18.BackColor != Color.Red && button19.BackColor != Color.Red && button20.BackColor != Color.Red)
                {
                    DialogResult hata = new DialogResult();
                    hata = MessageBox.Show("Randevu Saatinizi Seçiniz", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    //hastaneverileri.cs dosyamızı buraya tanımlıyoruz ve içindeki değerlerin neye eşit olacağını belirtiyoruz
                    var veri = new hastaverileri
                    {
                        isim    = Form1.kullanici,
                        sehir   = comboBox1.SelectedItem.ToString(),
                        ilce    = comboBox2.SelectedItem.ToString(),
                        hastane = comboBox3.SelectedItem.ToString(),
                        klinik  = comboBox5.SelectedItem.ToString(),
                        doktor  = comboBox6.SelectedItem.ToString(),
                        tarih   = dateTimePicker1.Text,
                        saat    = saat
                    };
                    //element değerlerini stringe tanımlıyoruz böylece rows.add komudumuz fazla uzun sürmüyor
                    string sehir   = comboBox1.SelectedItem.ToString();
                    string ilce    = comboBox2.SelectedItem.ToString();
                    string hastane = comboBox3.SelectedItem.ToString();
                    string klinik  = comboBox5.SelectedItem.ToString();
                    string doktor  = comboBox6.SelectedItem.ToString();
                    string tarih   = dateTimePicker1.Text;
                    string zaman   = saat;
                    dataGridView1.Rows.Add(Form1.kullanici, sehir, ilce, hastane, klinik, doktor, tarih, zaman);
                    //datagridview'a randevumuz eklendikten sonra giriş esnasında aldığımız tcno üzerinden randevu açıyoruz
                    SetResponse response = await client.SetTaskAsync("Randevular/" + label7.Text, veri);

                    hastaverileri result = response.ResultAs <hastaverileri>();
                    DialogResult  mesaj  = new DialogResult();
                    mesaj          = MessageBox.Show("Randevu Başarıyla Alındı", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    comboBox1.Text = "";
                    comboBox2.Text = "";
                    comboBox3.Text = "";
                    comboBox5.Text = "";
                    comboBox6.Text = "";
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Kutucuklarda boşluk bıraktınız veya verilerde hata var.");
            }
        }
Beispiel #2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox3.Text == "" || comboBox1.Text == "" || comboBox2.Text == "")
            {
                DialogResult hata = new DialogResult();
                hata = MessageBox.Show("Kullanıcı Bilgilerini Eksiksiz Giriniz !", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (textBox4.Text != textBox5.Text)
            {
                DialogResult hata = new DialogResult();
                hata = MessageBox.Show("Girdiğiniz şifreler uyuşmuyor", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                //kullanicilar sınıfını ve içindeki elementleri tanımlıyoruz
                var kullanici = new kullanicilar
                {
                    adi      = textBox1.Text,
                    soyadi   = textBox2.Text,
                    tcno     = textBox3.Text,
                    cinsiyet = comboBox2.SelectedItem.ToString(),
                    sifre    = textBox4.Text,
                    sigorta  = comboBox1.SelectedItem.ToString(),
                    tarih    = dateTimePicker1.Text
                };
                //textbox3'teki text ile sisteme kayıt açıyoruz
                SetResponse response = await client.SetTaskAsync("Kullanicilar/" + textBox3.Text, kullanici);

                hastaverileri result = response.ResultAs <hastaverileri>();
                DialogResult  mesaj  = new DialogResult();
                mesaj = MessageBox.Show("Başarıyla kayıt oldunuz!", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (mesaj == DialogResult.OK)
                {
                    Form1 prsl = new Form1();
                    this.Hide();
                    prsl.Show();
                }
            }
        }