Exemplo n.º 1
0
            static public KeyValuePair <IBookIndex, IBookTarget> ComposeTarget(IBookParty party,
                                                                               SymbolName articleName, IBookIndex element, ITargetValues values, IProcessConfig config)
            {
                IBookTarget target = BuildTargetFromElement(element, values, config);

                return(new KeyValuePair <IBookIndex, IBookTarget>(element, target));
            }
Exemplo n.º 2
0
        private TargetStream(IDictionary <IBookIndex, IBookTarget> targets, IBookParty lastParty, IBookIndex lastIndex)
        {
            this.__targets = targets;

            this.__lastParty = lastParty;

            this.__lastIndex = lastIndex;
        }
Exemplo n.º 3
0
        public IList <IResultValues> GetPositionPartySummaryList(IBookParty position, uint summaryCode)
        {
            var resultsList = __results.Where(x => ResultListUtils.IsEqualToPositionParty(position, x.Key) &&
                                              ResultListUtils.SummaryArticlesFilter(x.Value.Article(), summaryCode)).
                              Select(c => c.Value.Values()).ToArray();

            return(resultsList);
        }
Exemplo n.º 4
0
        public static Int32 GetAbsenceHours(IResultStream results, IBookParty position, uint articleCode)
        {
            var resultList = results.GetPositionPartyResultList(position, articleCode);

            var resultValue = resultList.Select(x => x.AbsenceCount()).DefaultIfEmpty(ResultValues.NULL_TIME_COUNTS).FirstOrDefault();

            return(resultValue);
        }
Exemplo n.º 5
0
        public static Int32[] GetShiftTimetable(IResultStream results, IBookParty position, uint articleCode)
        {
            var resultList = results.GetPositionPartyResultList(position, articleCode);

            var resultValue = resultList.Select(x => x.ShiftTimetable()).DefaultIfEmpty(ResultValues.NULL_TIME_TABLE).FirstOrDefault();

            return(resultValue);
        }
Exemplo n.º 6
0
        public bool isEqualToParty(IBookParty other)
        {
            bool equalsContractIndex = this.ContractIndex().Equals(other.ContractIndex());

            bool equalsPositionIndex = this.PositionIndex().Equals(other.PositionIndex());

            return(equalsContractIndex && equalsPositionIndex);
        }
Exemplo n.º 7
0
            static private uint SelectDefault(IEnumerable <IBookIndex> elements, IBookParty party, uint code)
            {
                IEnumerable <IBookIndex> selectedUnits = SelectEquals(elements, party, code);

                IEnumerable <uint> oneCodeOrders = ExtractCodeOrders(selectedUnits);

                return(DefaultOrderFrom(oneCodeOrders.OrderBy(x => x).ToArray()));
            }
Exemplo n.º 8
0
        public IList <IResultValues> GetPositionPartyResultList(IBookParty position, uint articleCode)
        {
            var resultsList = __results.Where(x => ResultListUtils.IsEqualToPositionParty(position, x.Key) &&
                                              x.Key.Code() == articleCode).
                              Select(c => c.Value.Values()).ToArray();

            return(resultsList);
        }
Exemplo n.º 9
0
        public IResultValues GetPositionResult(IBookParty position)
        {
            var resultsList = __results.Where(x => ResultListUtils.IsEqualToPositionArticle(position, x.Key)).
                              Select(c => c.Value.Values()).ToArray();

            var partyResult = resultsList.DefaultIfEmpty(ResultValues.GetEmpty()).FirstOrDefault();

            return(partyResult);
        }
Exemplo n.º 10
0
        public static Int32 GetSumAbsenceTimetable(IResultStream results, IBookParty position, uint articleCode)
        {
            var resultList = results.GetPositionPartyResultList(position, articleCode);

            var resultHours = resultList.Select(x => x.AbsenceTimetable()).DefaultIfEmpty(ResultValues.NULL_TIME_TABLE).FirstOrDefault();

            var resultValue = resultHours.Aggregate(0, (agr, x) => (agr + x));

            return(resultValue);
        }
Exemplo n.º 11
0
            private static IDictionary <IBookIndex, IBookTarget> BuildArticleTarget(
                IDictionary <IBookIndex, IBookTarget> initialStream, IBookParty addParty, IPayrollArticle article,
                ITargetValues addValues, IProcessConfig configModule)
            {
                var results = TargetsTupleComposer.AddTargetBySymbol(initialStream,
                                                                     addParty, article.ArticleSymbol(), addValues, configModule);

                var targets = results.Item2;

                return(targets);
            }
Exemplo n.º 12
0
        private static IBookParty[] GetContractParties(IBookParty[] contractParties, IBookTarget targetToken)
        {
            IBookParty contractParty = targetToken.GetContractParty();

            if (contractParty == null)
            {
                return(contractParties.ToArray());
            }
            var contractPartyArry = new IBookParty[] { contractParty };

            return(contractParties.Concat(contractPartyArry).ToArray());
        }
