public List<clsTemplateAttribute> fromJSON(JArray JSONArray)
        {
            List<clsTemplateAttribute> results = new List<clsTemplateAttribute>();

            // loop thorugh all the JSON obects in the JSON array
            foreach (JObject JSONObject in JSONArray)
            {
                clsTemplateAttribute templateAttribute = new clsTemplateAttribute(_db); // create new blank template
                templateAttribute.fromJSON(JSONObject); // load template based on JSON Object
                results.Add(templateAttribute); // add new template to results
            }
            return results;
        }
Exemple #2
0
        public int destroyAll()
        {
            int result = 0;

            // destroy templates
            clsTemplate template = new clsTemplate(db);
            result += template.destroyAll();

            // destroy template attributes
            clsTemplateAttribute templateAttribute = new clsTemplateAttribute(db);
            result += templateAttribute.destroyAll();

            this.map.destroyAll(); // destroy objects and attributes

            return result;
        }
Exemple #3
0
        public new bool fromJSON(JObject JSONObj)
        {
            bool result = base.fromJSON(JSONObj);
            this.id = 0; // the id in JSON is from previous db. clear it.

            // check for templateAtributes
            if (JSONObj["templateAttributes"] != null)
            {
                JArray JSONArray = (JArray)JSONObj["templateAttributes"];

                // convert to template attribute objects
                clsTemplateAttribute templateAttribute = new clsTemplateAttribute(_db);
                _templateAttributes = templateAttribute.fromJSON(JSONArray);

                foreach (clsTemplateAttribute ta in this.templateAttributes)
                {
                    ta.id = 0; // the id in JSON is from previous db. clear it.
                    ta.templateId = 0; // we will not know our template id until was save our template
                }
            }

            return result;
        }