private void btnSınavKaydet_Click(object sender, EventArgs e) { try { Notlar nt = new Notlar(); nt.Vize = Convert.ToInt32(txt1Vize.Text); nt.Sozlu = Convert.ToInt32(txtSozlu.Text); nt.Final = Convert.ToInt32(txtFinal.Text); nt.Ortalama = Convert.ToInt32(txtOrtalama.Text); nt.OgrenciId = Convert.ToInt32(txtGelenOgrId.Text); nt.DerslerId = Convert.ToInt32(txtGelenDersId.Text); bool sonuc7 = NotlarBL.NotlarıEkle(nt); if (sonuc7) { MessageBox.Show("Not Kaydedildi"); NotlarListele(); Utility.CleanTextBoxes(grpNotEkleme.Controls); } else { MessageBox.Show("Not Kaydedilmedi!!"); } } catch (Exception) { throw; } #region MyRegion //Notlar nt = new Notlar(); //foreach (DataRow item in dt1.Rows) //{ // switch (item.RowState) // { // case DataRowState.Added: // nt.Vize = Convert.ToInt32(item["Vize"]); // nt.Sozlu = Convert.ToInt32(item["Sozlu"]); // nt.Final = Convert.ToInt32(item["Final"]); // nt.Ortalama = Convert.ToInt32(item["Ortalama"]); // nt.OgrenciId = Convert.ToInt32(txtGelenOgrId.Text); // nt.DerslerId = Convert.ToInt32(txtGelenDersId.Text); // NotlarBL.NotlarıEkle(nt); // break; // case DataRowState.Deleted: // nt.NotlarId = Convert.ToInt32(item["NotlarId", DataRowVersion.Original]); // NotlarBL.NotlarıSil(nt.NotlarId); // break; // case DataRowState.Modified: // nt.Vize = Convert.ToInt32(item["Vize"]); // nt.Sozlu = Convert.ToInt32(item["Sozlu"]); // nt.Final = Convert.ToInt32(item["Final"]); // nt.Ortalama = Convert.ToInt32(item["Ortalama"]); // NotlarBL.NotlarıDuzenleme(nt); // break; // default: // break; // } //} #endregion }
private void btnNotDuzenle_Click(object sender, EventArgs e) { try { Notlar nt = new Notlar(); nt.Vize = Convert.ToInt32(txt1Vize.Text); nt.Sozlu = Convert.ToInt32(txtSozlu.Text); nt.Final = Convert.ToInt32(txtFinal.Text); nt.Ortalama = Convert.ToInt32(txtOrtalama.Text); nt.OgrenciId = Convert.ToInt32(txtGelenOgrId.Text); nt.DerslerId = Convert.ToInt32(txtGelenDersId.Text); nt.NotlarId = Convert.ToInt32(txtGelenNotId.Text); bool sonuc7 = NotlarBL.NotlarıDuzenleme(nt); if (sonuc7) { MessageBox.Show("Notlar Güncellendi"); NotlarListele(); Utility.CleanTextBoxes(grpNotEkleme.Controls); } else { MessageBox.Show("Notlar Güncellenmedi!!"); } } catch (Exception) { throw; } }
private void btnNotSil_Click(object sender, EventArgs e) { try { DialogResult dialog = MessageBox.Show("Öğrencinin Notlarını Silmek Üzeresiniz!!!", "UYARI", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dialog == DialogResult.OK) { Notlar nt = new Notlar(); nt.NotlarId = Convert.ToInt32(txtGelenNotId.Text); bool sonuc8 = NotlarBL.NotlarıSil(nt.NotlarId); if (sonuc8) { MessageBox.Show("Notlar Silindi"); NotlarListele(); Utility.CleanTextBoxes(grpNotEkleme.Controls); } else { MessageBox.Show("İşlem Başarısız!!"); } } } catch (Exception) { throw; } }
public Notlar Update(Notlar entity) { try { SqlCommand komut = new SqlCommand("update Tbl_Notlar set TARIH=@p1,SAAT=@p2,BASLIK=@p3,DETAY=@p4,OLUSTURAN=@p5,HITAP=@p6 where ID=@p7", baglanti.BaglantiDondur()); komut.Parameters.AddWithValue("@p1", entity.TARIH); komut.Parameters.AddWithValue("@p2", entity.SAAT); komut.Parameters.AddWithValue("@p3", entity.BASLIK); komut.Parameters.AddWithValue("@p4", entity.DETAY); komut.Parameters.AddWithValue("@p5", entity.OLUSTURAN); komut.Parameters.AddWithValue("@p6", entity.HITAP); komut.Parameters.AddWithValue("@p7", entity.ID); komut.ExecuteNonQuery(); baglanti.BaglantiDondur().Close(); return(entity); } catch (Exception) { return(null); } }
private void NotlariKaydet() { int seciliNotIndex = lstNotlar.SelectedIndex; string duzenlenenBaslik = txtBaslik.Text.Trim(); string duzenlenenIcerik = rtxtIcerik.Text.Trim(); Notlar seciliNot = notlar[seciliNotIndex]; using (var con = BaglantiOlustur()) { var cmd = new SqlCommand("UPDATE Notlar SET Baslik=@p1, Icerik=@p2 WHERE Id = @p0", con); cmd.Parameters.AddWithValue("@p1", duzenlenenBaslik); cmd.Parameters.AddWithValue("@p2", duzenlenenIcerik); cmd.Parameters.AddWithValue("@p0", seciliNot.Id); cmd.ExecuteNonQuery(); } if (lstAranan.Visible == true) { Notlar arananNot = arananlar[seciliNotIndex]; using (var con = BaglantiOlustur()) { var cmd = new SqlCommand("UPDATE Notlar SET Baslik=@p1, Icerik=@p2 WHERE Id = @p0", con); cmd.Parameters.AddWithValue("@p1", duzenlenenBaslik); cmd.Parameters.AddWithValue("@p2", duzenlenenIcerik); cmd.Parameters.AddWithValue("@p0", arananNot.Id); cmd.ExecuteNonQuery(); } } btnAramaIptal.Visible = false; NotlariListele(); Text = "Günlük 1.0"; }
public static bool NotlarıDuzenleme(Notlar nt) { try { SqlParameter[] p = { new SqlParameter("@Vize", nt.Vize), new SqlParameter("@Final", nt.Final), new SqlParameter("@Sozlu", nt.Sozlu), new SqlParameter("@Ortalama", nt.Ortalama), new SqlParameter("@NotlarId", nt.NotlarId), new SqlParameter("@DerslerId", nt.DerslerId), new SqlParameter("@OgrenciId", nt.OgrenciId) }; return(Helper.ExecuteNonQuery("spNotDuzenle", p) > 0); } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } }
private void kaydetButton_Clicked(object sender, EventArgs e) { not = (Notlar)notGirisStackLayout.BindingContext; not.NotTarih = DateTime.UtcNow; int sonuc = 0; if (string.IsNullOrEmpty(not.ID)) { App.NotlarVeritabani.YeniNotEkle(not); sonuc = 1; } // sonuc = await App.NotlarVeritabani.YeniNotEkle(not); else { App.NotlarVeritabani.NotGuncelle(not); sonuc = 1; // sonuc = await App.NotlarVeritabani.NotGuncelle(not); } if (sonuc == 1) { DisplayAlert("İşlem Başarılı", "İşleminiz başarıyla gerçekleştirildi.", "Tamam"); } else { DisplayAlert("İşlem Başarısız", "İşleminiz yapılırken hata oluştu.", "Tamam"); } //not.ID = string.Empty; //notGirisStackLayout.BindingContext = not; not = new Notlar(); notGirisStackLayout.BindingContext = not; notGirisi.Text = String.Empty; ListeGuncelle(); }
public NotGirisPage() { InitializeComponent(); not = new Notlar(); notGirisStackLayout.BindingContext = not; NavigationPage.SetHasBackButton(this, false); }
public static bool UpdateScore(Notlar notlar, bool Choose) { try { Connection ConnectAndRun = new Connection(); using (ConnectAndRun.OpenConnection()) { string Query = null; if (Choose == true) { Query = "UPDATE Notlar set Vize = @Notu where Id = @Id"; } else { Query = "UPDATE Notlar set Final = @Notu where Id = @Id"; } SqlCommand Cmd = ConnectAndRun.CreateQuery(Query); Cmd.Parameters.Add("@Notu", SqlDbType.Int).Value = notlar.Vize; Cmd.Parameters.Add("@Id", SqlDbType.Int).Value = notlar.Id; Cmd.ExecuteNonQuery(); } return(true); } catch (Exception Err) { MessageBox.Show(Err.Message); return(false); } }
public void AddNote(string note, string type, string alarm) { try { Notlar notes = new Notlar(); notes.Olusturulma = DateTime.Now; notes.NotDetay = note; notes.Alarm = Convert.ToDateTime(alarm); notes.NotTuru = type; db.Notlar.Add(notes); db.SaveChanges(); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } }
private void TaskEkle_Click(object sender, EventArgs e) { //bu buton ile form2 ekranında girilen tas bilgileri veri tabanına kaydedilmiştir. if (ProjeAdi.Text != "") { //süre tahminini hesaplayan metod çağırılmıştır. Tahmin(); //veri tabanı bağlantısı açılır conn.Open(); //veri tabanının tasks tablosuna form2 ye girilen bilgiler kaydedilir. SqlCommand kmt = new SqlCommand("Insert into Tasks (KartNo,TaskName,PersonelName,Descr,Note,TaskDate,PreDate,RealDate) VALUES ('" + KartNo.Text + "','" + ProjeAdi.Text + "','" + TeknikUzman.Text + "','" + Aciklama.Text + "','" + Notlar.Text + "','" + Tarih.Text + "','" + TahminiSure.Text + "','" + GerceklesenSure.Text + "')", conn); kmt.ExecuteNonQuery(); //veri tabanı bağlantısı kapanır. conn.Close(); MessageBox.Show("Kayit Eklendi"); } //tekrar giriş yapabilmek için form2 deki alanlar temizlenir. KartNo.Clear(); Tarih.Clear(); ProjeAdi.Clear(); TeknikUzman.Clear(); TahminiSure.Clear(); GerceklesenSure.Clear(); Aciklama.Clear(); Notlar.Clear(); }
public string notKaydet(DateTime nottarihi, TimeSpan notsaati, string notbaslik, string notdetay, string notOlusturan) { try { if (!string.IsNullOrWhiteSpace(notbaslik) && !string.IsNullOrWhiteSpace(notdetay)) { Notlar ekle = new Notlar(); ekle.NotTarihi = nottarihi; ekle.NotSaati = notsaati; ekle.NotBaslik = notbaslik; ekle.NotDetay = notdetay; ekle.NotuOlusturan = notOlusturan; db.Notlar.Add(ekle); int sonuc = db.SaveChanges(); if (sonuc > 0) { return("Not eklendi"); } } return("Ekleme başarısız."); } catch (Exception) { return("Hata Oluştu"); } }
private async void kaydetButton_Clicked(object sender, EventArgs e) { var not = (Notlar)notGirisStackLayout.BindingContext; not.NotTarih = DateTime.UtcNow; int sonuc; if (not.ID == 0) { sonuc = await App.NotlarVeritabani.YeniNotEkle(not); } else { sonuc = await App.NotlarVeritabani.NotGuncelle(not); } if (sonuc > 0) { await DisplayAlert("İşlem Başarılı", "İşleminiz başarıyla gerçekleştirildi.", "Tamam"); } else { await DisplayAlert("İşlem Başarısız", "İşleminiz yapılırken hata oluştu.", "Tamam"); } not = new Notlar(); notGirisStackLayout.BindingContext = not; notGirisi.Text = String.Empty; ListeGuncelle(); }
public static bool Update(EntityNotlar entityNotlar) { if (entityNotlar.OgrID != 0 && entityNotlar.OgrID != null && entityNotlar.Ortalama != null && entityNotlar.Ortalama >= 0 && entityNotlar.Ortalama <= 100 && entityNotlar.Sinav1 != null && entityNotlar.Sinav1 >= 0 && entityNotlar.Sinav1 <= 100 && entityNotlar.Sinav2 != null && entityNotlar.Sinav2 >= 0 && entityNotlar.Sinav2 <= 100 && entityNotlar.Sinav3 != null && entityNotlar.Sinav3 >= 0 && entityNotlar.Sinav3 <= 100 && entityNotlar.Proje != null && entityNotlar.Proje >= 0 && entityNotlar.Proje <= 100 && entityNotlar.Durum != null) { return(Notlar.Update(entityNotlar)); } return(false); }
private void BtnNotlar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (fr6 == null || fr6.IsDisposed) { fr6 = new Notlar(); fr6.MdiParent = this; fr6.Show(); } }
public async void NotSil(Notlar not) { await notlarTablosu.DeleteAsync(not); await App.mobilServis.SyncContext.PushAsync(); //await App.mobilServis.GetTable<Notlar>().DeleteAsync(not); //return await veritabani.DeleteAsync(not); }
public async void NotGuncelle(Notlar not) { //await App.mobilServis.GetTable<Notlar>().UpdateAsync(not); //return await veritabani.UpdateAsync(not); await notlarTablosu.UpdateAsync(not); //await App.mobilServis.SyncContext.PushAsync(); await ZamanUyumsuzSenkronizasyon(); }
public async void YeniNotEkle(Notlar not) { //await App.mobilServis.GetTable<Notlar>().InsertAsync(not); //await notlarTablosu.InsertAsync(not); await notlarTablosu.InsertAsync(not); //await App.mobilServis.SyncContext.PushAsync(); //int sonuc = await veritabani.InsertAsync(not); await ZamanUyumsuzSenkronizasyon(); }
public int DersEkle(Ders ders, uint not) { if (not < 0 && not > 100) { return(-1); } Dersler.Add(ders); Notlar.Add(not); return(0); }
public NotGirisPage(Notlar gelenNot) { InitializeComponent(); if (gelenNot != null) { gorunumModeli.NotMetni = gelenNot.NotMetni; gorunumModeli.DosyaAdi = gelenNot.DosyaAdi; } BindingContext = gorunumModeli; }
protected override void OnAppearing() { base.OnAppearing(); var notlar = new List <Notlar>(); notlar = Notlar.NotlariListele(); notlarListView.ItemsSource = notlar .OrderByDescending(d => d.NotTarih) .ToList(); }
private void btnKaydet_Click(object sender, EventArgs e) { Notlar notlar = new Notlar(); notlar.Baslik = txtBaslik.Text; notlar.Icerik = txtIcerik.Text; notlar.Tarih = DateTime.Parse(txtTarih.Text); notlar.Durum = false; db.Notlar.Add(notlar); db.SaveChanges(); MessageBox.Show("Not başarıyla kaydedildi", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void simpleButton1_Click(object sender, EventArgs e) { Notlar notlar = new Notlar(); notlar.Baslik = txtEdtBaslik.Text; notlar.Icerik = rchTxtIcerik.Text; notlar.Tarih = DateTime.Parse(txtEdtTarih.Text); notlar.Durum = false; db.Notlar.Add(notlar); db.SaveChanges(); MessageBox.Show("Yeni Not Başarılı Bir Şekilde Eklenmiştir.", "BİLGİ"); }
public bool CanExecute(object parameter) { Notlar not = (Notlar)parameter; if (not != null) { if (string.IsNullOrEmpty(not.NotMetni)) { return(false); } return(true); } return(false); }
void NotKaydet(object sender, EventArgs e) { var gelenNot = (Notlar)BindingContext; if (gelenNot == null) { // Yeni Kaydet Notlar.NotuKaydet(notlar, notGirisi.Text); } else { //Güncelle Notlar.NotuKaydet(gelenNot, notGirisi.Text); } }
public ActionResult OgrenciNotlariniGuncelle(Notlar model) { OgrenciDersPanosu dbcontext = new OgrenciDersPanosu(); var notupdate = dbcontext.Notlar.FirstOrDefault(i => i.NotId == model.NotId); if (notupdate != null) { notupdate.Sinav1 = model.Sinav1; notupdate.Sinav2 = model.Sinav2; notupdate.Sinav3 = model.Sinav3; notupdate.Sozlu1 = model.Sozlu1; notupdate.Sozlu2 = model.Sozlu2; notupdate.Sozlu3 = model.Sozlu3; dbcontext.SaveChanges(); } return(RedirectToAction("OgrenciNotlariniGoruntule", new { dersId = notupdate.DersId })); }
private void rtxtIcerik_TextChanged(object sender, EventArgs e) { if (lstNotlar.Items.Count == 0) { return; } int seciliNotIndeks = lstNotlar.SelectedIndex; Notlar n = notlar[seciliNotIndeks]; if (n.Icerik != rtxtIcerik.Text) { Text = "Gunluk1.0(*)"; } else { Text = "Gunluk1.0"; } }
public Notlar Delete(Notlar entity) { try { SqlCommand komut = new SqlCommand("delete from Tbl_Notlar where ID=@p1", baglanti.BaglantiDondur()); komut.Parameters.AddWithValue("@p1", entity.ID); komut.ExecuteNonQuery(); baglanti.BaglantiDondur().Close(); return(entity); } catch (Exception) { return(null); } }
private async void silButton_Clicked(object sender, EventArgs e) { var not = (Notlar)notGirisStackLayout.BindingContext; int sonuc = await App.NotlarVeritabani.NotSil(not); if (sonuc > 0) { await DisplayAlert("Başarılı", "Notunuz başarıyla silindi.", "Tamam"); } else { await DisplayAlert("Başarısız", "Notunuz silinirken hata oluştu.", "Tamam"); } not = new Notlar(); notGirisStackLayout.BindingContext = not; notGirisi.Text = String.Empty; ListeGuncelle(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (lstNotlar.Items.Count == 0) { return; } int seciliNotIndex = lstNotlar.SelectedIndex; Notlar n = notlar[seciliNotIndex]; if (rtxtIcerik.Text != n.Icerik || txtBaslik.Text != n.Baslik) { DialogResult dr = MessageBox.Show("İçerikte değişiklikler algılandı ve kaydedilmedi kaydedip çıkılsın mı ?", "Programdan Çıkılıyor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3); switch (dr) { case DialogResult.Cancel: e.Cancel = true; break; case DialogResult.Yes: NotlariKaydet(); break; case DialogResult.No: break; } } else { DialogResult dr = MessageBox.Show("Programdan çıkılsın mı ?", "Programdan Çıkılıyor", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3); switch (dr) { case DialogResult.Yes: NotlariKaydet(); break; case DialogResult.No: e.Cancel = true; break; } } }