public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { SalaryFrequency Frequency = (SalaryFrequency)value; switch (Frequency) { case SalaryFrequency.DayBeforeLastWorkingDay: writer.WriteValue("DayBeforeLastWorkingDay"); break; case SalaryFrequency.FirstWorkingdayofMonth: writer.WriteValue("FirstWorkingdayofMonth"); break; case SalaryFrequency.FirstXDay: writer.WriteValue("FirstXDay"); break; case SalaryFrequency.LastWorkingDayofMonth: writer.WriteValue("LastWorkingDayofMonth"); break; case SalaryFrequency.LastXDay: writer.WriteValue("LastXDay"); break; case SalaryFrequency.SpecificDayofMonth: writer.WriteValue("SpecificDayofMonth"); break; } }
public IActionResult CalculateNextSalaryDate(SalaryFrequency frequencey, int day, int week, DateTime currentDate) { Calculator.SetCurrentDateTime(currentDate); var Result = Calculator.CalculateNextSalaryDate(new SalaryDateCalculationDto { PaymentFrequency = frequencey, Day = day, Week = week }); return(Ok(new SalaryDateTestModel { CurrentDateTime = currentDate, Day = day, Frequency = frequencey, NextSalaryDateTime = Result, Week = week })); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (StaffGroup != null) { hashCode = hashCode * 59 + StaffGroup.GetHashCode(); } if (Grade != null) { hashCode = hashCode * 59 + Grade.GetHashCode(); } if (_Contract != null) { hashCode = hashCode * 59 + _Contract.GetHashCode(); } if (Payscale != null) { hashCode = hashCode * 59 + Payscale.GetHashCode(); } if (ContractType != null) { hashCode = hashCode * 59 + ContractType.GetHashCode(); } if (ContractedTime != null) { hashCode = hashCode * 59 + ContractedTime.GetHashCode(); } if (DefaultUnavailabilityHours != null) { hashCode = hashCode * 59 + DefaultUnavailabilityHours.GetHashCode(); } hashCode = hashCode * 59 + WtdOptOut.GetHashCode(); if (SalaryFrequency != null) { hashCode = hashCode * 59 + SalaryFrequency.GetHashCode(); } hashCode = hashCode * 59 + SalaryAmount.GetHashCode(); return(hashCode); } }
/// <summary> /// Returns true if Contract instances are equal /// </summary> /// <param name="other">Instance of Contract to be compared</param> /// <returns>Boolean</returns> public bool Equals(Contract other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( StaffGroup == other.StaffGroup || StaffGroup != null && StaffGroup.Equals(other.StaffGroup) ) && ( Grade == other.Grade || Grade != null && Grade.Equals(other.Grade) ) && ( _Contract == other._Contract || _Contract != null && _Contract.Equals(other._Contract) ) && ( Payscale == other.Payscale || Payscale != null && Payscale.Equals(other.Payscale) ) && ( ContractType == other.ContractType || ContractType != null && ContractType.Equals(other.ContractType) ) && ( ContractedTime == other.ContractedTime || ContractedTime != null && ContractedTime.Equals(other.ContractedTime) ) && ( DefaultUnavailabilityHours == other.DefaultUnavailabilityHours || DefaultUnavailabilityHours != null && DefaultUnavailabilityHours.Equals(other.DefaultUnavailabilityHours) ) && ( WtdOptOut == other.WtdOptOut || WtdOptOut.Equals(other.WtdOptOut) ) && ( SalaryFrequency == other.SalaryFrequency || SalaryFrequency != null && SalaryFrequency.Equals(other.SalaryFrequency) ) && ( SalaryAmount == other.SalaryAmount || SalaryAmount.Equals(other.SalaryAmount) )); }