public static void themDuAn(Project DuAn)
 {
     using (var _context = new DBLabManagerEntities())
     {
         _context.Projects.Add(DuAn);
         _context.SaveChanges();
     }
 }
 public static void capNhatCongViec(ProjectMember congViec)
 {
     using (var _context = new DBLabManagerEntities())
     {
         _context.ProjectMembers.AddOrUpdate(congViec);
         _context.SaveChanges();
     }
 }
 public static void capNhatDuAn(Project DuAn)
 {
     using (var _context = new DBLabManagerEntities())
     {
         _context.Projects.AddOrUpdate(DuAn);
         _context.SaveChanges();
     }
 }
 public static void themNhanVien(Member nhanVien)
 {
     using (var _context = new DBLabManagerEntities())
     {
         _context.Members.Add(nhanVien);
         _context.SaveChanges();
     }
 }
 public static void themTaiKhoan(SignIn signIn)
 {
     using (var _context = new DBLabManagerEntities())
     {
         _context.SignIns.Add(signIn);
         _context.SaveChanges();
     }
 }
 public static void SuaThongTinThanhVien(Member thanhVien)
 {
     using (var _context = new DBLabManagerEntities())
     {
         _context.Members.AddOrUpdate(thanhVien);
         _context.SaveChanges();
     }
 }
 public static void xoaDuAn(string maDA)
 {
     using (var _context = new DBLabManagerEntities())
     {
         Project DuAn = (from p in _context.Projects
                         where string.Compare(p.ID.Trim(), maDA, false) == 0
                         select p).SingleOrDefault();
         List <ProjectMember> dSCongViec = (from pm in _context.ProjectMembers
                                            where string.Compare(pm.IDProject.Trim(), maDA, false) == 0
                                            select pm).ToList();
         foreach (ProjectMember CongViec in dSCongViec)
         {
             _context.ProjectMembers.Remove(CongViec);
         }
         _context.Projects.Remove(DuAn);
         _context.SaveChanges();
     }
 }
 public static bool themCongViec(string maDA, string maNV, string congViec)
 {
     using (var _context = new DBLabManagerEntities())
     {
         var CongViec = layCongViec(maDA, maNV);
         if (CongViec == null)
         {
             ProjectMember CongViecMoi = new ProjectMember();
             CongViecMoi.IDProject         = maDA;
             CongViecMoi.IDMember          = maNV;
             CongViecMoi.Works             = congViec;
             CongViecMoi.LinkCheckProgress = "";
             CongViecMoi.Progress          = false;
             _context.ProjectMembers.Add(CongViecMoi);
             _context.SaveChanges();
             return(true);
         }
         return(false);
     }
 }
 public static void xoaNhanVien(Member thanhVien)
 {
     using (var _context = new DBLabManagerEntities())
     {
         var ThanhVien = (from m in _context.Members
                          where m.ID == thanhVien.ID
                          select m).SingleOrDefault();
         try
         {
             var TaiKhoan = (from s in _context.SignIns
                             where s.IDMember == thanhVien.ID
                             select s).SingleOrDefault();
             _context.SignIns.Remove(TaiKhoan);
         }
         catch
         {
         }
         _context.Members.Remove(ThanhVien);
         _context.SaveChanges();
     }
 }