示例#1
0
        public GetTheotokionResponse Get(GetTheotokionRequest request)
        {
            GetTheotokionResponse response = new GetTheotokionResponse();

            try
            {
                TheotokionApp theotokion = _unitOfWork.Repository <TheotokionApp>()
                                           .Get(c => c.Ihos == request.Ihos &&
                                                c.Place == request.Place &&
                                                c.DayOfWeek == request.DayOfWeek);

                YmnosGroup group = new YmnosGroup()
                {
                    Ihos = theotokion.Ihos
                };
                group.Ymnis.Add(theotokion.GetElement(request.Serializer));

                response.BookElement = group;
            }
            catch (Exception ex)
            {
                response.Exception = ex;
            }

            return(response);
        }
示例#2
0
        public override DayElementBase Calculate(RuleHandlerSettings settings)
        {
            YmnosStructure result = null;

            if (!IsValid)
            {
                return(null);
            }

            if (Source == YmnosSource.Irmologion)
            {
                int calcIhos = (ReferenceYmnos.Calculate(settings) as YmnosStructure).Ihos;

                GetTheotokionResponse response = theotokionApp.Get(
                    new GetTheotokionRequest()
                {
                    Place = Place.Value, Ihos = calcIhos, DayOfWeek = settings.Date.DayOfWeek
                });

                if (response.Exception == null && response.BookElement != null)
                {
                    result = new YmnosStructure();
                    result.Theotokion.Add(response.BookElement);
                }
            }
            else
            {
                result = base.Calculate(settings) as YmnosStructure;
            }

            return(result);
        }