Пример #1
0
        public static void Add(ChiTietDanhBa nhom)
        {
            var db = new KiemTraDBContext();

            db.ChiTietDanhBaDbSet.Add(nhom);
            db.SaveChanges();
        }
Пример #2
0
        public static void Remove(ChiTietDanhBa ten)
        {
            var db    = new KiemTraDBContext();
            var ojbSV = db.ChiTietDanhBaDbSet.Where(e => e.Tengoi == ten.Tengoi).FirstOrDefault();

            if (ojbSV != null)
            {
                db.ChiTietDanhBaDbSet.Remove(ojbSV);
            }
            db.SaveChanges();
        }
Пример #3
0
        public static List <ChiTietDanhBa> GetListFromFile(string pathData, string tenNhom)
        {
            var arrayLines = File.ReadAllLines(pathData);
            List <ChiTietDanhBa> ketQua = new List <ChiTietDanhBa>();

            foreach (var line in arrayLines)
            {
                var lsValue = line.Split(new char[] { '#' });

                var chitietdanhba = new ChiTietDanhBa
                {
                    Tengoi  = lsValue[1],
                    Diachi  = lsValue[2],
                    Email   = lsValue[3],
                    SDT     = lsValue[4],
                    TenNhom = lsValue[5],
                };
                if (chitietdanhba.TenNhom == tenNhom)
                {
                    ketQua.Add(chitietdanhba);
                }
            }
            return(ketQua);
        }