Exemplo n.º 1
0
        public IList <HoursClause> GetHoursClauses()
        {
            if (HoursClauses != null)
            {
                return(HoursClauses);
            }

            if (!Declarations.ContainsKey("Hours Clauses") ||
                (Declarations["Hours Clauses"] as object[]).Length == 0)
            {
                return(EMPTYLIST_HOURSCLAUSE);
            }
            HoursClauses =
                new List <HoursClause>((Declarations["Hours Clauses"] as object[]).Length);
            foreach (object _HoursClauseKVP in (Declarations["Hours Clauses"] as object[]))
            {
                Dictionary <string, object> HoursClauseKVP = _HoursClauseKVP as Dictionary <string, object>;
                HashSet <SymbolicValue>     CausesOfLoss   = null;
                if (HoursClauseKVP.ContainsKey("CausesOfLoss"))
                {
                    CausesOfLoss = new HashSet <SymbolicValue>();
                    foreach (string COL in ((string)HoursClauseKVP["CausesOfLoss"]).Split(','))
                    {
                        CausesOfLoss.Add(new SymbolicValue(COL.Trim()));
                    }
                }

                HoursClauses.Add(new HoursClause(int.Parse(HoursClauseKVP["Duration"].ToString()),
                                                 (HoursClause.Unit)Enum.Parse(typeof(HoursClause.Unit),
                                                                              (string)HoursClauseKVP["DurationTimeUnit"]),
                                                 bool.Parse((string)HoursClauseKVP["OnlyOnce"]),
                                                 CausesOfLoss));
            }
            return(HoursClauses);
        }