Example #1
0
        public QuanLiDanhBa()
        {
            InitializeComponent();
            dgvNhom.AutoGenerateColumns   = false;
            dgvDanhBa.AutoGenerateColumns = false;
            List <Nhom> listNhom = Nhom.getNhom();

            bdsNhom.DataSource = listNhom;
            dgvNhom.DataSource = bdsNhom;
        }
        public ThemLienLac()
        {
            InitializeComponent();
            List <Nhom> list = Nhom.getNhom();

            for (int i = 0; i < list.Count; i++)
            {
                txtNhom.Items.Add(list.ElementAt(i).tenNhom);
            }
        }
Example #3
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            List <Nhom> listNhom = Nhom.getNhom();

            bdsNhom.DataSource = listNhom;
            dgvNhom.DataSource = bdsNhom;
            string        tenNhom = (string)dgvNhom.CurrentCell.Value;
            List <DanhBa> list    = DanhBa.getDanhBaTheoNhom(tenNhom);

            bdsDanhBa.DataSource = list;
            dgvDanhBa.DataSource = bdsDanhBa;
        }
Example #4
0
        private void btnXoaNhom_Click(object sender, EventArgs e)
        {
            string tenNhomXoa = (string)dgvNhom.CurrentCell.Value;
            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);
                }
            }
            List <Nhom> listNhom = Nhom.getNhom();

            bdsNhom.DataSource = listNhom;
            dgvNhom.DataSource = bdsNhom;
            string        tenNhom = (string)dgvNhom.CurrentCell.Value;
            List <DanhBa> list    = DanhBa.getDanhBaTheoNhom(tenNhom);

            bdsDanhBa.DataSource = list;
            dgvDanhBa.DataSource = bdsDanhBa;
        }