public void duzenle(object sender, EventArgs e) { this.Close(); string hedef_id = (sender as Button).Name; Duzenle duzenle_form = new Duzenle(); duzenle_form.plan_duzenle(hedef_id); duzenle_form.Show(); }
public void veri_sil(object sender, EventArgs e) { string time = label_time.Text; DialogResult secenek = MessageBox.Show("Planı Silmek İstiyor musunuz?", "Bilgilendirme Penceresi", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); string[] hedef = (sender as Button).Name.Split(); string sorgu_id = "select hedef_id from hedefler where hedef='" + hedef[0] + "'"; SqlCommand id_al = new SqlCommand(sorgu_id, baglanti); baglanti.Open(); int hedef_id = Convert.ToInt32(id_al.ExecuteScalar()); baglanti.Close(); string sorgu1 = "select baslangic_tarihi from hedefler where hedef_id='" + hedef_id.ToString() + "'"; SqlCommand bas_tarih_al = new SqlCommand(sorgu1, baglanti3); baglanti3.Open(); string[] bas_tarih = bas_tarih_al.ExecuteScalar().ToString().Split('.'); baglanti3.Close(); string sorgu2 = "select bitis_tarihi from hedefler where hedef_id='" + hedef_id.ToString() + "'"; SqlCommand bit_tarih_al = new SqlCommand(sorgu2, baglanti3); baglanti3.Open(); string[] bit_tarih = bit_tarih_al.ExecuteScalar().ToString().Split('.'); baglanti3.Close(); if (secenek == DialogResult.Yes) { string sorgu = "delete from hedefler where hedef='" + hedef[0] + "'"; SqlCommand hedef_sorgu = new SqlCommand(sorgu, baglanti2); baglanti2.Open(); hedef_sorgu.ExecuteNonQuery(); baglanti2.Close(); Duzenle duzen_form = new Duzenle(); duzen_form.duzen_gun_degerlendirme(bas_tarih, bit_tarih); string[] day = label_time.Text.Split(); string month = ""; switch (day[1]) { case "Ocak": month = "01"; break; case "Şubat": month = "02"; break; case "Mart": month = "03"; break; case "Nisan": month = "04"; break; case "Mayıs": month = "05"; break; case "Haziran": month = "06"; break; case "Temmuz": month = "07"; break; case "Ağustos": month = "08"; break; case "Eylül": month = "09"; break; case "Ekim": month = "10"; break; case "Kasım": month = "11"; break; case "Aralık": month = "12"; break; } string tarih = day[0] + "." + month + "." + day[2]; this.Controls.Clear(); this.Controls.Add(label_deger); this.Controls.Add(progressBar1); this.Controls.Add(label_time); label_time.Text = time; label_time.Show(); plan_liste(tarih); MessageBox.Show("Plan silinmiştir"); } }