Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            dosyalar = new List <string>();
            DirectoryInfo d = new DirectoryInfo(Application.StartupPath + "/mp3");

            foreach (FileInfo item in d.GetFiles())
            {
                if (item.Extension == ".mp3")
                {
                    dosyalar.Add(item.Name);
                    txtduyurudosya.AutoCompleteCustomSource.Add(item.Name);
                }
            }
            DuyuruInfoBLL db2 = new DuyuruInfoBLL();

            foreach (var item in db2.GetAll())
            {
                string[]     dizi = new string[] { item.DuyuruID.ToString(), item.DuyuruAdi, item.DuyuruAdresi };
                ListViewItem li   = new ListViewItem(dizi);
                listView1.Items.Add(li);
            }

            timer1.Start();  // Başlatma
            timer1.Interval = 1000;
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            string        id = listView1.SelectedItems[0].SubItems[0].Text;
            DuyuruInfoBLL db = new DuyuruInfoBLL();

            if (MessageBox.Show("Silinsin mi??", "Silme Onayı", MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
            {
                return;
            }
            db.Sil(Convert.ToInt32(id));
            DuyuruInfoBLL db2 = new DuyuruInfoBLL();

            foreach (var item in db2.GetAll())
            {
                string[]     dizi = new string[] { item.DuyuruID.ToString(), item.DuyuruAdi, item.DuyuruAdresi };
                ListViewItem li   = new ListViewItem(dizi);
                listView1.Items.Add(li);
            }
        }
Exemple #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (button1.Text == "Kaydet")
     {
         if (txtduyuruadi.Text != "" || txtduyurudosya.Text != "")
         {
             FileInfo f     = new FileInfo(Application.StartupPath + "/mp3/" + txtduyurudosya.Text);
             int      durum = dosyalar.IndexOf(txtduyurudosya.Text);
             if (durum < 0)
             {
                 MessageBox.Show("dosya tanınmadı"); return;
             }
             if (!f.Exists)
             {
                 MessageBox.Show("Dosya Bulanamdı");
             }
             else
             {
                 DuyuruInfoBLL db = new DuyuruInfoBLL();
                 var           a  = db.GetAll().Where(p => p.DuyuruAdresi == (txtduyurudosya.Text + ".mp3")).ToList();
                 if (a.Count == 0)
                 {
                     DuyuruInfo d = new DuyuruInfo();
                     d.DuyuruAdi    = txtduyuruadi.Text;
                     d.DuyuruAdresi = txtduyurudosya.Text;
                     db.Ekle(d);
                     DuyuruInfoBLL db2 = new DuyuruInfoBLL();
                     foreach (var item in db2.GetAll())
                     {
                         string[]     dizi = new string[] { item.DuyuruID.ToString(), item.DuyuruAdi, item.DuyuruAdresi };
                         ListViewItem li   = new ListViewItem(dizi);
                         listView1.Items.Add(li);
                     }
                     txtduyuruadi.Text   = "";
                     txtduyurudosya.Text = "";
                     MessageBox.Show("Eklendi :)");
                 }
                 else
                 {
                     MessageBox.Show("Dosya Ekli !!!!");
                 }
             }
         }
         else
         {
             MessageBox.Show("Lütfen Boş Bırakmayın");
         }
     }
     else
     {
         if (lblid.Text != "")
         {
             DuyuruInfoBLL db = new DuyuruInfoBLL();
             DuyuruInfo    d  = db.GetAll().Where(p => p.DuyuruID == Convert.ToInt32(lblid.Text)).FirstOrDefault();
             d.DuyuruAdi    = txtduyuruadi.Text;
             d.DuyuruAdresi = txtduyurudosya.Text;
             db.Guncelle(d);
             DuyuruInfoBLL db2 = new DuyuruInfoBLL();
             foreach (var item in db2.GetAll())
             {
                 string[]     dizi = new string[] { item.DuyuruID.ToString(), item.DuyuruAdi, item.DuyuruAdresi };
                 ListViewItem li   = new ListViewItem(dizi);
                 listView1.Items.Add(li);
             }
         }
     }
 }