Exemplo n.º 13
0
        private static IBookParty[] GetPositionParties(IBookParty[] positionParties, IBookTarget targetToken)
        {
            IBookParty posotionParty = targetToken.GetPositionParty();

            if (posotionParty == null)
            {
                return(positionParties.ToArray());
            }
            var contractPartyArry = new IBookParty[] { posotionParty };

            return(positionParties.Concat(contractPartyArry).ToArray());
        }
Exemplo n.º 14
0
        virtual public int CompareTo(object other)
        {
            IBookParty otherParty = other as IBookParty;

            bool equalsContractIndex = this.ContractIndex().Equals(otherParty.ContractIndex());

            if (equalsContractIndex)
            {
                return(this.PositionIndex().CompareTo(otherParty.PositionIndex()));
            }
            return(this.ContractIndex().CompareTo(otherParty.ContractIndex()));
        }
Exemplo n.º 15
0
 public IBookParty[] GetTargetParties(IBookParty emptyNode, IBookParty[] contracts, IBookParty[] positions)
 {
     if (__positionQual == true)
     {
         return(positions);
     }
     if (__contractQual == true)
     {
         return(contracts);
     }
     return(new IBookParty[] { emptyNode });
 }
Exemplo n.º 16
0
        public override bool Equals(object other)
        {
            if (other == this)
            {
                return(true);
            }
            if (other == null || this.GetType() != other.GetType())
            {
                return(false);
            }

            IBookParty otherParty = other as IBookParty;

            return(this.isEqualToParty(otherParty));
        }
Exemplo n.º 17
0
            public static Tuple <IBookIndex, IDictionary <IBookIndex, IBookTarget> > AddTargetBySymbol(
                IDictionary <IBookIndex, IBookTarget> targets,
                IBookParty party, SymbolName articleName, ITargetValues values, IProcessConfig config)
            {
                IBookIndex newIndex = TargetElementBuilder.BuildIndexWithFirst(targets.Keys, party, articleName.Code);

                KeyValuePair <IBookIndex, IBookTarget> pairToMerge = TargetPairComposer
                                                                     .ComposeTarget(party, articleName, newIndex, values, config);

                var targetIndex = pairToMerge.Key;

                var targetValue = pairToMerge.Value;

                var bookTargets = TargetsDictComposer.MergeDictWithTargetPair(targets, targetIndex, targetValue);

                return(Tuple.Create <IBookIndex, IDictionary <IBookIndex, IBookTarget> >(targetIndex, bookTargets));
            }
Exemplo n.º 18
0
 public IBookParty GetTargetParty(IBookParty lastParty)
 {
     if (__positionNode == false && __contractNode == true)
     {
         return(lastParty.GetNonContractParty());
     }
     else if (__positionNode == true)
     {
         return(lastParty.GetNonPositionParty());
     }
     else if (__positionQual == true)
     {
         return(lastParty.GetPositionParty());
     }
     else if (__contractQual == true)
     {
         return(lastParty.GetContractParty());
     }
     return(lastParty.GetNonContractParty());
 }
Exemplo n.º 19
0
        public ITargetStream AddTargetIntoSubLevel(SymbolName article, ITargetValues values, IProcessConfig config)
        {
            uint articleCode = article.Code;

            IPayrollArticle targetArticle = config.FindArticle(articleCode);

            uint conceptCode = targetArticle.ConceptCode();

            IPayrollConcept targetConcept = config.FindConcept(conceptCode);

            IBookParty addParty = targetConcept.GetTargetParty(LastParty());

            var retTuple = TargetsTupleComposer.AddTargetBySymbol(Targets(),
                                                                  addParty, article, values, config);

            var nextFacts = retTuple.Item2;

            var nextIndex = retTuple.Item1;

            var nextParty = targetConcept.GetNextTargetParty(nextIndex);

            return(new TargetStream(nextFacts, nextParty, nextIndex));
        }
Exemplo n.º 20
0
 public static bool IsEqualToPositionParty(IBookParty position, IBookIndex element)
 {
     return(element.ContractIndex().Equals(position.ContractIndex()) &&
            element.PositionIndex().Equals(position.PositionIndex()));
 }
Exemplo n.º 21
0
 static private IEnumerable <IBookIndex> SelectEquals(IEnumerable <IBookIndex> elements, IBookParty party, uint code)
 {
     return(elements.Where(x => (x.isEqualToParty(party) && x.Code() == code)).ToArray());
 }
Exemplo n.º 22
0
 public BookIndex(IBookParty party, uint code, uint codeOrder)
     : base(party.ContractIndex(), party.PositionIndex())
 {
     this.__index = new CodeIndex(code, codeOrder);
 }
Exemplo n.º 23
0
        public static uint GetPositionDayEnds(IResultStream results, IBookParty position)
        {
            var positionResult = results.GetPositionResult(position);

            return(positionResult.PeriodDayEndsOrdinal());
        }
Exemplo n.º 24
0
            static public IBookIndex BuildIndexWithDefault(IEnumerable <IBookIndex> elements, IBookParty party, uint code)
            {
                uint codeOrder = SelectDefault(elements, party, code);

                return(new BookIndex(party, code, codeOrder));
            }