public Activity(ActType myType, Day day, TimeSlot timeSlot, Location location, List<Astronaut> astrList, String Desc) { this.myType = myType; this.day = day; this.timeSlot = timeSlot; this.location = location; this.astrList = astrList; this.Desc = Desc; }
public Day checkDayList(Day d) { foreach (Day day in dayList) { if (day.getnDay() == d.getnDay()) { return day; } } return null; }
public static void importPlan(XDocument doc, List<ActType> actTypeList, Mission mission) { foreach (XElement activity in doc.Descendants("Activity")) { int idType = Int32.Parse(activity.Parent.Parent.Attribute("ID").Value); ActType actType = actTypeList[idType - 1]; int d = Int32.Parse(activity.Element("Day").Element("nDay").Value); Day day = new Day(d); Day checkDay = mission.checkDayList(day); if (checkDay == null) { mission.addDay(day); } else { day = checkDay; } int timeslotBegin = Int32.Parse(activity.Element("timeSlot").Element("start").Value); int timeslotEnd = Int32.Parse(activity.Element("timeSlot").Element("end").Value); TimeSlot timeSlot = new TimeSlot(timeslotBegin, timeslotEnd); string locName = activity.Element("Location").Element("Name").Value; int x = Int32.Parse(activity.Descendants("X").FirstOrDefault().Value); int y = Int32.Parse(activity.Descendants("Y").FirstOrDefault().Value); Location location = new Location(locName, new Position(x, y)); Location checkLocation = mission.checkLocationList(location); if (checkLocation == null) { mission.addLocation(location); } else { location = checkLocation; } List<Astronaut> astrList = new List<Astronaut>(); foreach (XElement astronaut in activity.Descendants("Astronaut")) { string astroName = astronaut.Element("Name").Value; Astronaut member = new Astronaut(astroName); Astronaut checkMember = mission.checkAstronaut(member); if (checkMember == null) { mission.addAstronaut(member); } else { member = checkMember; } astrList.Add(member); } string Desc = activity.Element("Desc").Value; Activity act = new Activity(actType, day, timeSlot, location, astrList, Desc); act.update(); } }
public void addDay(Day day) { this.dayList.Add(day); }
public void setDay(Day day) { if (this.day.getnDay() > DateTimeExtension.marsToday) { this.day = day; } }