using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Text.Json; using System.Threading.Tasks; namespace Emergency_platform { public class DAY { public List DayOfWeeks(PatrolClass item) { DayOfWeek dayOfWeek; List dayOfWeeks = new List(); var runRule = item.RunRule; string[] days = runRule.Split(','); foreach (var day in days) { switch (day) { case "周一": dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周一"); dayOfWeeks.Add(dayOfWeek); break; case "周二": dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周二"); dayOfWeeks.Add(dayOfWeek); break; case "周三": dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周三"); dayOfWeeks.Add(dayOfWeek); break; case "周四": dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周四"); dayOfWeeks.Add(dayOfWeek); break; case "周五": dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周五"); dayOfWeeks.Add(dayOfWeek); break; case "周六": dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周六"); dayOfWeeks.Add(dayOfWeek); break; case "周日": dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周日"); dayOfWeeks.Add(dayOfWeek); break; } } return dayOfWeeks; } } }