Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
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;
                }

            }
        }