Beispiel #1
0
 void Save()
 {
     dataEntities db = new dataEntities();
     not noe = new not();
     noe.note = this.txtnote.Text;
     db.nots.Add(noe);
     db.SaveChanges();
     this.Close();
     MessageBox.Show("successfully!");
 }
Beispiel #2
0
 void delete()
 {
     if (listview.SelectedRows.Count == 1)
     {
         var row = listview.SelectedRows[0];
         string cell = (string)row.Cells["note"].Value;
         dataEntities db = new dataEntities();
         not noe = db.nots.Single(st => st.note == cell);
         db.nots.Remove(noe);
         db.SaveChanges();
         this.load();
     }
 }
Beispiel #3
0
 void listview_DoubleClick(object sender, EventArgs e)
 {
     if (listview.SelectedRows.Count == 1)
     {
         dataEntities db = new dataEntities();
         not noe = new not();
         var row = listview.SelectedRows[0];
         string cell = (string)row.Cells["note"].Value;
         Form3 a = new Form3(cell);
         a.ShowDialog();
         if(noe.note!=cell)
         {
         delete();
         }
         this.load();
     }
 }
Beispiel #4
0
 public void load()
 {
     dataEntities db = new dataEntities();
     this.listview.DataSource = db.nots.ToList();
 }
Beispiel #5
0
 public Form3(string note)
 {
     InitializeComponent();
     ac = new dataEntities();
     noe = ac.nots.Single(st=>st.note==note);
 }