static void Main()
    {
        Console.Write("Enter the year of your birth: ");
        int year = Int32.Parse(Console.ReadLine());

        Console.Write("And the month: ");
        int month = Int32.Parse(Console.ReadLine());

        Console.Write("And the day: ");
        int day = Int32.Parse(Console.ReadLine());

        ExtendedDate exdtBirthday = new ExtendedDate(year, month, day);
        ExtendedDate exdtMoonWalk = new ExtendedDate(1969, 7, 20);

        int daysElapsed = exdtMoonWalk.CommonEraDay -
                                exdtBirthday.CommonEraDay;

        if (daysElapsed > 0)
            Console.WriteLine(
                "You were born {0:N0} days before the moon walk.",
                daysElapsed);

        else if (daysElapsed == 0)
            Console.WriteLine(
                "You were born on the day of the moon walk.");

        else
            Console.WriteLine(
                "You were born {0:N0} days after the moon walk.",
                -daysElapsed);
    }
    static void Main()
    {
        ExtendedDate dateMoonWalk = new ExtendedDate(1969, 7, 20);

        Console.WriteLine("Moon walk: {0}, Day of Year: {1}",
            dateMoonWalk, dateMoonWalk.DayOfYear());
    }
        public void MomentumServiceTest_NewMomentum()
        {
            ResourceService         resourceService = new ResourceService(optionsBuilderForResources.Options);
            EFHistoriarumUnitOfWork unitOfWork      = new EFHistoriarumUnitOfWork(optionsBuilderForHistoriarum.Options);
            MomentumService         momentumService = new MomentumService(unitOfWork, resourceService);

            ExtendedDate momentumDate = new ExtendedDate();

            momentumDate.Scale  = Domain.Lookups.TimeScale.DateTime;
            momentumDate.Amount = new DateTime(2017, 8, 25).Ticks;

            string[] keys = { "FIRST_MOMENTUM_SERVICE_TEST" };

            momentumService.CreateMomentum("en-US"
                                           , Domain.Lookups.SourceType.HistoricalFact
                                           , Domain.Lookups.MomentumType.Momentum
                                           , momentumDate
                                           , keys);
        }
Beispiel #4
0
        public void CreateMomentum(string cultureName, SourceType sourceType, MomentumType momentumType, ExtendedDate tempus, string[] resourceKeys)
        {
            Momentum newMomentum = new Momentum();

            newMomentum.SourceType = sourceType;
            newMomentum.Tempus     = tempus;
            newMomentum.Type       = momentumType;
            //newMomentum.Resources = resources;

            List <MomentumResource> resourceList = new List <MomentumResource>();

            foreach (string key in resourceKeys)
            {
                //_resourceService.CreateOrUpdate()
                resourceList.Add(new  MomentumResource()
                {
                    CulturedMediaKey = key
                });
            }

            newMomentum.Resources = resourceList;

            //newMomentum.State = Infrastructure.Domain.Models.EntityState.Added;
            _unitOfWork.MomentumRepository.Add(newMomentum);
            _unitOfWork.Commit();
        }