public static Coach Create(CoachView v) { var d = new CoachData(); Copy.Members(v, d); return(new Coach(d)); }
public static Domain.Coach.Coach Create(CoachView view) { var d = new CoachData(); Copy.Members(view, d); return(new Domain.Coach.Coach(d)); }
protected void AssertStandardWorkingHours(CoachData coach) { Assert.That(coach.workingHours, Is.Not.Null); AssertWorkingDay(coach.workingHours.monday); AssertWorkingDay(coach.workingHours.tuesday); AssertWorkingDay(coach.workingHours.wednesday); AssertWorkingDay(coach.workingHours.thursday); AssertWorkingDay(coach.workingHours.friday); AssertNonWorkingDay(coach.workingHours.saturday); AssertNonWorkingDay(coach.workingHours.sunday); }
public void Load(string name) { try { string path = ".\\data\\trains\\resources\\" + name; XmlDocument xml = new XmlDocument(); xml.Load(path + "\\data.xml"); XmlNode root = xml.SelectNodes("enginecoach")[0]; Name = root.SelectNodes("name")[0].InnerText; Maintenance = Convert.ToInt64(root.SelectNodes("maintenance")[0].InnerText); Price = Convert.ToInt64(root.SelectNodes("price")[0].InnerText); Image = System.Drawing.Image.FromFile(path + "\\" + root.SelectNodes("image")[0].InnerText); XmlNode loc = root.SelectNodes("locomotive")[0]; Locomotive = new LocomotiveData() { Speed = Convert.ToDouble(loc.SelectNodes("speed")[0].InnerText), Carrying = Convert.ToInt64(loc.SelectNodes("carrying")[0].InnerText) }; switch (loc.SelectNodes("rank")[0].InnerText.ToLower()) { case "high": Locomotive.Rank = LocomotiveData.LocomotiveRank.HIGH; break; case "default": Locomotive.Rank = LocomotiveData.LocomotiveRank.DEFAULT; break; default: throw new WrongEngineCoachException("rank 데이터가 올바르지 않습니다."); } XmlNode car = root.SelectNodes("coach")[0]; Coach = new CoachData() { Carrying = Convert.ToInt64(car.SelectNodes("carrying")[0].InnerText) }; switch (car.SelectNodes("rank")[0].InnerText.ToLower()) { case "first": Coach.Rank = CoachData.CoachRank.FIRST; break; case "economy": Coach.Rank = CoachData.CoachRank.ECONOMY; break; case "freight": Coach.Rank = CoachData.CoachRank.FREIGHT; break; default: throw new WrongEngineCoachException("rank 데이터가 올바르지 않습니다."); } } catch (Exception ex) { Environment.ReportError(ex, AccessManager.AccessKey); } }
public ActionResult Team(String branchName) { ViewBag.BranchName = branchName = branchName.GetEfficientString(); CoachData model = null; String jsonFile = Startup.MapPath($"~/MainActivity/Portfolio/{branchName}.json"); if (System.IO.File.Exists(jsonFile)) { var jsonData = System.IO.File.ReadAllText(jsonFile); model = JsonConvert.DeserializeObject <CoachData>(jsonData); } if (model == null) { return(Index()); } else { return(View(model)); } }
public List <CoachData> CoachDataList(CoachSearchView input) { var result = new List <CoachData>(); try { //取整包資料 var list = repository.ViewCoachData(input); var coachs = list.Select(c => c.MemberId).Distinct(); CoachData data = new CoachData(); foreach (var coach in coachs) { data = list.Where(c => c.MemberId == coach).Select(c => new CoachData() { MemberId = c.MemberId, ImageName = c.ImageName, Name = c.Name, NickName = c.NickName, Intoduction = c.Intoduction, Email = c.Email }).FirstOrDefault(); data.TrainingProgram = list.Where(c => c.MemberId == coach) .Select(c => c.TrainingProgram).Distinct().ToList(); data.Course = list.Where(c => c.MemberId == coach) .Select(c => c.Course).Distinct().ToList(); data.Area = list.Where(c => c.MemberId == coach) .Select(c => c.Area).Distinct().ToList(); result.Add(data); } } catch (Exception ex) { LogService.LogTxt("CoachDataList例外錯誤" + ex.ToString()); return(null); } return(result); }
public override void TestInitialize() { base.TestInitialize(); trainings = new TestRepository(); entries = new TestTimetableEntriesRepository(); types = new TestTrainingTypesRepository(); coaches = new TestCoachesRepository(); categories = new TestTrainingCategoriesRepository(); locations = new TestLocationsRepository(); trainingData = GetRandom.Object <TrainingData>(); var t = new Training(trainingData); trainings.Add(t).GetAwaiter(); typeData = GetRandom.Object <TrainingTypeData>(); var tt = new TrainingType(typeData); types.Add(tt).GetAwaiter(); locationData = GetRandom.Object <LocationData>(); var l = new Location(locationData); locations.Add(l).GetAwaiter(); coachData = GetRandom.Object <CoachData>(); var c = new Coach(coachData); coaches.Add(c).GetAwaiter(); categoryData = GetRandom.Object <TrainingCategoryData>(); var tc = new TrainingCategory(categoryData); categories.Add(tc).GetAwaiter(); obj = new TestClass(trainings, entries, categories, coaches, types, locations); }
public override void TestInitialize() { base.TestInitialize(); entries = new TestRepository(); trainings = new TestTrainingsRepository(); locations = new TestLocationsRepository(); coaches = new TestCoachesRepository(); types = new TestTrainingTypesRepository(); participants = new TestParticipantsRepository(); clients = new TestClientsRepository(); data = GetRandom.Object <TimetableEntryData>(); var e = new TimetableEntry(data); entries.Add(e).GetAwaiter(); clientData = GetRandom.Object <ClientData>(); var c = new Client(clientData); clients.Add(c).GetAwaiter(); coachData = GetRandom.Object <CoachData>(); var co = new Coach(coachData); coaches.Add(co).GetAwaiter(); trainingData = GetRandom.Object <TrainingData>(); var t = new Training(trainingData); trainings.Add(t).GetAwaiter(); trainingTypeData = GetRandom.Object <TrainingTypeData>(); var tt = new TrainingType(trainingTypeData); types.Add(tt).GetAwaiter(); locationData = GetRandom.Object <LocationData>(); var l = new Location(locationData); locations.Add(l).GetAwaiter(); obj = new TestClass(clients, entries, trainings, locations, types, coaches, participants); }