using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common.TaskEnum; namespace WIDESEAWCS_Common.TaskEnum { public static class TaskEnumHelper { public static List GetEnumIndexList(this Type type) { if (type is null) throw new ArgumentNullException("type"); if (!type.IsEnum) return new List(); return Enum.GetValues(type).Cast().ToList(); } public static TaskTypeGroup GetTaskTypeGroup(this int taskType) { if (taskType >= 500 && taskType < 900) { return TaskTypeGroup.InboundGroup; } else if (taskType >= 100 && taskType < 500) { return TaskTypeGroup.OutbondGroup; } else if (taskType >= 900 && taskType < 1000) { return TaskTypeGroup.RelocationGroup; } else { return TaskTypeGroup.OtherGroup; } } } }