Beispiel #1
0
        public override DayElementBase Calculate(RuleHandlerSettings settings)
        {
            Kontakion result = null;

            if (!ThrowExceptionIfInvalid(settings))
            {
                //разбираемся с source
                DayContainer day = GetDayContainer(settings);

                var kontakia = day?.Orthros?.Kontakia;

                //не выдаем ошибки, если день не найден
                if (kontakia != null)
                {
                    //теперь разбираемся с place
                    switch (Place)
                    {
                    case KontakionPlace.orthros1:
                    {
                        result = (kontakia.Count > 0) ? kontakia[0] : null;
                    }
                    break;

                    case KontakionPlace.orthros2:
                    {
                        result = (kontakia.Count > 1) ? kontakia[1] : null;
                    }
                    break;
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
        public static YmnosStructure ToYmnosStructure(this Kontakion kontakion, bool includeIkos = true)
        {
            //конвертируем структуру кондака в YmnosGroup
            YmnosGroup group = new YmnosGroup()
            {
                Annotation = (kontakion.Annotation != null) ? new ItemText(kontakion.Annotation) : null,
                Ihos       = kontakion.Ihos,
                Prosomoion = (kontakion.Prosomoion != null) ? new Prosomoion(kontakion.Prosomoion) : null,
                Ymnis      = new List <Ymnos>()
                {
                    new Ymnos()
                    {
                        Text = kontakion.Ymnos
                    }
                }
            };

            if (includeIkos && kontakion.Ikos != null)
            {
                group.Ymnis.Add(new Ymnos()
                {
                    Text = kontakion.Ikos
                });
            }

            YmnosStructure result = new YmnosStructure();

            result.Groups.Add(group);

            return(result);
        }
        private void AppendKontakion(CreateViewModelRequest <KontakionRule> req, Kontakion kontakion, OutputSectionModel view)
        {
            var viewModel = new OutputSectionModelCollection()
            {
                view
            };

            kontakion.Annotation.AppendViewModel(req.Handler, viewModel);
            kontakion.Prosomoion.AppendViewModel(req.Handler.Settings.TypiconVersionId, Serializer, viewModel);
            kontakion.Ymnos.AppendViewModel(req.Handler, viewModel);

            req.AppendModelAction(viewModel);
        }
        private (OutputSectionModel Kontakion, OutputSectionModel Ikos) GetHeaders(CreateViewModelRequest <KontakionRule> req, Kontakion kontakion)
        {
            var headers = Serializer.GetCommonRuleChildren <TextHolder>(req.Handler.Settings.TypiconVersionId, CommonRuleConstants.Kontakion);

            var viewKontakion = OutputSectionFactory.Create(headers[0], req.Handler.Settings.TypiconVersionId, Serializer);

            viewKontakion.Paragraphs[0].ReplaceForEach(IHOS_STRING, kontakion.Ihos);

            var viewIkos = OutputSectionFactory.Create(headers[1], req.Handler.Settings.TypiconVersionId, Serializer);

            return(viewKontakion, viewIkos);
        }