private Models.RingDetails CreateRing(ShowDetails day, Rings ring) { RingDetails rd = new RingDetails { RingId = ring.ID, RingNo = ring.RingNo, JudgeDetails = new List<JudgeDetails>(), ShowDetailsId = ring.ShowDetailsID }; DataSet judgesDS = Rings.GetJudgesForRing(ring.ID); if (judgesDS.Tables[0].Rows.Count > 0) { foreach (DataRow judgeRow in judgesDS.Tables[0].Rows) { Judge judge = new Judge(judgeRow); var judgeDetails = new JudgeDetails { JudgeId = judge.ID, JudgeName = judge.Name, RingOrder = judge.RingOrder, ClassDetails = new List<ClassDetails>(), HelperDetails = new List<Helper>() }; var helperDS = Business.Helpers.GetHelpersForRing(day, ring.ID); if (helperDS.Tables.Count > 0) { foreach (DataRow helperRow in helperDS.Tables[0].Rows) { Business.Helpers h = new Business.Helpers(helperRow); String job = Fpp.Core.Utils.expandJob(h.Job, h.JobDetails); Helper hd = new Helper { HelperId = h.ID, HelperName = h.Name, JobDescription = Business.Helpers.expandHelper(h) }; judgeDetails.HelperDetails.Add(hd); } } DataSet classesDS = judge.getClassesForJudge(); if (classesDS.Tables.Count > 0) { foreach (DataRow classRow in classesDS.Tables[0].Rows) { ShowClasses sc = new ShowClasses(classRow); var Part = Convert.ToInt32(classRow["Part"]); var PartNo = ""; var ClassName = classRow["ShortName"].ToString(); if (sc.EntryType == 10) { ClassName = classRow["Name"].ToString(); if (ClassName.Contains("Jumping")) ClassName = "Jumping"; else if (ClassName.Contains("Agility")) ClassName = "Agility"; else if (ClassName.Contains("Final")) ClassName = "Final"; ClassName = string.Format("{0} {1} {2}", ShowClasses.expandHeightShort(classRow), sc.ShortClassName, ClassName); } else { PartNo = (Part == 0 ? "" : string.Format("Pt {0}", Part)); ClassName = string.Format("{0} {1} {2} {3} {4} {5}", ShowClasses.expandHeightShort(classRow), ShowClasses.expandCatagoryShort(classRow), ClassName, ShowClasses.shortenName(classRow), ShowClasses.shortenGrades(classRow), PartNo); } judgeDetails.ClassDetails.Add(new ClassDetails { ClassId = sc.ID, ClassNo = sc.ClassNo, PartNo = Part, DogsInClass = Fpp.Core.Utils.CalcDogsInCalc(classRow), ClassName = ClassName, Height = sc.Height }); } } rd.JudgeDetails.Add(judgeDetails); } } return rd; }
private Models.RingDetails CreateRing(ShowDetails day, Rings ring) { RingDetails rd = new RingDetails { JudgeDetails = new List<JudgeDetails>(), ShowDetailsId = ring.ShowDetailsID }; DataSet judgesDS = Rings.GetJudgesForRing(ring.ID); if (judgesDS.Tables[0].Rows.Count > 0) { foreach (DataRow judgeRow in judgesDS.Tables[0].Rows) { Judge judge = new Judge(judgeRow); var judgeDetails = new JudgeDetails { JudgeId = judge.ID, JudgeName = judge.Name, ClassDetails = new List<ClassDetails>(), HelperDetails = new List<Helper>() }; var helperDs = Business.Helpers.GetHelpersForRing(day, ring.ID); if (helperDs.Tables.Count > 0) { foreach (DataRow helperRow in helperDs.Tables[0].Rows) { var h = new Business.Helpers(helperRow); var hd = new Helper { HelperId = h.ID, HelperName = h.Name, JobDescription = h.Job }; judgeDetails.HelperDetails.Add(hd); } } DataSet classesDS = Rings.GetClassesForRing(ring.ID); classesDS = judge.getClassesForJudge(); if (classesDS.Tables.Count > 0) { foreach (DataRow classRow in classesDS.Tables[0].Rows) { ShowClasses sc = new ShowClasses(classRow); judgeDetails.ClassDetails.Add(new ClassDetails { ClassId = sc.ID, ClassNo = sc.ClassNo, DogsInClass = Fpp.Core.Utils.CalcDogsInCalc(classRow), ClassName = $"{ShowClasses.expandHeightShort(classRow)} {ShowClasses.expandCatagoryShort(classRow)} {classRow["ShortName"]} {classRow["Name"]} {ShowClasses.shortenGrades(classRow)}" }); } } rd.JudgeDetails.Add(judgeDetails); } } return rd; }