private void btnYeniKayit_Click(object sender, EventArgs e) { todoService todoService = new todoService(); int sonuc = todoService.kayitYeni(new Entities.todo() { id = Guid.NewGuid(), baslik = txtBaslik.Text, kisaAciklama = txtKisaAciklama.Text, aciklama = txtAciklama.Text, durum = cmbDurum.SelectedItem.ToString(), onemDerece = int.Parse(txtDerece.Text), olusturmaTarih = DateTime.Now }); if (sonuc > 0) { MessageBox.Show("KAyıt ekleme işlemi başarılı", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult result = MessageBox.Show("Yeni Kayıt ekleme işlemine devam etmek ister misiniz?", "Soru", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { foreach (Control item in Controls) { if (item is TextBox) { ((TextBox)item).Text = string.Empty; } } } else { Form kayitListe = Application.OpenForms["kayitListe"]; if (kayitListe == null) { kayitListe = new kayitListe(); kayitListe.MdiParent = Application.OpenForms["Form1"]; kayitListe.StartPosition = FormStartPosition.CenterScreen; kayitListe.Show(); this.Close(); } else { GroupBox Liste = (GroupBox)kayitListe.Controls["grpBoxListe"]; DataGridView grdLİste = (DataGridView)Liste.Controls["grdListe"]; List <todo> GuncelListe = todoService.kayitListe(); grdLİste.DataSource = null; grdLİste.DataSource = GuncelListe; this.Close(); } } } else { MessageBox.Show("KAyıt ekleme işleminde hata", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddNewToDo_Click(object sender, EventArgs e) { todoService todoService = new todoService(); int result = todoService.addNewEntrt(new entities.todo() { id = Guid.NewGuid(), title = txtTitle.Text, briefStatement = txtBriefStatment.Text, fullStatement = txtStatement.Text, importanceDegree = int.Parse(txtImportanceDegree.Text), situation = cmbStage.SelectedItem.ToString(), creatingDate = DateTime.Now }); if (result > 0) { MessageBox.Show("To Do! is added with succes!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult ask = MessageBox.Show("Do you want to add another To Do!", "Ask", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (ask == DialogResult.Yes) { foreach (Control item in this.Controls) { if (item is TextBox) { ((TextBox)item).Text = string.Empty; } } } else { Form EntryList = Application.OpenForms["EntryList"]; if (EntryList == null) { EntryList = new EntryList(); EntryList.MdiParent = Application.OpenForms["Form1"]; EntryList.StartPosition = FormStartPosition.CenterScreen; EntryList.Show(); this.Close(); } else { //??? } } } else { MessageBox.Show("To do! could not be added!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnKayitListe_Click(object sender, EventArgs e) { todoService todoService = new todoService(); if (todoService.kayitKontrol() > 0) { kayitListe kayitListe = new kayitListe(); kayitListe.MdiParent = this; kayitListe.Show(); } else { MessageBox.Show("Listelenecek Kayıt Bulunamadı", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public kayitListe() { InitializeComponent(); todoService = new todoService(); }
public EntryList() { InitializeComponent(); todoService = new todoService(); }