Пример #1
0
 public static OccasionTypeDTO OccasionTypeToDTO(OccasionType occType)
 {
     return(new OccasionTypeDTO()
     {
         Id = occType.Id, Name = occType.Name
     });
 }
Пример #2
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += Civ != null?Civ.ToLink(link, pov, this) : "UNKNOWN CIV";

            eventString += " held a ";
            if (Schedule != null)
            {
                if (!string.IsNullOrWhiteSpace(Schedule.ItemType) || !string.IsNullOrWhiteSpace(Schedule.ItemSubType))
                {
                    eventString += !string.IsNullOrWhiteSpace(Schedule.ItemSubType) ? Schedule.ItemSubType : Schedule.ItemType;
                    eventString += " ";
                }
            }
            eventString += Schedule?.Type.GetDescription().ToLower() ?? OccasionType.ToString().ToLower();
            if (ReferencedArtForm != null)
            {
                eventString += " of ";
                eventString += ReferencedArtForm.ToLink(link, pov, this);
            }
            else if (Schedule != null && Schedule.Type == ScheduleType.Storytelling && Schedule.Reference != -1)
            {
                WorldEvent worldEvent = World.GetEvent(Schedule.Reference);
                if (worldEvent is IFeatured featured)
                {
                    eventString += " of ";
                    eventString += featured.PrintFeature();
                }
            }
            eventString += " in ";
            eventString += Site != null?Site.ToLink(link, pov, this) : "UNKNOWN SITE";

            eventString += " as part of ";
            eventString += EntityOccasion != null?EntityOccasion.ToLink(link, pov, this) : "UNKNOWN OCCASION";

            eventString += ".";
            if (Schedule != null)
            {
                switch (Schedule.Type)
                {
                case ScheduleType.Procession:
                    Structure startStructure = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference);
                    Structure endStructure   = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference2);
                    if (startStructure != null || endStructure != null)
                    {
                        eventString += " It started at ";
                        eventString += startStructure != null?startStructure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE";

                        eventString += " and ended at ";
                        eventString += endStructure != null?endStructure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE";

                        eventString += ".";
                    }
                    break;
                }
            }
            return(eventString);
        }
Пример #3
0
 public Occasion(OccasionType type,
                 DateTimeOffset bookingTime,
                 LocaleAttributes providerName,
                 LocaleAttributes subject,
                 LocaleAttributes brokerName) : this(type, bookingTime, providerName, subject)
 {
     Broker = new BrokerName(brokerName);
 }
Пример #4
0
        internal static Occasion AddNew(
            DateTime date,
            List <Person> persons,
            string Notes,
            OccasionType type)
        {
            Occasion theNewOccasion = new Occasion();

            return(theNewOccasion);
        }
Пример #5
0
 public Occasion(OccasionType type,
                 DateTimeOffset bookingTime,
                 LocaleAttributes providerName,
                 LocaleAttributes subject)
 {
     Type        = type;
     BookingTime = bookingTime;
     Provider    = new ProviderName(providerName);
     Subject     = subject;
 }
