| | |
| | | |
| | | public static TaskTypeGroup GetTaskTypeGroup(this int taskType) |
| | | { |
| | | if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(taskType.ToString()).ToString(), out int result)) |
| | | { |
| | | return TaskTypeGroup.OutbondGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInStatusEnum>(taskType.ToString()).ToString(), out result)) |
| | | if (taskType >= 500 && taskType < 900) |
| | | { |
| | | return TaskTypeGroup.InboundGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskRelocationTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | else if (taskType >= 100 && taskType < 500) |
| | | { |
| | | return TaskTypeGroup.OutbondGroup; |
| | | } |
| | | else if (taskType >= 900 && taskType < 1000) |
| | | { |
| | | return TaskTypeGroup.RelocationGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | { |
| | | else |
| | | { |
| | | return TaskTypeGroup.OtherGroup; |
| | | } |
| | | else |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | } |
| | | |
| | | public static int GetNextNotCompletedStatus<T>(this int currentStatus) where T : Enum |
| | | { |
| | | Type type = typeof(T); |
| | | if (type is null) throw new ArgumentNullException(); |
| | | if (!type.IsEnum) return 0; |
| | | if (type == typeof(TaskInStatusEnum)) |
| | | { |
| | | List<int> taskInboundTypes = type.GetEnumIndexList(); |
| | | return taskInboundTypes.Where(x => x > currentStatus && x < (int)TaskInStatusEnum.InFinish).OrderBy(x => x).FirstOrDefault(); |
| | | } |
| | | else if (type == typeof(TaskOutStatusEnum)) |
| | | { |
| | | return type.GetEnumIndexList().Where(x => x > currentStatus && x < (int)TaskOutStatusEnum.OutFinish).OrderBy(x => x).FirstOrDefault(); |
| | | } |
| | | else |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | } |
| | | } |