Example #1
0
        private void btnOnay_Click(object sender, EventArgs e)
        {
            string rsaat = null;

            foreach (Control saat in panel1.Controls)
            {
                if (saat is RadioButton)
                {
                    RadioButton radio = saat as RadioButton;
                    if (radio.Checked)
                    {
                        rsaat = radio.Text;
                    }
                }
            }
            if (txtTc.MaskCompleted && rsaat != null)
            {
                DialogResult onay = MetroFramework.MetroMessageBox.Show(this, "Randevuyu onaylamak istediğinize emin misiniz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (onay == DialogResult.Yes)
                {
                    string   adsoyad = txtAdSoyad.Text;
                    char[]   x       = { ' ' };
                    string[] ayir    = adsoyad.Split(x, StringSplitOptions.RemoveEmptyEntries);


                    tc          = txtTc.Text;
                    hasta_ad    = ayir[0];
                    hasta_soyad = ayir[1];
                    pol         = cBoxPoliklinik.Text;
                    doktor      = cBoxDoktor.Text;
                    tarih       = dtRandevu.Value.ToShortDateString();
                    rnsaat      = rsaat.ToString();

                    SqlCommand cmd = new SqlCommand("insert into randevu (doktor,hasta,tarih,saat,gorevli,durum) values (@doktor,@hasta,@tarih,@saat,@gorevli,5); select SCOPE_IDENTITY();", bgl.baglanti());
                    cmd.Parameters.AddWithValue("@doktor", cBoxDoktor.SelectedValue);
                    cmd.Parameters.AddWithValue("@hasta", id.ToString());
                    cmd.Parameters.AddWithValue("@tarih", dtRandevu.Value.Date.ToString("yyyy-M-dd"));
                    cmd.Parameters.AddWithValue("@saat", rsaat.ToString());
                    cmd.Parameters.AddWithValue("@gorevli", g_id.ToString());
                    randevu_id = cmd.ExecuteScalar().ToString();
                    MetroFramework.MetroMessageBox.Show(this, "Randevunuz onaylanmıştır!", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RandevuOnay rndv = new RandevuOnay(randevu_id, tc, hasta_ad, hasta_soyad, pol, doktor, tarih, rnsaat);
                    rndv.ShowDialog();
                    iptal();
                }
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, "Gerekli alanları doldurunuz!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string randevu, ad, soyad, tc, pol, dr, tarih, saat;

            string[] adsoyad = dataGridView1.CurrentRow.Cells[1].Value.ToString().Split(' ');

            randevu = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            ad      = adsoyad[0].ToString();
            soyad   = adsoyad[1].ToString();
            tc      = dataGridView1.CurrentRow.Cells[2].Value.ToString();
            pol     = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            dr      = dataGridView1.CurrentRow.Cells[4].Value.ToString();
            tarih   = dataGridView1.CurrentRow.Cells[5].Value.ToString();
            saat    = dataGridView1.CurrentRow.Cells[6].Value.ToString();

            RandevuOnay rndv = new RandevuOnay(randevu, tc, ad, soyad, pol, dr, tarih, saat);

            rndv.ShowDialog();
        }