public LeaveEarnedDTO GetOneLeaveEarned(int id)
        {
            LeaveEarned    Record       = _unitOfWork.LeaveEarnedRepository.GetById(id);
            LeaveEarnedDTO ReturnRecord = LeaveEarnedResponseFormatter.LeaveEarnedToDto(Record);

            return(ReturnRecord);
        }
        public static LeaveEarnedDTO LeaveEarnedToDto(LeaveEarned Data)
        {
            LeaveEarnedDTO Record = new LeaveEarnedDTO
            {
                LeaveEarnedId = Data.LeaveEarnedId,

                LeaveEarnRequestedDate = Data.LeaveEarnRequestedDate,
                RecommendedEmpCode     = Data.RecommendedEmpCode,
                RecommendStatus        = Data.RecommendStatus,
                RecommendStatusDate    = Data.RecommendStatusDate,
                ApproverEmpCode        = Data.ApproverEmpCode,
                ApproverStatus         = Data.ApproverStatus,
                ApproverStatusDate     = Data.ApproverStatusDate,
                WorkedStartDate        = Data.WorkedStartDate,
                WorkedEndDate          = Data.WorkedEndDate,
                LeaveTotalEanrnedDays  = Data.LeaveTotalEanrnedDays,
                LeaveTypeId            = Data.LeaveTypeId,
                EarnLeaveExpiryDate    = Data.EarnLeaveExpiryDate,
                Remarks     = Data.Remarks,
                LeaveYearId = Data.LeaveYearId,
                EmpCode     = Data.EmpCode,
                Employee    = new EmployeeDTO
                {
                    EmpCode = Data.Employee.EmpCode,
                    EmpName = Data.Employee.EmpName
                }
            };

            return(Record);
        }
        public void AddLeaveEarned(LeaveEarnedDTO Record)
        {
            LeaveEarned ReturnRecord = RequestFormatters.LeaveEarnedRequestFormatter.LeaveEarnedDTOToDb(Record);

            ReturnRecord.ApproverStatus         = 2;
            ReturnRecord.ApproverStatusDate     = DateTime.Now;
            ReturnRecord.LeaveTotalEanrnedDays  = Convert.ToDateTime(Record.WorkedEndDate).Date.Subtract((Convert.ToDateTime(Record.WorkedStartDate)).Date).Duration().Days + 1;
            ReturnRecord.LeaveEarnRequestedDate = DateTime.Now;
            _unitOfWork.LeaveEarnedRepository.Create(ReturnRecord);
        }
示例#4
0
        public static LeaveEarned LeavernedDtoToLeaveEarned(LeaveEarnedDTOs Record)
        {
            LeaveEarned result = new LeaveEarned()
            {
                LeaveEarnedId          = Record.LeaveEarnedId,
                ApproverEmpCode        = Record.ApproverEmpCode,
                ApproverStatus         = Record.ApproverStatus,
                ApproverStatusDate     = Record.ApproverStatusDate,
                EarnLeaveExpiryDate    = Record.EarnLeaveExpiryDate,
                EmpCode                = Record.EmpCode,
                LeaveEarnRequestedDate = Record.LeaveEarnRequestedDate,
                LeaveTotalEanrnedDays  = Record.LeaveTotalEanrnedDays,
                LeaveTypeId            = Record.LeaveTypeId,
                LeaveYearId            = Record.LeaveYearId,
                RecommendedEmpCode     = Record.RecommendedEmpCode,
                RecommendStatus        = Record.RecommendStatus,
                RecommendStatusDate    = Record.RecommendStatusDate,
                Remarks                = Record.Remarks,
                WorkedEndDate          = Record.WorkedEndDate,
                WorkedStartDate        = Record.WorkedStartDate
            };

            return(result);
        }
        public static LeaveEarned LeaveEarnedDTOToDb(LeaveEarnedDTO Data)
        {
            LeaveEarned Record = new LeaveEarned
            {
                LeaveEarnedId          = Data.LeaveEarnedId,
                EmpCode                = Data.EmpCode,
                LeaveEarnRequestedDate = Data.LeaveEarnRequestedDate,
                RecommendedEmpCode     = Data.RecommendedEmpCode,
                RecommendStatus        = Data.RecommendStatus,
                RecommendStatusDate    = Data.RecommendStatusDate,
                ApproverEmpCode        = Data.ApproverEmpCode,
                ApproverStatus         = Data.ApproverStatus,
                ApproverStatusDate     = Data.ApproverStatusDate,
                WorkedStartDate        = Data.WorkedStartDate,
                WorkedEndDate          = Data.WorkedEndDate,
                LeaveTotalEanrnedDays  = Data.LeaveTotalEanrnedDays,
                LeaveTypeId            = Data.LeaveTypeId,
                EarnLeaveExpiryDate    = Data.EarnLeaveExpiryDate,
                Remarks                = Data.Remarks,
                LeaveYearId            = Data.LeaveYearId,
            };

            return(Record);
        }