public static ApprovalInfo ToDO(ApprovalInfoDTO dto) { if (dto == null) { return(null); } var approvalInfo = new ApprovalInfo() { ApprovalType = dto.ApprovalType, Time = dto.Time, ApprovalInfoId = dto.ApprovalInfoId, Msg = dto.Msg, Approver = ApproverAssembler.ToDO(dto.ApproverDTO) }; return(approvalInfo); }
public static Leave ToDO(LeaveDTO dto) { var historyApprovalInfoDTOList = new List <ApprovalInfo>(); foreach (var historyApprovalInfoDTO in dto.HistoryApprovalInfoDTOList) { historyApprovalInfoDTOList.Add(ApprovalInfoAssembler.ToDO(historyApprovalInfoDTO)); } var leave = new Leave() { Id = dto.LeaveId, Applicant = ApplicantAssembler.ToDO(dto.ApplicantDTO), Approver = ApproverAssembler.ToDO(dto.ApproverDTO), CurrentApprovalInfo = ApprovalInfoAssembler.ToDO(dto.CurrentApprovalInfoDTO), HistoryApprovalInfos = historyApprovalInfoDTOList, StartTime = string.IsNullOrEmpty(dto.StartTime) ? DateTime.Now : DateTime.Parse(dto.StartTime), EndTime = string.IsNullOrEmpty(dto.EndTime) ? DateTime.Now : DateTime.Parse(dto.EndTime), MaxLeaderLevel = dto.MaxLeaderLevel }; leave.Duration = leave.GetDuration(); return(leave); }