using PepApi.Core.Models; using PepLib.Models; namespace PepApi.Core { public static class Extensions { public static bool IsNullOrWhiteSpace(this string s) { return string.IsNullOrWhiteSpace(s); } public static bool IsNullOrEmpty(this string s) { return string.IsNullOrEmpty(s); } public static bool IsNaN(this double d) { return double.IsNaN(d); } public static bool IsInfinity(this double d) { return double.IsInfinity(d); } public static bool IsNegativeInfinity(this double d) { return double.IsNegativeInfinity(d); } public static bool IsPositiveInfinity(this double d) { return double.IsPositiveInfinity(d); } public static bool IsEven(this int i) { return i % 2 == 0; } public static bool IsOdd(this int i) { return i % 2 != 0; } public static NestSummary ConvertToNestSummary(this NestInfo nest) { return new NestSummary { Name = nest.Name, DateCreated = nest.DateCreated, DateLastModified = nest.DateLastModified, Status = nest.Status.ToString(), Comments = nest.Comments, Customer = nest.Customer, ProgrammedBy = nest.ProgrammedBy, MaterialNumber = nest.MaterialNumber, MaterialGrade = nest.MaterialGrade, Notes = nest.Notes, HasErrors = !nest.Errors.IsNullOrWhiteSpace(), Revision = nest.UserDefined1, Application = "N/A" }; } } }