예제 #1
0
 public static HrManagerContext GetInstance()
 {
     if (entity == null)
     {
         entity = new HrManagerContext();
     }
     return(entity);
 }
예제 #2
0
        public static DbSet <T> GetDbSetInstance <T>()
            where T : class
        {
            if (entity == null)
            {
                entity = new HrManagerContext();
            }
            var propInfo = typeof(HrManagerContext).GetProperty(typeof(T).Name + "s");

            return((DbSet <T>)propInfo.GetValue(entity, null));
        }
예제 #3
0
 public List <Attendance> GetAttendancesByMonth(int month)
 {
     return(HrManagerContext.GetInstance().Attendances.Where(a => a.RecordTimeToDateTime.Month == month).ToList());
 }
예제 #4
0
 public int Update()
 {
     return(HrManagerContext.GetInstance().SaveChanges());
 }
예제 #5
0
 public void Delete(T t)
 {
     currentDbset.Remove(t);
     HrManagerContext.GetInstance().SaveChanges();
 }
예제 #6
0
 public void Add(T t)
 {
     currentDbset.Add(t);
     HrManagerContext.GetInstance().SaveChanges();
 }