Beispiel #1
0
        public void ThemTuFile(string path)
        {
            CuocHop CH;
            HoiThao HT;

            string[] lines = File.ReadAllLines(path);
            if (lines != null)
            {
                foreach (string line in lines)
                {
                    string[] parts = line.Split(',');
                    int      j     = parts.Length;
                    for (int i = 0; i < j; i++)
                    {
                        parts[i] = parts[i].Trim();
                    }
                    if (parts[1] == "Cuoc hop")
                    {
                        CH = new CuocHop();
                        CH.ThemTuMang(parts);
                        DSSK.Add(CH);
                    }
                    else if (parts[1] == "Hoi thao")
                    {
                        HT = new HoiThao();
                        HT.ThemTuMang(parts);
                        DSSK.Add(HT);
                    }
                }
            }
        }
Beispiel #2
0
        public void Them()
        {
            SuKien SK;
            int    soluong = Menu.HoiYeuCau(9999, "Nhap so luong su kien: ");

            for (int i = 0; i < soluong; i++)
            {
                Menu.TaoHeader(10, "SU KIEN " + (i + 1).ToString());
                Console.Write("  1. Cuoc hop    2. Hoi thao\n\n");
                int chon = Menu.HoiYeuCau(2, "Chon loai su kien: ");
                if (chon == 1)
                {
                    SK = new CuocHop();
                }
                else
                {
                    SK = new HoiThao();
                }
                try
                {
                    SK.Nhap();
                    DSSK.Add(SK);
                }
                catch { Program.XuatMauDo("    Them that bai!\n"); }
            }
        }