private void listView1_SelectedIndexChanged(object sender, EventArgs e) { Handler h = new Handler(); Data.Value = h.getTipByID((System.Int32.Parse(listView1.Items[listView1.SelectedIndices[0]].Name))); Form2 detailForm = new Form2(); detailForm.Show(); }
private void button1_Click(object sender, EventArgs e) { Handler handler = new Handler(); string name = textBox1.Text; string text = richTextBox1.Text; List<string> tags = new List<string>(); if (Data.Value.ID > 0){ handler.updateTip(name, text, Data.Value.ID); }else{ Tip tip = new Tip(name, text, tags); handler.saveTip(tip); } }
public Form1() { InitializeComponent(); Handler h = new Handler(); List<Tip> tips = h.getAllTips(); foreach (Tip tip in tips) { ListViewItem lvi = new ListViewItem(); lvi.Text = tip.Name; lvi.ImageIndex = 0; lvi.Name = tip.ID.ToString(); listView1.Items.Add(lvi); } }
private int createID() { Handler h = new Handler(); int id = h.getLastTipID(); return id; }