public AttendanceDuration GetDuarationFrom(decimal minutes, bool isCeiling) { AttendanceDuration duration = new AttendanceDuration(); duration.Unit = AttendanceUnitDescription.GetDescription(this.AttendanceUnit); decimal temp = minutes; if (this.AttendanceUnit == AttendanceUnit.Hour) { temp = temp / 60; } else if (this.AttendanceUnit == AttendanceUnit.WorkDay) { temp = temp / MinutesOfWorkDay; } if (this.MinAttendanceTime > 0) { decimal value = temp / this.MinAttendanceTime; int count = (int)Math.Floor(value); if (value > count && isCeiling) { count++; } duration.Value = count * MinAttendanceTime; } return(duration); }
public AttendanceDuration GetDuarationFrom(decimal minutes, bool isCeiling) { AttendanceDuration duration = new AttendanceDuration(); duration.Unit = AttendanceUnitDescription.GetDescription(this.AttendanceUnit); decimal temp = minutes; if (this.AttendanceUnit == AttendanceUnit.Hour) { temp = temp / 60; } else if (this.AttendanceUnit == AttendanceUnit.WorkDay) { temp = temp / MinutesOfWorkDay; } if (this.MinAttendanceTime > 0) { decimal value = temp / this.MinAttendanceTime; int count = (int)Math.Floor(value); if (value > count && isCeiling) { count++; } duration.Value = count * MinAttendanceTime; } return duration; }