예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ThongTin();
            Nguoi peoPle = new Nguoi(ten, tuoi, gioiTinh, diaChi);

            store.SaveOne(peoPle);
        }
예제 #2
0
        public List <Nguoi> LoadAll()
        {
            List <Nguoi> dsNguoi = new List <Nguoi>();

            if (!File.Exists(Path))
            {
                MessageBox.Show("file không tồn tại");
            }
            else
            {
                var z = File.ReadAllLines(Path);
                for (int i = 0; i < z.Length; i++)
                {
                    var   x        = z[i].Split(',');
                    var   ten      = x[0];
                    var   tuoi     = x[1];
                    var   gioiTinh = x[2];
                    var   diaChi   = x[3];
                    Nguoi nguoi    = new Nguoi(ten, tuoi, gioiTinh, diaChi);
                    dsNguoi.Add(nguoi);
                }
            }
            return(dsNguoi);
        }
예제 #3
0
 public void SaveOne(Nguoi nguoi)
 {
     collection.InsertOne(nguoi);
 }
예제 #4
0
        public void SaveOne(Nguoi nguoi)
        {
            string appendText = nguoi.ToString() + Environment.NewLine;

            File.AppendAllText(Path, appendText);
        }