Пример #6
0
 public PhotoAlbum(int Id, OccasionType Occasion, string Title, string Description, Bitmap Photo,
                   ObservableCollection <Person> ListOfPeopleOnPhoto)
 {
     this.Id                  = Id;
     this.Occasion            = Occasion;
     this.Title               = Title;
     this.Description         = Description;
     this.Photo               = Photo;
     this.ListOfPeopleOnPhoto = ListOfPeopleOnPhoto;
     this.addedTime           = addedTime;
 }
 public IHttpActionResult Get()
 {
     try
     {
         return(Ok(OccasionType.Get()));
     }
     catch (Exception e)
     {
         LogManager.LogException(e);
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult Delete([FromBody] int occasionType)
 {
     try
     {
         OccasionType.Delete(occasionType);
         return(Ok());
     }
     catch (Exception e)
     {
         LogManager.LogException(e);
         return(InternalServerError(e));
     }
 }
 [Route("add")] //define the url
 public IHttpActionResult Add([FromBody] OccasionTypeDTO occasionType)
 {
     try
     {
         OccasionType.Add(occasionType);
         return(Ok());
     }
     catch (Exception e)
     {
         LogManager.LogException(e);
         return(InternalServerError(e));
     }
 }
Пример #10
0
        public void ReservationConfirmation()
        {
            OccasionType   type           = OccasionType.Appointment;
            DateTimeOffset bookingTime    = DateTimeOffset.Parse("2018-11-20T19:16:31+00:00");
            var            occasionUpdate = new ReservationConfirmation(ReservationConfirmationStatus.Confirmed,
                                                                        new Occasion(
                                                                            type,
                                                                            bookingTime,
                                                                            new LocaleAttributes("en-GB", "provider"),
                                                                            new LocaleAttributes("en-GB", "subject"),
                                                                            new LocaleAttributes("en-GB", "broker")));

            Assert.True(Utility.CompareJson(occasionUpdate, "ReservationConfirmation.json", "payload.occasion.bookingTime"));
        }
Пример #11
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV";

            eventString += " held a ";
            if (Schedule != null)
            {
                if (!string.IsNullOrWhiteSpace(Schedule.ItemType) || !string.IsNullOrWhiteSpace(Schedule.ItemSubType))
                {
                    eventString += !string.IsNullOrWhiteSpace(Schedule.ItemSubType) ? Schedule.ItemSubType : Schedule.ItemType;
                    eventString += " ";
                }
            }
            eventString += Schedule != null?Schedule.Type.GetDescription().ToLower() : OccasionType.ToString().ToLower();

            if (Schedule != null)
            {
                switch (Schedule.Type)
                {
                case ScheduleType.PoetryRecital:
                    if (Schedule.Reference != -1)
                    {
                        PoeticForm form = World.GetPoeticForm(Schedule.Reference);
                        eventString += " of ";
                        eventString += form != null?form.ToLink(link, pov) : "UNKNOWN POETRICFORM";
                    }
                    break;

                case ScheduleType.MusicalPerformance:
                    if (Schedule.Reference != -1)
                    {
                        MusicalForm form = World.GetMusicalForm(Schedule.Reference);
                        eventString += " of ";
                        eventString += form != null?form.ToLink(link, pov) : "UNKNOWN MUSICALFORM";
                    }
                    break;

                case ScheduleType.DancePerformance:
                    if (Schedule.Reference != -1)
                    {
                        DanceForm form = World.GetDanceForm(Schedule.Reference);
                        eventString += " of ";
                        eventString += form != null?form.ToLink(link, pov) : "UNKNOWN DANCEFORM";
                    }
                    break;

                case ScheduleType.Storytelling:
                    if (Schedule.Reference != -1)
                    {
                        WorldEvent worldEvent = World.GetEvent(Schedule.Reference);
                        if (worldEvent is IFeatured)
                        {
                            eventString += " of ";
                            eventString += worldEvent != null ? ((IFeatured)worldEvent).PrintFeature() : "UNKNOWN EVENT";
                        }
                    }
                    break;
                }
            }
            eventString += " in ";
            eventString += Site != null?Site.ToLink(link, pov) : "UNKNOWN SITE";

            eventString += " as part of ";
            eventString += EntityOccasion != null?EntityOccasion.ToLink(link, pov) : "UNKNOWN OCCASION";

            eventString += ".";
            if (Schedule != null)
            {
                switch (Schedule.Type)
                {
                case ScheduleType.Procession:
                    Structure startStructure = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference);
                    Structure endStructure   = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference2);
                    if (startStructure != null || endStructure != null)
                    {
                        eventString += " It started at ";
                        eventString += startStructure != null?startStructure.ToLink(link, pov) : "UNKNOWN STRUCTURE";

                        eventString += " and ended at ";
                        eventString += endStructure != null?endStructure.ToLink(link, pov) : "UNKNOWN STRUCTURE";

                        eventString += ".";
                    }
                    break;
                }
            }
            return(eventString);
        }