public JsonResult AddClass(NewClassDetails classDetails)
        {
            ShowDetails showDetails = new ShowDetails(classDetails.ShowDetailsId);
            var NewClsId = showDetails.AddClass(classDetails);

            return Json(new
            {
                Status = 0,
                NewClsId
            });
        }
 public JsonResult CopyDay(int showDetailsId, DateTime lastShowDate)
 {
     ShowDetails sd = new ShowDetails(showDetailsId);
     return Json(new
     {
         Status = 0,
         ShowDetailsId = sd.Copy(lastShowDate.AddDays(1)),
         sd.ClassLimit
     });
 }
        public ActionResult Caller(int showId, int showDetailsId, int ringId, int showClassId)
        {
            var tmp = new CallingListModel
            {
                CallingList = new List<DogClassDetails>(),
                QueueList = new List<DogClassDetails>(),
                CourseDetails = new Domain.Managers.ClassManager().GetCourseDetails(showClassId)
            };
            var callingList = new ShowClasses().GetCallingList(showId, showClassId);

            foreach (var item in callingList)
            {
                var us = new UserShows(item.UserId, showId);
                tmp.CallingList.Add(new DogClassDetails
                {
                    ClassId = showClassId,
                    DogId = item.DogId,
                    HandlerType = us.HandlerType,
                    RO = item.Ro,
                    Status = item.Status,
                    HandlerName = Utils.TitleCaseString(item.Name),
                    DogName = Utils.TitleCaseString(item.KcName),
                    Lho = item.Lho,
                    Grade = item.Grade,
                    Veteran = item.Veteran
                });
            }

            var queued = new Fpp.Domain.Managers.QueueManager().GetQueued(showClassId);
            foreach(var item in queued )
            {
                var details = tmp.CallingList.First(x => x.DogId == item.DogId);

                tmp.QueueList.Add(new DogClassDetails {
                    ClassId= showClassId,
                    DogId = item.DogId,
                    RO = details.RO,
                    DogName = details.DogName,
                    HandlerName = details.HandlerName,
                    HandlerType = details.HandlerType,
                    Position = item.Position,
                    Grade = details.Grade,
                    Lho = details.Lho,
                    Veteran = details.Veteran
                });
            }

            var show = new Shows(showId);
            var showDetails = new ShowDetails(showDetailsId);
            var showClass = new ShowClasses(showClassId);
            ViewBag.ShowName = show.ShowName;
            ViewBag.Day = showDetails.ShowDate.ToString("ddd, dd MMM");
            ViewBag.ClassName = showClass.NormalName();
            ViewBag.ClassId = showClassId;
            ViewBag.RingId = ringId;
            ViewBag.ShowId = showId;

            return View(tmp);
        }
        public ActionResult Scoreboard(int showId, int showDetailsId, int showClassId)
        {
            var scoreboard = Fpp.Domain.Managers.ResultsManager.GetResults(showClassId);

            var show = new Shows(showId);
            var showDetails = new ShowDetails(showDetailsId);
            var showClass = new ShowClasses(showClassId);
            ViewBag.ShowName = show.ShowName;
            ViewBag.Day = showDetails.ShowDate.ToString("ddd, dd MMM");
            ViewBag.ClassName = showClass.NormalName();
            ViewBag.ClassId = showClassId;
            ViewBag.ShowId = showId;
            return View(scoreboard);
        }
 public ActionResult RingStatus(string refresh)
 {
     ViewBag.Greetings = _greetingService.GetGreeting();
     int n;
     if (int.TryParse(refresh, out n))
     {
         ViewBag.Refresh = refresh;
     }
     var showMgr = new Domain.Managers.ShowManager();
     var model = new TrailerSheetsModel
     {
         ConfiguredShows = showMgr.GetConfiguredShows(),
     };
     if (model.ConfiguredShows.Any())
     {
         model.Rings = new Domain.Managers.RingManager().GetRings(model.ConfiguredShows.First().ShowDetailsId);
         model.Result = new Fpp.Domain.Managers.ClassManager().GetStatusForClasses(model.ConfiguredShows.First().ShowDetailsId);
     }
     var show = new Shows(model.ConfiguredShows.First().ShowId);
     ViewBag.ShowName = show.ShowName;
     var showDetails = new ShowDetails(model.ConfiguredShows.First().ShowDetailsId);
     ViewBag.Day = showDetails.ShowDate.ToString("ddd, dd MMM");
     return View(model);
 }
        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;
        }
        public RingPlannerForDay(int ShowDetailsId)
        {
            ShowDetails = new ShowDetails(ShowDetailsId);
            RingList = new List<RingDetails>();
            UnallocatedClasses = new List<ClassDetails>();
            UnallocatedHelpers = new List<Helper>();
            UnallocatedJudges = new List<JudgeDetails>();
            var rings = Rings.GetRingsForShowDayList(ShowDetails.ID);

            foreach (var ring in rings)
            {
                RingList.Add(CreateRing(ShowDetails, ring));
            }

            ShowDetails showDetails = new ShowDetails();
            DataRowCollection unallocatedClasses = showDetails.getUnallocatedClassFoDay(ShowDetailsId);
            foreach (DataRow row in unallocatedClasses)
            {
                ShowClasses sc = new ShowClasses(row);
                var Part = Convert.ToInt32(row["Part"]);
                var PartNo = "";
                var ClassName = row["ShortName"].ToString();
                if (sc.EntryType == 10)
                {
                    ClassName = row["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(row),
                        sc.ShortClassName,
                        ClassName);
                }
                else
                {
                    PartNo = (Part == 0 ? "" : string.Format(" Pt {0}", Part));
                    ClassName = string.Format("{0} {1} {2} {3} {4}", ShowClasses.expandHeightShort(row),
                    ShowClasses.expandCatagoryShort(row),
                    ShowClasses.shortenName(row) + PartNo,
                    ClassName,
                    ShowClasses.shortenGrades(row));
                }

                UnallocatedClasses.Add(new ClassDetails
                {
                    ClassId = sc.ID,
                    DogsInClass = Convert.ToInt32(row["DogsInClass"]),
                    ClassNo = sc.ClassNo,
                    ClassName = ClassName,
                    JudgeId = Convert.ToInt32(row["JudgeId"])
                });
            }

            var data = Business.Helpers.GetAllHelpersForShow(ShowDetails.ShowID, "Name", 0);
            var Unallocated = data.Where(x => x.RingNo < 1 && x.ShowDetailsID == ShowDetailsId).OrderBy(z => (int)z.TimePeriod).ToList();
            foreach (var h in Unallocated)
            {
                UnallocatedHelpers.Add(new Helper {
                    HelperId = h.ID,
                    HelperName = h.Name,
                    JobDescription = Fpp.Core.Utils.expandJob(h.Job, h.JobDetails)
                });
            }

            DataSet ds = Judge.GetAllFreeJudgesForShow(ShowDetailsId);
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                UnallocatedJudges.Add(new JudgeDetails()
                {
                    JudgeName = Convert.ToString(row["Name"]),
                    JudgeId = Convert.ToInt32(row["JudgeId"]),
                });
            }
        }
        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;
        }
        public static void AddHelper(int ShowID, int UserID, string HelperName, string [] days, string Comments)
        {
            var helpersList = Helpers.HelperForShow(ShowID, UserID);

            if (helpersList != null)
            {

                User u;
                String helperName;
                if (UserID <= 0)
                {
                    u = new User();
                    helperName = Utils.HTMLToSqlQuote( HelperName);
                }
                else
                {
                    u = new User(UserID);
                    helperName = Utils.HTMLToSqlQuote( u.Name);
                }
                Helpers.DeleteFromShow(ShowID, UserID);
                int tracker;
                foreach (String day in days)
                {
                    tracker = 1;
                    try
                    {
                        //
                        //  24,Saturday,Scrimmer,1/2 AM,49;36,Sunday,Ring Party,All Day,52
                        //
                        String[] jobs = day.Split(',');
                        tracker = 2;
                        int helperShowDetailsID = Convert.ToInt32(jobs[0]);
                        tracker = 3;
                        int helperJudgeID = Convert.ToInt32(jobs[4]);
                        tracker = 4;
                        ShowDetails sd = new ShowDetails(helperShowDetailsID);
                        tracker = 5;
                        Helpers h = new Helpers();
                        tracker = 6;
                        h.Add(ShowID, helperShowDetailsID, u.UserID, helperName, jobs[2] + " " + jobs[3], jobs[1], helperJudgeID, sd.ShowDate, Comments);
                        tracker = 7;
                    }
                    catch (Exception e)
                    {
                        AppException.LogEvent(String.Format("Error:AddHelper {0} {1}, {2} ::{6}:: [{3}] ({4}, {5})", day, ShowID, u.UserID, days, e.Message, e.StackTrace, tracker  ));
                    }
                }
            }
        }
        private void TrailerSheetRing(Document doc, Shows show, ShowDetails showDetails, Rings ring, Judge judge, String ringTemplate, int lastRingNo)
        {
            var trailerColumns = new float[] { 30, 150, 15, 35, 40, 20, 20, 20, 10 };
            var cellHeight = 18;
            var ptable = new PdfPTable(trailerColumns);

            AddCellToHeader(ptable, string.Format("Ring {0}", ring.RingNo));
            AddCellToHeader(ptable, string.Format("{0}", judge.Name));
            AddCellToHeader(ptable, "");
            AddCellToHeader(ptable, "Walking");
            AddCellToHeader(ptable, "Calling up to");
            AddCellToHeader(ptable, "End");
            AddCellToHeader(ptable, "Final");
            AddCellToHeader(ptable, "Closed");
            AddCellToHeader(ptable, "P");
            doc.Add(ptable);
            ptable = new PdfPTable(trailerColumns);

            DataSet classesDS = Rings.GetClassesForRing(ring.ID);
            classesDS = judge.getClassesForJudge();
            var ringTotal = 0;
            PdfPCell cell;
            var altRow = Color.LIGHT_GRAY;
            var topBorderColor = altRow;
            if (classesDS.Tables.Count > 0)
            {
                foreach (DataRow classRow in classesDS.Tables[0].Rows)
                {
                    var cls = new ShowClasses(Convert.ToInt32(classRow["ClassId"]));
                    altRow = altRow == Color.WHITE ? Color.LIGHT_GRAY : Color.WHITE;
                    topBorderColor = Color.BLACK;
                    var part = Convert.ToInt32(classRow["Part"]);
                    cell = new PdfPCell(new Phrase(new Chunk(
                            string.Format("Class {0}", classRow["ClsNo"]), headerHFont)));
                    cell.HorizontalAlignment = Element.ALIGN_LEFT;
                    cell.BackgroundColor = altRow;
                    ptable.AddCell(cell);

                    var lhoTableInd = new PdfPTable(1);

                    int clsHeight = Convert.ToInt32(classRow["Height"]);
                    var className = "";
                    if (clsHeight == 0)
                    {
                        className = string.Format("{0} {1} {2}{3}", classRow["LongName"], classRow["Name"],
                                                         ShowClasses.shortenGrades(classRow)
                                                         , (part > 0 ? " - Pt " + part : ""));
                    }
                    else
                    {
                        className = string.Format("{0} {1} {2} {3} {4}{5}", ShowClasses.expandHeight(classRow),
                                                        ShowClasses.expandCatagory(classRow),
                                                         classRow["LongName"], classRow["Name"],
                                                         ShowClasses.shortenGrades(classRow), (part > 0 ? " - Pt " + part : ""));
                    }

                    if (cls.Lho == 1 || cls.Lho == 2  )
                    {
                        var dcCounts = DogClasses.GetEntryCountsByClassId(show.ID, cls.ID);

                        var innerTable = new PdfPTable(1);
                        var classNameTable = new PdfPTable(2);
                        className = className.Replace("sponsored by", "sp by");
                        classNameTable.AddCell(new PdfPCell(new Phrase(new Chunk(className, headerHFont)))
                        {
                            HorizontalAlignment = Element.ALIGN_LEFT,
                            BackgroundColor = altRow,
                            NoWrap = true,
                            BorderWidth = 0,
                        });
                        classNameTable.AddCell(new PdfPCell(new Phrase(new Chunk(dcCounts[0].Lho == 0 ? "Full Height" : "Lower Height", headerHFont)))
                        {
                            HorizontalAlignment = Element.ALIGN_RIGHT,
                            BackgroundColor = altRow,
                            NoWrap = true,
                            BorderWidth = 0,
                        });
                        innerTable.AddCell(new PdfPCell(classNameTable)
                        {
                            BackgroundColor = altRow,
                            NoWrap = false,
                            BorderWidth = 0,
                            BorderColorBottom = Color.GRAY,
                            BorderWidthBottom = 1
                        });

                        innerTable.AddCell(new PdfPCell(new Phrase(new Chunk((dcCounts[1].Lho == 0 ? "Full Height" : "Lower Height"), headerHFont)))
                        {
                            HorizontalAlignment = Element.ALIGN_RIGHT,
                            PaddingRight = 5,
                            BackgroundColor = altRow,
                            NoWrap = false,
                            BorderWidth = 0,
                        });
                        ptable.AddCell(new PdfPCell(innerTable) { });

                        innerTable = new PdfPTable(1);
                        foreach (var dcc in dcCounts)
                        {
                            innerTable.AddCell(new PdfPCell(new Phrase(new Chunk(string.Format("{0}", dcc.Count), headerHFont)))
                            {
                                HorizontalAlignment = Element.ALIGN_RIGHT,
                                BackgroundColor = altRow,
                                NoWrap = false,
                                BorderWidth = 0,
                                BorderWidthBottom = 1,
                                BorderColorBottom = Color.GRAY
                            });

                        }
                        ptable.AddCell(new PdfPCell(innerTable) { HorizontalAlignment = Element.ALIGN_RIGHT});

                        lhoTableInd.AddCell(new PdfPCell(new Phrase("  ")) { BorderWidth = 0, BorderWidthBottom = 1, BorderColorBottom = Color.GRAY });
                        lhoTableInd.AddCell(new PdfPCell(new Phrase("  ")) { BorderWidth = 0});
                    }
                    else
                    {
                        ptable.AddCell(new PdfPCell(new Phrase(new Chunk(className, headerHFont)))
                        {
                            HorizontalAlignment = Element.ALIGN_LEFT,
                            BackgroundColor = altRow,
                            NoWrap = false
                        });

                        var classTotal = Fpp.Core.Utils.CalcDogsInCalc(classRow);
                        ringTotal += classTotal;
                        cell = new PdfPCell(new Phrase(new Chunk(string.Format("{0, 5}", classTotal), headerHFont)));
                        cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                        cell.BackgroundColor = altRow;
                        ptable.AddCell(cell);
                    }

                    ptable.AddCell(new PdfPCell(lhoTableInd) { BackgroundColor = altRow });
                    ptable.AddCell(new PdfPCell(lhoTableInd) { BackgroundColor = altRow });
                    ptable.AddCell(new PdfPCell(lhoTableInd) { BackgroundColor = altRow });
                    ptable.AddCell(new PdfPCell(lhoTableInd) { BackgroundColor = altRow });
                    ptable.AddCell(new PdfPCell(lhoTableInd) { BackgroundColor = altRow });
                    ptable.AddCell(new PdfPCell(lhoTableInd) { BackgroundColor = altRow });
                }
                cell = new PdfPCell(new Phrase(new Chunk("", headerHFont)));
                cell.FixedHeight = cellHeight;
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase(new Chunk(string.Format("{0}",ringTotal), headerHFont)));
                cell.FixedHeight = cellHeight;
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase(new Chunk("", headerHFont)));
                cell.FixedHeight = cellHeight;
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase(new Chunk("", headerHFont)));
                cell.FixedHeight = cellHeight;
                cell.BorderWidth = 0;
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);
                ptable.AddCell(cell);

                doc.Add(ptable);

            }
        }
        private String generateClassesForDay(int ShowDetailsID, DataTable showDayTable)
        {
            ShowDetails _showDetails = new ShowDetails(ShowDetailsID);

            String res = "<table id='classDetails' style='font-family:Verdana; font-size:16pt;'>";
            String tmp = "";

            String dateThing = getDateOrdinalSuffix(_showDetails.ShowDate.Day);
            tmp += "<tr><td class='classHeader' colspan='5'>" + _showDetails.ShowDate.ToString("dddd MMM d").ToUpper() + dateThing + " CLASSES</td></tr>";
            tmp += "</table>";
            res += tmp;
            //tmp += "<tr><th>Class No</th><th>Class Name</th><th>Classes</th><th>Judge</th></tr>";

            foreach (DataRow row in showDayTable.Rows)
            {
                tmp = "<table border='1'  id='classDetails' style='font-family:Verdana; font-size:10pt;'>";
                tmp += "<tr class='tableItem' >";
                String grades = "";

                grades = "<table class='gradeTable' style='border:dotted 1px #000000'><tr>";
                String str = row["grades"].ToString();
                for (int i = 1; i <= 7; i++)
                {
                    grades += "<td grade='" + i.ToString() + "' >";
                    if (str.IndexOf((char)(i + 48)) > -1)
                    {
                        grades += i.ToString();
                    }
                    grades += "</td>";
                }

                grades += "</tr></table>";

                tmp += String.Format("<td style='width:50px' class='clsno'>{0}</td>", row["ClsNo"]);
                tmp += String.Format("<td class='name'>{0}</td>", row["Name"]);
                tmp += String.Format("<td class='grades'>{0}</td>", grades);
                tmp += String.Format("<td class='judge'>{0}</td>", row["JudgeName"]);

                tmp += "</tr></table>";

                res += tmp;
            }

            return res;
        }
        private void CreateRing(Document doc, Shows show, ShowDetails showDetails, Rings ring, Judge judge, String ringTemplate, int lastRingNo)
        {
            var ptable = new PdfPTable(1);

            var cell = new PdfPCell(new Phrase(new Chunk($"Ring {ring.RingNo}", extremeFont)))
            {
                BorderWidth = 0,
                FixedHeight = 75f,
                HorizontalAlignment = Element.ALIGN_CENTER
            };
            ptable.AddCell(cell);
            cell = new PdfPCell(new Phrase(new Chunk($"{judge.Name}", extremeFont)))
            {
                BorderWidth = 0,
                HorizontalAlignment = Element.ALIGN_CENTER,
                FixedHeight = 75f
            };
            ptable.AddCell(cell);

            cell = new PdfPCell(new Phrase(new Chunk(string.Format("{0}", show.ShowName), bigFont)));
            cell.BorderWidth = 0;
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            ptable.AddCell(cell);

            cell = new PdfPCell(new Phrase(new Chunk(string.Format("{0:dd MMM yyyy}", showDetails.ShowDate), bigFont)));
            cell.BorderWidth = 0;
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            cell.FixedHeight = 75f;
            ptable.AddCell(cell);

            doc.Add(ptable);

            ptable = new PdfPTable(new float[] { 50, 25, 400, 100 });
            DataSet classesDS = Rings.GetClassesForRing(ring.ID);
            classesDS = judge.getClassesForJudge();

            cell = new PdfPCell(new Phrase(new Chunk("Cls No", headerHFont)));
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            cell.BorderWidth = 0;
            ptable.AddCell(cell);
            cell = new PdfPCell(new Phrase(new Chunk("")));
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            cell.BorderWidth = 0;
            ptable.AddCell(cell);
            cell = new PdfPCell(new Phrase(new Chunk("Class Name", headerHFont)));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.BorderWidth = 0;
            ptable.AddCell(cell);
            cell = new PdfPCell(new Phrase(new Chunk("Dogs In Class", headerHFont)));
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            cell.BorderWidth = 0;
            ptable.AddCell(cell);

            if (classesDS.Tables.Count > 0)
            {
                foreach (DataRow classRow in classesDS.Tables[0].Rows)
                {
                    var part = Convert.ToInt32(classRow["Part"]);
                    cell = new PdfPCell(new Phrase(new Chunk(
                            string.Format("{0}", classRow["ClsNo"]), bigFont)));
                    cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);
                    cell = new PdfPCell(new Phrase(new Chunk("")));
                    cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);
                    int clsHeight  = Convert.ToInt32(classRow["Height"]);
                    var partstr = "";
                    if (Convert.ToInt32(classRow["EntryTypeID"]) == 10)
                    {
                        cell = new PdfPCell(new Phrase(new Chunk(
                                string.Format("{0} {1} {2} {3}", ShowClasses.expandHeight(classRow),
                                                         classRow["LongName"], classRow["Name"],
                                                         ShowClasses.shortenGrades(classRow))
                                        , bigSmallFont)));
                    }
                    else
                    {
                        partstr = (part > 0 ? " - Pt " + part : "");
                        if (clsHeight == 0)
                        {
                            cell = new PdfPCell(new Phrase(new Chunk(
                                    string.Format("{0} {1} {2}{3}", classRow["LongName"], classRow["Name"],
                                                             ShowClasses.shortenGrades(classRow)
                                                             , partstr)
                                            , bigSmallFont)));
                        }
                        else
                        {
                            cell = new PdfPCell(new Phrase(new Chunk(
                                    string.Format("{0} {1} {2} {3} {4}{5}", ShowClasses.expandHeight(classRow),
                                                            ShowClasses.expandCatagory(classRow),
                                                             classRow["LongName"], classRow["Name"],
                                                             ShowClasses.shortenGrades(classRow), partstr)
                                            , bigSmallFont)));
                        }
                    }
                    cell.Colspan = 1;
                    cell.HorizontalAlignment = Element.ALIGN_LEFT;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);
                    cell = new PdfPCell(new Phrase(new Chunk(string.Format("{0, 5}", Fpp.Core.Utils.CalcDogsInCalc(classRow)), bigFont)));
                    cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);
                    cell = new PdfPCell(new Phrase(new Chunk("", bigFont)));
                    cell.Colspan = 4;
                    //cell.FixedHeight = 25f;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);
                }
                doc.Add(ptable);
            }
        }
        public StatusCls CreateShow(int orgId, string showName, string ShowDate, int srcId, string closingDate)
        {
            var status = new StatusCls();
            var shows = new Shows();
            status.ShowID = shows.AddShow(orgId, showName, ShowDate);
            var newShow = new Shows(status.ShowID);
            if (!string.IsNullOrEmpty( closingDate ))
            {
                newShow.ClosingDate = DateTime.Parse(closingDate);
                newShow.Save();
            }

            var showDetails = new ShowDetails();
            if (srcId == -1)
            {
                showDetails.AddDay(DateTime.Parse(ShowDate), status.ShowID, 3);
                ShowCharges[] ShowChargesList = {
                                ShowCharges.CreateCharge("Single Entry", 3.00M, status.ShowID),
                                ShowCharges.CreateCharge("Vegas Money", 4.00M, status.ShowID),
                                ShowCharges.CreateCharge("Pairs", 5M, status.ShowID),
                                ShowCharges.CreateCharge("Team", 10M, status.ShowID)
                            };

                ClassTypes.CreateClassType("Agility", "Ag", EntryTypes.Standard, 1, ShowChargesList[0].ID, status.ShowID);
                ClassTypes.CreateClassType("Jumping", "Jmp", EntryTypes.Standard, 1, ShowChargesList[0].ID, status.ShowID);
                ClassTypes.CreateClassType("Money Class", "Money", EntryTypes.Standard, 1, ShowChargesList[1].ID, status.ShowID);
                ClassTypes.CreateClassType("Team", "Tms", EntryTypes.Team, 1, ShowChargesList[3].ID, status.ShowID);
                ClassTypes.CreateClassType("Pairs", "Prs", EntryTypes.Pairs, 1, ShowChargesList[2].ID, status.ShowID);
                ClassTypes.CreateClassType("Veterans", "Vets", EntryTypes.Veterans, 1, ShowChargesList[0].ID, status.ShowID);
                ClassTypes.CreateClassType("Anysize", "Any", EntryTypes.Veterans, 1, ShowChargesList[0].ID, status.ShowID);

                ShowDiscounts.CreateDiscount(DiscountTypes.Member, 5, 5, DateTime.Now, "", ShowChargesList[0].ID, status.ShowID);
                ShowDiscounts.CreateDiscount(DiscountTypes.Member, 4, 2, DateTime.Now, "", 0, status.ShowID);
                ShowDiscounts.CreateDiscount(DiscountTypes.Judge, 5, 5, DateTime.Now, "", ShowChargesList[0].ID, status.ShowID);
                ShowDiscounts.CreateDiscount(DiscountTypes.Judge, 4, 1, DateTime.Now, "", 0, status.ShowID);
                ShowDiscounts.CreateDiscount(DiscountTypes.Fixed, 1, 2.75M, DateTime.Now, "", 0, status.ShowID);
                ShowDiscounts.CreateDiscount(DiscountTypes.TransactionCharge, 1, 0.5M, DateTime.Now, "", 0, status.ShowID);
            }
            else
            {
                var showChargeMap = CreateShowChargeMap(srcId, status.ShowID);
                var classTypesMap = CreateClassTypes(srcId, status.ShowID, showChargeMap);
                var showDiscountMap = CreateDiscountTypes(srcId, status.ShowID, showChargeMap);

                //List<ClassTypes> srcClassTypesList = ClassTypes.GetClassTypesForShow(srcid);
                //List<ShowDiscounts> srcShowDiscountsList = ShowDiscounts.getClassChargeDetails(srcid);
                List<ShowDetails> srcShowDaysList = ShowDetails.GetShowDetails(srcId);

                //DateTime lastShowDate = Convert.ToDateTime(context.Request["lastshowdate"]);
                //lastShowDate = lastShowDate.AddDays(1);
                //ShowDetails sd = new ShowDetails(ShowDetailsID);

                //status.ShowDetailsID = sd.Copy(lastShowDate);
                var showDate = DateTime.Parse(ShowDate);
                foreach (ShowDetails showDay in srcShowDaysList)
                {
                    showDetails.AddDay(showDate, status.ShowID, 3);
                    ShowClasses showClass = new ShowClasses();
                    showClass.BulkCopy(srcId, showDay.ID, showDetails.ID, showChargeMap, classTypesMap, status.ShowID);
                    showDate = showDate.AddDays(1);
                }
                ShowDiscounts.CreateDiscount(DiscountTypes.Fixed, 1, 1M, DateTime.Now, "", 0, status.ShowID);
                ShowDiscounts.CreateDiscount(DiscountTypes.TransactionCharge, 1, 0.5M, DateTime.Now, "", 0, status.ShowID);
            }
            return status;
        }
