public static void SendTimeAdjustmentEmail(TimeAdjustmentFormDto timeAdjustmentFormDto) { var recipientAddress = "*****@*****.**"; var msg = CommonSetup(recipientAddress, EmailType.TimeAdjustment); msg.Body = CompileMessageBody(timeAdjustmentFormDto); PostEmail(msg); }
public void Update(TimeAdjustmentFormDto timeAdjustmentFormDto, long userId) { var timeAdjustmentForm = _unitOfWork.TimeAdjustmentFormRepository.GetById(timeAdjustmentFormDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(timeAdjustmentFormDto, timeAdjustmentForm); _unitOfWork.TimeAdjustmentFormRepository.Update(timeAdjustmentForm); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.TimeAdjustmentFormTableName, userId, timeAdjustmentForm.Id); }
private static string CompileMessageBody(TimeAdjustmentFormDto timeAdjustmentFormDto) { var sb = new StringBuilder(); sb.Append("Staff Name: "); sb.Append(timeAdjustmentFormDto.StaffName); sb.Append("\n"); sb.Append("Location: "); sb.Append(timeAdjustmentFormDto.ShiftLocation); sb.Append("\n"); sb.Append("Shift Date: "); sb.Append(timeAdjustmentFormDto.ShiftStartDateTime); sb.Append("\n"); sb.Append("Time In: "); sb.Append(timeAdjustmentFormDto.ActualStartDateTime); sb.Append("\n"); sb.Append("Time Out: "); sb.Append(timeAdjustmentFormDto.ActualEndDateTime); sb.Append("\n"); sb.Append("Missed Clock In: "); sb.Append(timeAdjustmentFormDto.MissedClockIn); sb.Append("\n"); sb.Append("Missed Clock Out: "); sb.Append(timeAdjustmentFormDto.MissedClockOut); sb.Append("\n"); sb.Append("Late In: "); sb.Append(timeAdjustmentFormDto.LateIn); sb.Append("\n"); sb.Append("Early Out: "); sb.Append(timeAdjustmentFormDto.EarlyOut); sb.Append("\n"); sb.Append("Reason: "); sb.Append(timeAdjustmentFormDto.Notes); sb.Append("\n"); return(sb.ToString()); }
public void Create(TimeAdjustmentFormDto timeAdjustmentFormDto, long userId) { var timeAdjustmentForm = Mapper.Map <TimeAdjustmentForm>(timeAdjustmentFormDto); _unitOfWork.TimeAdjustmentFormRepository.Create(timeAdjustmentForm); _unitOfWork.Save(); // trip IsModified flag to remove from User Dash var shiftProfile = _unitOfWork.ShiftProfileRepository.GetById(timeAdjustmentFormDto.ShiftProfileId); shiftProfile.IsModified = true; _unitOfWork.ShiftProfileRepository.Update(shiftProfile); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeCreate, AppConstants.TimeAdjustmentFormTableName, userId, timeAdjustmentForm.Id); }
public static void MapDtoToEntityForUpdating(TimeAdjustmentFormDto timeAdjustmentFormDto, TimeAdjustmentForm timeAdjustmentForm) { timeAdjustmentForm.IsActive = timeAdjustmentFormDto.IsActive; timeAdjustmentForm.ActualEndDateTime = timeAdjustmentFormDto.ActualEndDateTime; timeAdjustmentForm.ActualStartDateTime = timeAdjustmentFormDto.ActualStartDateTime; timeAdjustmentForm.ZktStartDateTime = timeAdjustmentFormDto.ZktStartDateTime; timeAdjustmentForm.ZktEndDateTime = timeAdjustmentFormDto.ZktEndDateTime; timeAdjustmentForm.EarlyOut = timeAdjustmentFormDto.EarlyOut; timeAdjustmentForm.LateIn = timeAdjustmentFormDto.LateIn; timeAdjustmentForm.MissedClockIn = timeAdjustmentFormDto.MissedClockIn; timeAdjustmentForm.MissedClockOut = timeAdjustmentFormDto.MissedClockOut; timeAdjustmentForm.Notes = timeAdjustmentFormDto.Notes; timeAdjustmentForm.ShiftEndDateTime = timeAdjustmentFormDto.ShiftEndDateTime; timeAdjustmentForm.ShiftLocation = timeAdjustmentFormDto.ShiftLocation; timeAdjustmentForm.ShiftStartDateTime = timeAdjustmentFormDto.ShiftStartDateTime; timeAdjustmentForm.StaffName = timeAdjustmentFormDto.StaffName; timeAdjustmentForm.EmployeeId = timeAdjustmentFormDto.EmployeeId; timeAdjustmentForm.ShiftId = timeAdjustmentFormDto.ShiftId; timeAdjustmentForm.ShiftProfileId = timeAdjustmentFormDto.ShiftProfileId; timeAdjustmentForm.IsManagerApproved = timeAdjustmentFormDto.IsManagerApproved; timeAdjustmentForm.IsAdminApproved = timeAdjustmentFormDto.IsAdminApproved; }
public void SendTimeAdjustmentForm(TimeAdjustmentFormDto timeAdjustmentFormDto) { MailerService.SendTimeAdjustmentEmail(timeAdjustmentFormDto); }