Example #1
0
 /// <summary>
 /// Gets the latest leave request by employee identifier.
 /// </summary>
 /// <param name="employeeId">The employee identifier.</param>
 /// <returns></returns>
 /// <exception cref="ApplicationException">Repository GetLeaveRequestByEmployeeId</exception>
 public ILeaveRequestModel GetLatestLeaveRequestByEmployeeId(int employeeId)
 {
     try
     {
         using (
             var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
         {
             var list = LeaveQueries.GetLatestLeaveRequestByEmployeeId(dbContext, employeeId);
             return(list);
         }
     }
     catch (Exception e)
     {
         throw new ApplicationException("Repository GetLeaveRequestByEmployeeId", e);
     }
 }
Example #2
0
 public IList <ILeaveRequestModel> GetLeaveRequestByCompanyId(int companyId)
 {
     try
     {
         using (
             var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
         {
             var list = LeaveQueries.getLeaveRequestByCompanyId(dbContext, companyId).ToList();
             return(list);
         }
     }
     catch (Exception e)
     {
         throw new ApplicationException("Repository GetLeaveTypeListForCompanyId", e);
     }
 }
Example #3
0
 /// <summary>
 /// Gets the leave type list.
 /// </summary>
 /// <returns></returns>
 /// <exception cref="ApplicationException">Repository GetLeaveTypeList</exception>
 public IList <ILeaveType> GetLeaveTypeList()
 {
     try
     {
         using (
             var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
         {
             var list = LeaveQueries.GetLeaveType(dbContext).ToList();
             return(list);
         }
     }
     catch (Exception e)
     {
         throw new ApplicationException("Repository GetLeaveTypeList", e);
     }
 }
Example #4
0
 public ILeaveType GetLeaveTypeByName(string leaveTypeName, int companyId)
 {
     try
     {
         using (
             var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
         {
             var aRecord = LeaveQueries.getLeaveTypeByName(dbContext, leaveTypeName, companyId);
             return(aRecord);
         }
     }
     catch (Exception e)
     {
         throw new ApplicationException("Repository GetLeaveTypetByName", e);
     }
 }
Example #5
0
        /// <summary>
        /// Gets the leave type by identifier.
        /// </summary>
        /// <param name="leaveTypeId">The leave type identifier.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">leaveTypeId</exception>
        public ILeaveType GetLeaveTypeById(int leaveTypeId)
        {
            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var leaveTypeInfo = LeaveQueries.getLeaveTypeById(dbContext, leaveTypeId);

                    return(leaveTypeInfo);
                }
            }
            catch (Exception e)
            {
                throw new ArgumentNullException(nameof(leaveTypeId));
            }
        }
Example #6
0
        /// <summary>
        /// Gets the list of leave requests made by employees in both the parent company and child companies of an HR admin
        /// </summary>
        /// <param name="hrId">The hr identifier.</param>
        /// <returns></returns>
        public IList <ILeaveRequestModel> GetLeaveRequestByHrAdminIdWithChildCompanies(int hrId)
        {
            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var list = LeaveQueries.GetLeaveRequestByHrAdminIdWithChildCompanies(dbContext, hrId).ToList();

                    return(list);
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException("Repository Get Leave Request by HRAdminId with child companies List", e);
            }
        }
Example #7
0
        /// <summary>
        /// Gets the leave request by employee supervisor identifier.
        /// </summary>
        /// <param name="supervisorId">The supervisor identifier.</param>
        /// <returns></returns>
        /// <exception cref="ApplicationException">Repository Get Leave Request by SupervisorId List</exception>
        public IList <ILeaveRequestModel> GetLeaveRequestByEmployeeSupervisorId(int supervisorId)
        {
            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var list = LeaveQueries.GetLeaveRequestByEmployeeSupervisorId(dbContext, supervisorId).ToList();

                    return(list);
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException("Repository Get Leave Request by SupervisorId List", e);
            }
        }
Example #8
0
        /// <summary>
        /// Gets the leave request details.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        /// <exception cref="ApplicationException">Repository GetRequestDetails</exception>
        public ILeaveRequestModel GetLeaveRequestDetails(int id)
        {
            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var model = LeaveQueries.GetLeaveRequestById(dbContext, id);

                    //var leaveRequestListView = new LeaveRequest();
                    return(model);
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException("Repository GetRequestDetails", e);
            }
        }
Example #9
0
        /// <summary>
        /// Gets the leave status by identifier.
        /// </summary>
        /// <param name="leaveStatusId">The leave status identifier.</param>
        /// <returns></returns>
        /// <exception cref="ApplicationException">Repository GetLeaveStatusById</exception>
        public ILeaveStatus GetLeaveStatusById(int leaveStatusId)
        {
            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var leaveStatus = LeaveQueries.GetLeaveStatusById(dbContext, leaveStatusId);

                    //var leaveRequestListView = new LeaveRequest();
                    return(leaveStatus);
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException("Repository GetLeaveStatusById", e);
            }
        }
Example #10
0
        /// <summary>
        /// Gets the leave status list.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="ApplicationException">Repository GetLeaveStatus</exception>
        public IList <ILeaveStatus> GetLeaveStatusList()
        {
            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var list = LeaveQueries.GetLeaveStatus(dbContext).ToList();

                    //var leaveRequestListView = new LeaveRequest();
                    return(list);
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException("Repository GetLeaveStatus", e);
            }
        }