Ejemplo n.º 1
0
        private void SetRegistrationNumbers()
        {
            /*
             *  Ring
             *  Grupp
             *  Ras
             *  klass (yngst först)
             *  kön (hane först)
             *  namn (bokstavsordning)
             */

            var regs = Registrations
                       .OrderBy(c => c.Ring)
                       .ThenBy(c => c.CompetitionGroup)
                       .ThenBy(c => c.Breed.ToLower())
                       .ThenBy(c => c.Grouping)
                       .ThenBy(c => c.Sex)
                       .ThenBy(c => c.Group)
                       .ThenBy(c => c.Name);

            var nextNumber = 1;

            foreach (var registration in regs)
            {
                registration.CompetitionNumber = nextNumber;

                nextNumber++;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Initialises the target image, calculating image size based on size of source images and
        ///     adjusting for image offsets.
        /// </summary>
        private Image <Rgba32> NewTargetImage(int minOffset)
        {
            // As we know the horizontal offsets of all images being composed, the output width is the
            // maximum offset plus the width of the final image, minus the minimum offset.
            var finalProjection = Activity !.Registrations.OrderBy(p => p.OffsetX).Last();

            var outputWidth = finalProjection.OffsetX + finalProjection.Width - minOffset;

            return(new Image <Rgba32>(outputWidth, finalProjection.Height));
        }
        private void ApplySort(string sortOrder)
        {
            switch (sortOrder)
            {
            case "registrationDate_desc":
                Registrations = Registrations.OrderBy(x => x.RegistrationDate).ToList();
                break;

            case "UserId":
                Registrations = Registrations.OrderBy(x => x.UserId).ToList();
                break;

            case "userId_desc":
                Registrations = Registrations.OrderByDescending(x => x.UserId).ToList();
                break;

            case "EventId":
                Registrations = Registrations.OrderBy(x => x.EventId).ToList();
                break;

            case "eventId_desc":
                Registrations = Registrations.OrderByDescending(x => x.EventId).ToList();
                break;

            case "EventTypeId":
                Registrations = Registrations.OrderBy(x => x.EventTypeName).ToList();
                break;

            case "eventTypeId_desc":
                Registrations = Registrations.OrderByDescending(x => x.EventTypeName).ToList();
                break;

            default:
                Registrations = Registrations.OrderByDescending(x => x.RegistrationDate).ToList();
                break;
            }
            RegistrationDateSort = String.IsNullOrEmpty(sortOrder) ? "registrationDate_desc" : "";
            UserIdSort           = sortOrder == "UserId" ? "userId_desc" : "UserId";
            EventIdSort          = sortOrder == "EventId" ? "eventId_desc" : "EventId";
            EventTypeSort        = sortOrder == "EventTypeId" ? "eventTypeId_desc" : "EventTypeId";
        }