Пример #1
0
        private void btnXoaNhom_Click(object sender, EventArgs e)
        {
            string tenNhomXoa = (string)dgvNhom.CurrentCell.Value;

            var nhom = Nhom.getNhomFromDBByName(tenNhomXoa);

            DanhBa.xoaDanhBaByNhom(nhom.maNhom);
            Nhom.xoaNhomFromDBByName(tenNhomXoa);
            refreshList();
            //string pathNhom = Application.StartupPath + @"/DATA/Nhom.txt";
            //string pathDanhBa = Application.StartupPath + @"/DATA/DanhBa.txt";

            //string[] linesNhom = File.ReadAllLines(pathNhom);
            //string[] linesDanhBa = File.ReadAllLines(pathDanhBa);

            //File.WriteAllText(pathNhom, "");
            //File.WriteAllText(pathDanhBa, "");

            //string newline = System.Environment.NewLine;
            //for (int i = 0; i < linesNhom.Length; i++)
            //{
            //    string[] temp = linesNhom[i].Split(new char[] { '#' });
            //    if (!temp[1].Equals(tenNhomXoa))
            //    {
            //       File.AppendAllText(pathNhom, linesNhom[i] + newline, Encoding.Unicode);
            //   }
            //}

            //for (int i = 0; i < linesDanhBa.Length; i++)
            //// {
            //    string[] temp = linesDanhBa[i].Split(new char[] { '#' });
            //    if (!temp[0].Equals(tenNhomXoa))
            //    {
            //         File.AppendAllText(pathDanhBa, linesDanhBa[i] + newline, Encoding.Unicode);
            //     }
            // }
        }