Exemple #1
0
 public int Them(object a)
 {
     try
     {
         if (a.GetType().ToString().IndexOf("NguoiDung") > 1)
         {
             db.NguoiDungs.Add((NguoiDung)a);
         }
         else
         if (a.GetType().ToString().IndexOf("Ma") > 1)
         {
             db.Mas.Add((Ma)a);
         }
         else
         if (a.GetType().ToString().IndexOf("LogDangNhap") > 1)
         {
             db.LogDangNhaps.Add((LogDangNhap)a);
         }
         else
         if (a.GetType().ToString().IndexOf("LogDangXuas") > 1)
         {
             db.LogDangXuats.Add((LogDangXuat)a);
         }
         else
         if (a.GetType().ToString().IndexOf("LSKhoa") > 1)
         {
             db.LSKhoas.Add((LSKhoa)a);
         }
         db.SaveChanges();
         return(1);
     }
     catch { return(0); }
 }
Exemple #2
0
        public void LichsuDX(int idND)
        {
            db = new QLMaEntities();
            var ls = new LogDangXuat();

            ls.IdND       = idND;
            ls.ThoiGianDX = DateTime.Now;
            db.LogDangXuats.Add(ls);
            db.SaveChanges();
        }