//delete selected private void button2_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; button2.Enabled = false; ATINChamCongEntities context = new ATINChamCongEntities(); foreach (TreeNode node in treeView1.Nodes) { foreach (TreeNode childNode in node.Nodes) { if (childNode.Checked) { switch (WorkCalendarShowType) { case "week": context.spDeleteLichTrinhTuan(lichTrinh.MaLichTrinh, (childNode.Tag as LichTrinhTuan).MaCaLamViec, node.Tag as int?); break; case "month": context.spDeleteLichTrinhThang(lichTrinh.MaLichTrinh, (childNode.Tag as LichTrinhThang).MaCaLamViec, node.Tag as int?); break; case "year": context.spDeleteLichTrinhNam(lichTrinh.MaLichTrinh, (childNode.Tag as LichTrinhNam).MaCaLamViec, node.Tag as int?, comboBox1.SelectedIndex + 1); break; } } } } TreeView1Config(listView2); Cursor.Current = Cursors.Default; button2.Enabled = true; }