public void ProcessRequest(HttpContext context)
        {
            int id = Convert.ToInt32(context.Request["showid"]);
            Shows show = new Shows(id);
            var sw = new StringWriter();
            sw.WriteLine($"Class Sizes for {show.ShowName} ");

            context.Response.ClearContent();
            context.Response.ContentType = "text/csv";
            context.Response.AddHeader("content-disposition", $"inline;filename=Helpers-{show.ShowDate:ddMMMyyyy}.csv");

            var hl = new HelperModel
            {
                ShowId = id,
                SortType = "Name",
                Direction = 0
            };
            var data = Business.Helpers.GetAllHelpersForShow(id, hl.SortType, hl.Direction);
            hl.ShowDays = ShowDetails.GetShowDetails(id);

            hl.Unallocated = data.Where(x => x.RingNo < 1).OrderBy(z => (int)z.TimePeriod).ToList();
            hl.Allocated = data.Where(x => x.RingNo >= 1).OrderBy(y => y.RingNo).ToList();

            hl.Rings = Rings.GetAllRingsForShow(id);
            hl.Show = new Shows(id);

            sw.WriteLine("Unallocated Helpers");
            sw.WriteLine("Show Date, Helper Name, Time, Job Name, Judge Name, Comments");
            foreach (var showDay in hl.ShowDays)
            {
                foreach (var item in hl.Unallocated.Where(x => x.ShowDetailsID == showDay.ID).ToList())
                {
                    sw.WriteLine(string.Format("{0:ddd, dd MMM},{6},{1},{2},{3},{4},{5}",
                        showDay.ShowDate,
                        item.Name, item.TimePeriod, item.JobName, item.JudgeName, item.Comments, (item.HandlerType == 1 ? "M" : "")
                    ));
                }
            }
            sw.WriteLine("");
            sw.WriteLine("Allocated Helpers");
            sw.WriteLine("Show Date, Ring No, Helper Name, Time Allocated, Time Period, Job Name, Judge Name, Comments");
            foreach (var showDay in hl.ShowDays)
            {
                foreach (var item in hl.Allocated.Where( x=> x.ShowDetailsID == showDay.ID).ToList())
                {
                    sw.WriteLine(string.Format("{0:ddd, dd MMM},{1},{2},{3},{4},{5},{6},{7},{8}",
                        showDay.ShowDate,
                        (item.HandlerType == 1 ? "M" : ""),
                        item.RingNo,
                        item.Name, item.TimeAllocated, item.TimePeriod, item.JobName, item.JudgeName, item.Comments
                    ));
                }
            }

            context.Response.Write(sw);
            context.Response.End();
        }
        public void ProcessRequest(HttpContext context)
        {
            var id = Convert.ToInt32(context.Request["showid"]);
            var show = new Shows(id);
            var sw = new StringWriter();
            sw.WriteLine($"Class Sizes for {show.ShowName} ");

            context.Response.ClearContent();
            context.Response.ContentType = "text/csv";
            context.Response.AddHeader("content-disposition",
                $"inline;filename=PairsTeamsTrio-{show.ShowDate:ddMMMyyyy}.csv");

            var hl = new HelperModel();
            hl.ShowId = id;
            hl.SortType = "Name";
            hl.Direction = 0;
            List<Business.MultiDogClasses> MultiDogClasses = TeamPairsManager.GetTeamPairClasses(id);
            var MultiDogEntries =  TeamPairsManager.GetTeamPairsForShow(id, MultiDogClasses);

            sw.WriteLine("Class No, RO, Team Name, Team Captain, Dog 1, Handler 1, Dog 2, Handler 2, Dog 3, Handler 3, Dog 4, Handler 4, Dog 5, Handler 5, Dog 6, Handler 6");
            foreach (var item in MultiDogEntries.OrderBy(x => x.ClassNo).ThenBy(x => x.RO))
            {
                //foreach (var ii in item)
                //{
            //                    var tp = MultiDog.GetPairTeamsDetails(id, ii.HandlerId);

                    var p1 = string.Format("{0},{1},", item.ClassNo, item.RO);
                    var p4 = string.Format("{0},{1},", item.TeamDetails.TeamName.Replace("&#39;","'"), item.TeamDetails.Captain );
            //                    var p2 = string.Format("{0},{1},{2},", ii.DogName, ii.HandlerName, Dogs.GetDogHeight( ii.Height));
                    var p3 = "";
                    foreach (var tpt in item.Members)
                    {
                        p3 += string.Format("{0},{1},", tpt.DogName, tpt.HandlerName);
                    }
                    sw.WriteLine(p1+p4+p3);
                //}

            }

            sw.WriteLine("");

            context.Response.Write(sw);
            context.Response.End();
        }
        public ActionResult Helpers(int id)
        {
            var hl = new HelperModel();
            hl.ShowId = id;
            hl.SortType = "Name";
            hl.Direction = 0;
            var data = Business.Helpers.GetAllHelpersForShow(id, hl.SortType, hl.Direction);
            hl.ShowDays = Business.ShowDetails.GetShowDetails(id);

            hl.Unallocated = data.Where(x => x.RingNo < 1).OrderBy(z => (int)z.TimePeriod).ToList();
            hl.Allocated = data.Where(x => x.RingNo >= 1).OrderBy(y => y.RingNo).ToList();

            hl.Rings = Rings.GetAllRingsForShow(id);
            hl.Show = new Shows(id);

            return View(hl);
        }