Пример #1
0
    static internal ActivityModel Parse(JsonObject data) {
      var o = new ActivityModel();

      o.ActivityType = data.Get<string>("activityType", o.ActivityType);
      o.ExecutionMode = data.Get<string>("executionMode", o.ExecutionMode);
      o.IsMandatory = data.Get<bool>("isMandatory", o.IsMandatory);
      o.IsController = data.Get<bool>("isController", o.IsController);

      o.DueOnTerm = data.Get<string>("dueOnTerm", o.DueOnTerm);
      o.DueOnTermUnit = data.Get<string>("dueOnTermUnit", o.DueOnTermUnit);
      o.DueOnCondition = data.Get<string>("dueOnCondition", o.DueOnCondition);
      o.DueOnControllerId = data.Get<int>("dueOnController", o.DueOnControllerId);
      o.DueOnRuleAppliesForAllContracts =
                  data.Get<string>("dueOnRuleAppliesForAllContracts", o.DueOnRuleAppliesForAllContracts);

      o.Duration = data.Get<string>("duration", o.Duration);
      o.DurationUnit = data.Get<string>("durationUnit", o.DurationUnit);

      o.EntityId = data.Get<int>("entity", o.EntityId);
      o.ProcedureId = data.Get<int>("procedure", o.ProcedureId);

      o.ContractClause = data.Get<string>("contractClause", o.ContractClause);
      o.LegalBasis = data.Get<string>("legalBasis", o.LegalBasis);

      if (data.HasValue("periodicityRule")) {        o.PeriodicRule = PeriodicRuleData.Parse(data.Slice("periodicityRule"));

        if (data.HasValue("periodicity")) {
          o.PeriodicRule.Notes = data.Get<string>("periodicity");
        }
      } else {
        o.PeriodicRule = PeriodicRuleData.Empty;
      }

      return o;
    }
Пример #2
0
        static private PeriodicRuleData ParseNewDataModel(JsonObject data)
        {
            var o = new PeriodicRuleData();

            o.EachUnit = data.Get <PeriodicRuleUnit>("each/unit");

            if (data.HasValue("each/value"))
            {
                o.EachValue = data.Get <int>("each/value");
            }

            if (data.HasValue("notes"))
            {
                o.Notes = data.Get <string>("notes");
            }

            if (!data.HasValue("dueOn"))
            {
                return(o);
            }

            var dueOnJson = data.Slice("dueOn");

            o.DueOnType = dueOnJson.Get <PeriodicRuleDueOn>("type");

            if (dueOnJson.HasValue("month"))
            {
                o.Month = dueOnJson.Get <int>("month");
            }

            if (dueOnJson.HasValue("day"))
            {
                o.Day = dueOnJson.Get <int>("day");
            }

            if (dueOnJson.HasValue("dayOfWeek"))
            {
                o.DayOfWeek = dueOnJson.Get <int>("dayOfWeek");
            }

            return(o);
        }