Ejemplo n.º 1
0
 /// <summary>
 /// Lấy tất cả dữ liệu
 /// </summary>
 /// <returns></returns>
 public IQueryable <Cat_Shift> GetAll()
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork         unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_ShiftRepository repo       = new Cat_ShiftRepository(unitOfWork);
         return(repo.GetAllCatShift().Where(i => i.IsDelete == null));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Lấy tất cả các bản ghi có thuộc tính IsDelete là null
        /// Gọi GetAllCatLeaveDayType() trong Cat_LeaveDayTypeRepository
        /// </summary>
        /// <returns></returns>
        public IQueryable<Cat_LeaveDayType> GetCatLeaveDayType()
        {
            using (var context = new VnrAttendanceDataContext())
            {
                IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                Cat_LeaveDayTypeRepository repo = new Cat_LeaveDayTypeRepository(unitOfWork);
                return repo.GetAllCatLeaveDayType().Where(i => i.IsDelete == null);
            }

        }
Ejemplo n.º 3
0
 /// <summary>
 /// Lấy dữ liệu theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_Shift GetById(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_ShiftRepository repo = new Cat_ShiftRepository(unitOfWork);
         var catshift= repo.GetById(id);
         if (catshift.IsDelete == true) catshift = null;
         return catshift;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Lấy dữ liệu theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_DayOff GetById(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_DayOffRepository repo = new Cat_DayOffRepository(unitOfWork);
         var catdayoff= repo.GetById(id);
         if (catdayoff.IsDelete == true) catdayoff = null;
         return catdayoff;
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Tìm kiếm bản ghi có theo tham số id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_LeaveDayType GetByIdCatLeaveDayType(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_LeaveDayTypeRepository repo = new Cat_LeaveDayTypeRepository(unitOfWork);
         Cat_LeaveDayType catLeaveDayType = new Cat_LeaveDayType();
         catLeaveDayType = repo.GetById(id);
         if (catLeaveDayType.IsDelete == true) catLeaveDayType = null;
         return catLeaveDayType;
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Lấy dữ liệu theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_Shift GetById(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork         unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_ShiftRepository repo       = new Cat_ShiftRepository(unitOfWork);
         var catshift = repo.GetById(id);
         if (catshift.IsDelete == true)
         {
             catshift = null;
         }
         return(catshift);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Lấy dữ liệu theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_DayOff GetById(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork          unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_DayOffRepository repo       = new Cat_DayOffRepository(unitOfWork);
         var catdayoff = repo.GetById(id);
         if (catdayoff.IsDelete == true)
         {
             catdayoff = null;
         }
         return(catdayoff);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Tìm kiếm bản ghi có theo tham số id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_LeaveDayType GetByIdCatLeaveDayType(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork                     = (IUnitOfWork)(new UnitOfWork(context));
         Cat_LeaveDayTypeRepository repo            = new Cat_LeaveDayTypeRepository(unitOfWork);
         Cat_LeaveDayType           catLeaveDayType = new Cat_LeaveDayType();
         catLeaveDayType = repo.GetById(id);
         if (catLeaveDayType.IsDelete == true)
         {
             catLeaveDayType = null;
         }
         return(catLeaveDayType);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Thêm bản ghi mới
 /// </summary>
 /// <param name="catLeaveDayType"></param>
 /// <returns></returns>
 public bool AddCatLeaveDayType(Cat_LeaveDayType catLeaveDayType)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_LeaveDayTypeRepository repo = new Cat_LeaveDayTypeRepository(unitOfWork);
         try
         {
             repo.Add(catLeaveDayType);
             repo.SaveChanges();
             return true;
         }
         catch
         {
             return false;
         }
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Edit một record
 /// </summary>
 /// <param name="cat"></param>
 /// <returns></returns>
 public bool Edit(Cat_Shift cat)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork         unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_ShiftRepository repo       = new Cat_ShiftRepository(unitOfWork);
         try
         {
             repo.Edit(cat);
             repo.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Update bản ghi
 /// </summary>
 /// <param name="catLeaveDayType"></param>
 /// <returns></returns>
 public bool UpdateCatLeaveDayType(Cat_LeaveDayType catLeaveDayType)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork          = (IUnitOfWork)(new UnitOfWork(context));
         Cat_LeaveDayTypeRepository repo = new Cat_LeaveDayTypeRepository(unitOfWork);
         try
         {
             repo.Edit(catLeaveDayType);
             repo.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Remove 1 record là chuyển trạng thái IsDelete=true
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool Remove(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork         unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_ShiftRepository repo       = new Cat_ShiftRepository(unitOfWork);
         var cat = repo.GetById(id);
         try
         {
             repo.Remove(cat);
             repo.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Edit một record
        /// </summary>
        /// <param name="cat"></param>
        /// <returns></returns>
        public bool Edit(Cat_Shift cat)
        {
            using (var context = new VnrAttendanceDataContext())
            {
                IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                Cat_ShiftRepository repo = new Cat_ShiftRepository(unitOfWork);
                try
                {
                    repo.Edit(cat);
                    repo.SaveChanges();
                    return true;
                }
                catch
                {
                    return false;
                }

            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Update thuộc tính IsDelete là true
 /// </summary>
 /// <param name="catLeaveDayTypeId"></param>
 /// <returns></returns>
 public bool DeleteCatLeaveDayType(int catLeaveDayTypeId)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork                     = (IUnitOfWork)(new UnitOfWork(context));
         Cat_LeaveDayTypeRepository repo            = new Cat_LeaveDayTypeRepository(unitOfWork);
         Cat_LeaveDayType           catLeaveDayType = new Cat_LeaveDayType();
         catLeaveDayType = repo.GetById(catLeaveDayTypeId);
         try
         {
             repo.Remove(catLeaveDayType);
             repo.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Update thuộc tính IsDelete là true
        /// </summary>
        /// <param name="catLeaveDayTypeId"></param>
        /// <returns></returns>
        public bool DeleteCatLeaveDayType(int catLeaveDayTypeId)
        {
            using (var context = new VnrAttendanceDataContext())
            {
                IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                Cat_LeaveDayTypeRepository repo = new Cat_LeaveDayTypeRepository(unitOfWork);
                Cat_LeaveDayType catLeaveDayType = new Cat_LeaveDayType();
                catLeaveDayType = repo.GetById(catLeaveDayTypeId);
                try
                {
                    repo.Remove(catLeaveDayType);
                    repo.SaveChanges();
                    return true;
                }
                catch
                {
                    return false;
                }

            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Remove 1 record là chuyển trạng thái IsDelete=true
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Remove(int id)
        {
            using (var context = new VnrAttendanceDataContext())
            {
                IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                Cat_ShiftRepository repo = new Cat_ShiftRepository(unitOfWork);
                var cat = repo.GetById(id);
                try
                {
                    repo.Remove(cat);
                    repo.SaveChanges();
                    return true;
                }
                catch
                {
                    return false;
                }

            }
        }