Disco.Services.JobActionExtensions.CanCloseNormallyInternal C# (CSharp) Method

CanCloseNormallyInternal() private static method

private static CanCloseNormallyInternal ( this j ) : bool
j this
return bool
        private static bool CanCloseNormallyInternal(this Job j)
        {
            switch (j.JobTypeId)
            {
                case JobType.JobTypeIds.HWar:

                    if (!string.IsNullOrEmpty(j.JobMetaWarranty.ExternalReference) && !j.JobMetaWarranty.ExternalCompletedDate.HasValue)
                        return false; // Job Logged (Warranty) but not completed

                    break;
                case JobType.JobTypeIds.HNWar:

                    if (j.JobMetaNonWarranty.RepairerLoggedDate.HasValue && !j.JobMetaNonWarranty.RepairerCompletedDate.HasValue)
                        return false; // Job Logged (Repair) but not completed

                    if (j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue && !j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue)
                        return false; // Accounting Charge Required, but not added

                    if ((j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue || j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue) && !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue)
                        return false; // Accounting Charge Required or Added, but not paid

                    if (j.JobMetaNonWarranty.IsInsuranceClaim && !j.JobMetaInsurance.ClaimFormSentDate.HasValue)
                        return false; // Is Insurance Claim, but claim form not sent

                    break;
            }

            return true;
        }