Ejemplo n.º 14
0
 public DataSet GetHelpersForJudge(ShowDetails showDetails, int judgeId)
 {
     return _ring.GetHelpersForJudge(showDetails.ShowDate.ToString("yyyy-MM-dd"), judgeId);
 }
Ejemplo n.º 15
0
 public static DataSet GetHelpersForRing(ShowDetails showDetails, int RingID)
 {
     String moduleSettings = ModuleConfig.GetSettings();
     Data.Helpers helpr = new Data.Helpers(moduleSettings);
     return helpr.GetHelpersForRing(showDetails.ShowDate.ToString("yyyy-MM-dd"), RingID);
 }
 public JsonResult GetDay(int ShowDetailsId)
 {
     ShowDetails showDetails = new ShowDetails(ShowDetailsId);
     return Json(new
     {
         Status = 0,
         ClsID = ShowClasses.getMaxClassNo(showDetails.ShowID),
         Data = showDetails.GetDay()
     });
 }
        public JsonResult SetClassLimit(int showDetailsId, int classLimit)
        {
            ShowDetails showDetails = new ShowDetails(showDetailsId);
            showDetails.ClassLimit = classLimit;

            return Json(new
            {
                Status = 0
            });
        }
        private void download(HttpContext context, List<int> ids)
        {
            Document doc = new Document(PageSize.A4, -50, -50, 2, 2);
            Stream output;
            output = new MemoryStream();
            var writer = PdfWriter.GetInstance(doc, output);
            StyleSheet sheet = new StyleSheet();

            doc.Open();
            Font font = new Font(Font.COURIER, 10, Font.NORMAL, Color.BLACK);
            Font resFont = new Font(Font.COURIER, 9, Font.ITALIC, Color.BLACK);
            Font headerFont = new Font(Font.COURIER, 10, Font.BOLD, Color.BLACK);
            Font headerFont2 = new Font(Font.HELVETICA, 12, Font.NORMAL, Color.BLACK);
            Font headerFont3 = new Font(Font.HELVETICA, 16, Font.NORMAL, Color.BLACK);
            Font ClassTitleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, Color.BLACK);
            PdfPTable ptable = new PdfPTable(new float[]  { 20, 200, 50});
            PdfPCell cell;
            foreach (int id in ids)
            {
                ptable = new PdfPTable(3);
                var judge = new Judge(id);
                var showDetails = new ShowDetails(judge.ShowDetailsID);
                var user = new User(judge.UserID);

                cell = new PdfPCell(new Phrase(new Chunk("First Place Processing", ClassTitleFont)));
                cell.Border = 0;
                cell.Colspan = 3;
                ptable.AddCell(cell);

                cell = new PdfPCell();
                cell.Border = 0;
                cell.Colspan = 3;
                cell.FixedHeight = 18f;
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase(new Chunk(
                    String.Format("{0}\n{1}\n{2}\n\n{3}",
                        user.Name,
                        user.Address,
                        user.Postcode,
                        user.EmailAddress), headerFont2)));
                cell.Border = 0;
                cell.Colspan = 3;
                ptable.AddCell(cell);

                cell = new PdfPCell(
                    new Phrase(
                            new Chunk(
            string.Format(@"

            Hi,

            This is to confirm the classes you will be judging at our show {0} on the {1:dddd, dd MMMM yyyy}.", show.ShowName, showDetails.ShowDate)
                                    , headerFont2)));
                cell.Border = 0;
                cell.Colspan = 3;
                ptable.AddCell(cell);

                cell = new PdfPCell();
                cell.Border = 0;
                cell.Colspan = 3;
                cell.FixedHeight = 18f;
                ptable.AddCell(cell);

                var classesDS = judge.getClassesForJudge();
                if (classesDS.Tables.Count > 0)
                {
                    var total = 0;
                    foreach (DataRow classRow in classesDS.Tables[0].Rows)
                    {
                        var dic = Utils.CalcDogsInCalc(classRow);
                        cell = new PdfPCell(new Phrase(new Chunk(string.Format("{0,5})",classRow["ClsNo"]) , headerFont2)));
                        cell.Border = 0;
                        cell.Colspan = 1;
                        cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                        ptable.AddCell(cell);

                        var classes = String.Format("{3} {4} {7} {5} {6}  -  {1}\n",
                                        classRow["ClassID"], dic, classRow["ClsNo"], ShowClasses.expandHeight(classRow), ShowClasses.expandCatagory(classRow), classRow["LongName"], classRow["Name"], ShowClasses.shortenGrades(classRow)
                                    );
                        cell = new PdfPCell(new Phrase(new Chunk(classes, headerFont2)));
                        cell.Border = 0;
                        cell.Colspan = 2;
                        ptable.AddCell(cell);

                        total += dic;
                    }
                    cell = new PdfPCell(new Phrase(""));
                    cell.Border = 0;
                    cell.Colspan = 3;
                    cell.FixedHeight = 18f;
                    ptable.AddCell(cell);

                    var totals = String.Format("Totals number of dogs {0}\n", total );

                    cell = new PdfPCell(new Phrase(""));
                    cell.Border = 0;
                    cell.Colspan = 1;
                    ptable.AddCell(cell);

                    cell = new PdfPCell(new Phrase(new Chunk(totals, headerFont3)));
                    cell.Border = 0;
                    cell.Colspan = 2;
                    ptable.AddCell(cell);

                    cell = new PdfPCell(new Phrase(new Chunk(
            @"
            Can I request that if you would like us to set up your course at the show, could you send me your course plan 7 days before the show at the latest? If you do not forward to me I will assume that you wish to set your course yourself or with friends, which is fine.

            If you wish to set your course up yourself then I will just need to know if you require any special or extra equipment at least 10 days before the show. Attached is a full list of equipment supplied in a standard set from First Contact.

            A continental breakfast & lunch will be available for you, your scribe and ring manager.

            If you can supply enough people to man the ring all day we will pay £100, also can you confirm any ring party / full ring party 10 days before the show.

            Many thanks

            Jackie Kenny

            Dog Vegas show secretary", headerFont2)));
                    cell.Border = 0;
                    cell.Colspan = 3;
                    ptable.AddCell(cell);
                }

                doc.Add(ptable);
                doc.NewPage();

            }
            doc.Close();
            context.Response.ClearContent();
            context.Response.ContentType = "application/pdf";
            context.Response.AddHeader("content-disposition", "inline;filename=JudgesClassConfirmation.pdf");
            context.Response.BinaryWrite((output as MemoryStream).ToArray());
        }
        public StatusCls GetEntryForm(int ShowId, int UserId, int handlerType)
        {
            StatusCls status = new StatusCls {
                MultiDogClasses = new List<MultiDogClasses>()
            };
            Shows thisShow = new Shows(ShowId);
            User currentUser = new User(UserId);
            List<ShowClasses> classList = ShowClasses.GetAllClassesForShow(ShowId).Where(sc => sc.Part == 0).ToList();
            var lhoLabel = false;
            var fouthHeightLabel = false;
            if (classList.Any(x => x.Lho > 0))
            {
                lhoLabel = true;
                if (classList.Any(x => x.Lho == 3))
                {
                    lhoLabel = false;
                    fouthHeightLabel = true;
                }
            }

            status.MultiDogClasses = TeamPairsManager.GetTeamPairClasses(ShowId);

            UserShows us = new UserShows(UserId, ShowId);
            //
            // if user entering a new show then set up the handler type, cos that is pasted in
            if (us.ID == -1)
            {
                us.HandlerType = handlerType;
            }
            //
            // add check to see if this person is on the judging list.
            // and there are not a member as members override the judging discounts.
            if (Judge.isJudgeAtShow(UserId, ShowId) && handlerType == 0)
            {
                handlerType = 2;
                us.HandlerType = 2;
            }
            else
            {
                //
                // check if alt handlers are judging
                //
                List<AltHandler> altHList = AltHandler.GetAllAltHandlersList(us.Userid);
                foreach (AltHandler alt in altHList)
                {
                    if (Judge.isJudgeAtShow(alt.AltHandlerID, ShowId))
                    {
                        handlerType = 2;
                        us.HandlerType = 2;
                    }
                }
            }

            Dogs dog = new Dogs();
            List<Dogs> dogs = Dogs.GetAllDogsForHandler(UserId, thisShow.ShowDate);

            String html = $"<input type='hidden' name='handlertype' id='handlertype' value='{us.HandlerType}' />";
            String header = "<div class='dogRow group header'><div class='petName header'>&nbsp;</div>";
            Boolean headerCompleted = false;
            String rowClass = "dogRowAlt";
            foreach (Dogs d in dogs.Where(d => d.Grade > 0 ) )
            {
                String buttons = "";
                DogClasses dc = new DogClasses(d.ID);
                dc.getDogsClasses(ShowId);
                if (d.Grade != 0)
                {
                    buttons = "<div class='buttons'><a href='#tick'><img title='Select All Single Classes' class='tickcross tickimg' src='/Content/Assets/tickv2.png' /></a><a href='#cross'><img title='Clear All Classes' class='tickcross crossimg' src='/Content/Assets/crossv1.png' /></a>";
                    buttons += "</div>";
                    if (lhoLabel)
                    {
                        buttons += @"<div class='lho'><label for='cklho_" + d.ID + "'>Lower height<input type='checkbox' value='1' id='cklho_" + d.ID + "' " + (dc.Lho == 1 ? "checked='checked'" : "") + "   /></label></div>";
                    }
                    if (fouthHeightLabel)
                    {
                        buttons += @"<div class='ext'><label for='cklho_" + d.ID + "'>4th height<input type='checkbox' value='1' id='cklho_" + d.ID + "' " + (dc.Lho == 1 ? "checked='checked'" : "") + "   /></label></div>";
                    }
                    buttons += "<div class='infoText'>Handler:</div>";
                    if (d.AltHandlerID == -1)
                    {
                        buttons += currentUser.Name;
                    }
                    else
                    {
                        User altHandler = new User(d.AltHandlerID);
                        buttons += altHandler.Name;
                    }
                }
                html += String.Format("<div class='{2} group themeBorder-t' dogid='{0}' grade='{4}'><div class='petName'><div class='lbl'>{1}<p class='grade'>{4}</p></div>{3}</div>", d.ID, d.PetName, rowClass, buttons, d.DisplayGrade);
                rowClass = (rowClass == "dogRowAlt" ? "dogRow" : "dogRowAlt");

                String classTable = "";
                String dayName = "";
                String lastDay = "";
                Boolean classesForDog = true;
                foreach (ShowClasses cls in classList)
                {
                    if (dayName != cls.Showdate.ToString("dddd, dd MMM"))
                    {

                        if (dayName != "")
                        {
                            if (!classesForDog)
                            {
                                classTable += String.Format("<div class='clsNo' ><span class='naCls'>n/a</span></div>");
                            }
                            classTable += "</div>";
                        }
                        classesForDog = false;
                        lastDay = dayName;
                        dayName = cls.Showdate.ToString("dddd, dd MMM");

                        ShowDetails showDetails = new ShowDetails(cls.ShowDetailsID);
                        classTable += String.Format("<div class='day' classlimit='{0}'>", showDetails.ClassLimit);

                        if (!headerCompleted)
                        {
                            header += String.Format("<div class='day header' >{0}</div>", dayName);
                        }
                    }

                    //
                    //  cls.EntryType == (int)EntryType.EntryTypes.ABC &&
                    //

                    if (isDogInClass(cls, d))
                    {
                        int otherDogs = 0;
                        int reserves = 0;
                        bool teamName = false;
                        String ticked = "";
                        String altHandlerInfo = "<img class='handler' src='/Content/Assets/AddHandler.png'  width='16' height='14' />";
                        int clsIndex = dc.Classlist.IndexOf(cls.ID);
                        if (clsIndex > -1)
                        {
                            ticked = "tick";
                            if (dc.AltHandlerList[clsIndex] > 0)
                            {
                                User u = new User(dc.AltHandlerList[clsIndex]);
                                altHandlerInfo = "<img class='handler changed' width='16' height='14' src='/Content/Assets/AddHandler.png' data-althandlerid='" + dc.AltHandlerList[clsIndex].ToString() + "' title='Handler:" + u.Name + "' />";
                            }
                        }
                        classesForDog = true;

                        if (otherDogs > 0)
                        {
                            String iconType = "mdSet.png";
                            var multiDogs = "";
                            classTable += String.Format("<div {12} {13} {14} {15} class='clsNo " + ticked + "' classno='{15}' classcount='{11}' clsid='{0}' chargeType='{2}' classType='{3}' entryType='{4}' otherdogs='{5}' reserves='{9}' team='{10}' ><span class='chghandlemenu'>[+]</span>{6}<a class='otherdogs' title='Enter other dogs'><img src='/Content/Assets/{8}' >{7}</img></a><span class='clickable'><img class='tickHolder ' src='/Content/Assets/tickv2.png' /><span class='ah'>*</span><span class='clsname'>{1}</span></span></div>",
                                cls.ID, ShortenName(cls), cls.ChargeType, cls.ClassType, cls.EntryType,
                                otherDogs, altHandlerInfo, multiDogs, iconType, reserves, teamName, cls.ClassCount,
                                cls.Anysize == 1 ? "anysize" : "", cls.Veteran == 1 ? "veteran" : "",  ShowLhoModifier( cls.Lho ), cls.ClassNo, cls.AwardByHeight > 0 ? "AH" : "");

                        }
                        else
                        {
                            if (cls.EntryType == 10)
                            {
                                var hasChampDogsIcon = "mdNotSet.png";
                                var allDetailsCheck = 0;

                                var wins = DogHistory.GetRecordedWins(d.ID);
                                var h = "<span class='wins'>";
                                foreach (var dogH in wins) {
                                    h += string.Format("<span class='champ-wins' data-upgradetype='{4}'  data-winid='{3}'  data-showname='{0}' data-showdate='{1:dd-MM-yy}' data-showclass='{2}'></span>",
                                        dogH.ShowName, dogH.DateOfWin, dogH.ClassWon, dogH.Id, dogH.UpgradeType);
                                    allDetailsCheck += (dogH.ShowName.Length > 0 && dogH.ClassWon.Length > 0) ? 1 : 0;
                                }
                                if (allDetailsCheck == 4)
                                {
                                    hasChampDogsIcon = "mdSet.png";
                                }
                                h += "</span>";
                                classTable += String.Format("<div class='clsNo " + ticked + "' clsid='{0}' chargeType='{2}' classType='{3}' entryType='{4}' classCount='{8}'><span class='chghandlemenu'>[+]</span>{5}<a class='champ-dogs " + (allDetailsCheck == 4 ? " all-wins-entered " : "") + "' href='' title='Enter Your Wins' ><img src='/Content/Assets/{6}' /></a><span class='clickable'><img class='tickHolder ' src='/Content/Assets/tickv2.png' /><span class='clsname'>{1}</span></span>{7}</div>",
                                    cls.ID, ShortenName(cls), cls.ChargeType, cls.ClassType, cls.EntryType, altHandlerInfo, hasChampDogsIcon, h, cls.ClassCount);
                            }
                            else if (cls.EntryType == 11)
                            {
                                var hasJuniorDetails = "mdNotSet.png";
                                var allDetailsCheck = false;

                                var jnr= new Juniors(cls.ID, d.ID);
                                var h = "";
                                if (jnr != null && jnr.ID > 0)
                                {
                                    h += string.Format("<span class='junior-details' data-id='{2}' data-dob='{0:dd-MM-yyyy}' data-ykcnumber='{1}'></span>",
                                                jnr.DoB, jnr.YKCNumber, jnr.ID);
                                    hasJuniorDetails = "mdSet.png";
                                    allDetailsCheck = true;
                                }
                                h += "";
                                classTable += String.Format("<div {9} {10} {11} {12} class='clsNo " + ticked + "' clsid='{0}' chargeType='{2}' classType='{3}' entryType='{4}' classCount='{8}'  ><span class='chghandlemenu'>[+]</span>{5}<a class='ykc " + (allDetailsCheck  ? " all-entered " : "") + "' href='' title='Enter YKC Details' ><img src='/Content/Assets/{6}' /></a><span class='clickable'><img class='tickHolder ' src='/Content/Assets/tickv2.png' /><span class='ah'>*</span><span class='clsname'>{1}</span></span>{7}</div>",
                                    cls.ID, ShortenName(cls), cls.ChargeType, cls.ClassType, cls.EntryType, altHandlerInfo,
                                    hasJuniorDetails, h, cls.ClassCount, cls.Anysize == 1 ? "anysize" : "", cls.Veteran == 1 ? "veteran" : "", ShowLhoModifier(cls.Lho), cls.AwardByHeight > 0 ? "AH" : "");
                            }
                            else
                            {
                                //                                lhoclass = (cls.Lho == 0 && dc.Lho == 1 ? " hidecls ": "");

                                var lhoclass = "";
                                if (cls.Lho == 0 )
                                {
                                    lhoclass = (dc.Lho == 1 ? " hidecls " : "");
                                }
                                else
                                {
                                    if (cls.Lho < 3)
                                    {
                                        lhoclass = ""; // (dc.Lho == 1 ? "" : " hidecls ");
                                    }
                                    else
                                    {
                                        lhoclass = (dc.Lho == 0 ? " hidecls " : "");
                                    }

                                }

                                classTable += String.Format("<div {7} {8} {9} {10}  class='clsNo " + ticked + " " + lhoclass + "' clsid='{0}' chargeType='{2}' classType='{3}' entryType='{4}' classCount='{6}'><span class='chghandlemenu'>[+]</span>{5}<a class='nootherdogs'><img class='nootherdogs' src='/Content/Assets/infov1.png' /></a><span class='clickable'><img class='tickHolder ' src='/Content/Assets/tickv2.png' /><span class='ah'>*</span><span class='clsname'>{1}</span></span></div>",
                                    cls.ID, ShortenName(cls), cls.ChargeType, cls.ClassType, cls.EntryType, altHandlerInfo, cls.ClassCount, cls.Anysize == 1 ? "anysize" : "", cls.Veteran == 1 ? "veteran" : "", ShowLhoModifier(cls.Lho), cls.AwardByHeight > 0 ? "AH" : "");
                            }
                        }
                    }
                }

                headerCompleted = true;
                if (!classesForDog)
                {
                    classTable += String.Format("<div class='clsNo nohover'><span class='naCls'>n/a</span></div>");
                }
                html += classTable + "</div>";
                html += "</div>";
            }

            header += "</div>";

            String showDetailsBox = "";
            showDetailsBox += "<div class='showDetails themeText'>";
            showDetailsBox += "<div class='title'  style=' width: 375px;white-space: nowrap;overflow: hidden;text-overflow: clip;'>" + thisShow.ShowName + "</div>";
            showDetailsBox += "<div class='showdate'>" + thisShow.ShowDate.ToString("dd MMM yyyy") + "</div>";
            showDetailsBox += "</div >";

            showDetailsBox += "<div class='helpBox themeNoticeText themeBorder'>";
            showDetailsBox += "<div><span class='legend themeBackgroundColor'>Help Information</span></div>";
            showDetailsBox += "<div><img src='/Content/Assets/tickv2.png' /><span class='afterImgAdj'> To select all classes</span></div>";
            showDetailsBox += "<div><img src='/Content/Assets/crossv1.png' /><span class='afterImgAdj'>  To unselect all classes</span></div>";
            showDetailsBox += "<div><img src='/Content/Assets/mdNotSet.png' /><span class='afterImgAdj'>  Missing details</span></div>";
            showDetailsBox += "<div><img src='/Content/Assets/mdSet.png' /><span class='afterImgAdj'> All detail entered</span></div>";
            showDetailsBox += "<div><span style='color:#fff;'>[+]</span><span ><span> To Add Handler</span></div>";
            showDetailsBox += "<div><span class='ah' style='color:#fff;display:inline;margin: 0px 7px;top:4px'>*</span><span ><span>Awards By Height</span></div>";
            showDetailsBox += "</div>";

            String totalsBox = "";
            totalsBox += "<div class='totals themeBorder' ><div class='showTotals short themeBackgroundColor themeBorder'>";
            totalsBox += "<div class='clsTypeRow group fulltotal'>";
            totalsBox += "<div class='clsTypePaymentInfo themeBorder-t'></div>";
            totalsBox += "<div class='clsTypeTotal themeBorder-t themeBorder-l'>0.00</div>";
            totalsBox += "</div >";
            totalsBox += "</div>";
            totalsBox += "<div class='ctrlButtons'>";

            if (thisShow.Status == (int)Shows.SHOW_STATUS.PUBLISHED)
            {
                if (us.Status != (int)UserShows.UserStatus.STATUS_ENTERED_NOT_PAID
                    && us.Status != (int)UserShows.UserStatus.STATUS_ENTERED_AND_PAID)
                {
                    totalsBox += "<input type='button' id='btnSaveEntry' value='Save Details' />";
                }
            }

            HttpCookie cookie = HttpContext.Current.Request.Cookies[".FPPAUTH"];
            if (cookie != null)
            {
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);

                String[] lists = ticket.UserData.Split(':');
                int userid = Convert.ToInt32(lists[1]);
                if ((lists[0].Contains("showadmin") && thisShow.Status == (int)Shows.SHOW_STATUS.NOT_PUBLISHED)
                    || thisShow.Status == (int)Shows.SHOW_STATUS.PUBLISHED)
                {
                    totalsBox += "<input type='button' id='btnDoEntry' value='Enter Show' />";
                }
            }

            totalsBox += "<input type='button' id='btnCancel' value='Close' /></div>";
            totalsBox += "</div >";
            status.Status = 0;
            status.UserID = currentUser.ID;
            status.Data = "<input id='ShowID' type='hidden' value='" + ShowId.ToString() + "' /><div class='enterform themeBorder' showid='" + ShowId.ToString() + "'><div class='vscroll'>" + header + "<div class='hscroll'>" + html + "</div></div></div>" + showDetailsBox + totalsBox;
            status.Extra = AltHandler.GetAllAltHandlers(UserId);

            status.TransactionSummaryData = TransactionSummary.getTransactionSummary(ShowId, currentUser.ID);

            status.Camping = new Camping(ShowId);
            status.CampingSummary = UserCamping.GetCampingSummary(ShowId, 0);
            if (!status.CampingSummary.Any())
            {
                for (DateTime dt = status.Camping.Startdate; dt <= status.Camping.Enddate; dt = dt.AddDays(1))
                {
                    status.CampingSummary.Add(new Core.Dto.CampingSummary
                    {
                        CampingDay = dt,
                        Count = 0
                    });
                }
            }
            else
            {
                status.CampingFull = status.CampingSummary.Where(x => x.Count >= status.Camping.Limit).Count() == status.CampingSummary.Count();
            }
            status.PaymentSummary = CreatePaymentSummary(us, false, status.CampingFull);
            if (status.Camping.ID > -1 && !status.CampingFull)
            {
                status.UserCamping = new UserCamping(us.ID);
            }
            status.UserShow = us;

            status.MultiDogEntries = TeamPairsManager.GetTeamPairs(ShowId, UserId, status.MultiDogClasses);

            status.Lho = lhoLabel;
            status.fouthHeight = fouthHeightLabel;

            return status;
        }