Example #1
0
        public int CompareTo(Questionaires other)
        {
            var serverQuestionaires = other;

            //compare questionaire
            foreach (var qn in _questionaires)
            {
                var inQuestionaire = serverQuestionaires.ByKey(qn.Key);
                var exists         = inQuestionaire != null;
                if (exists)
                {
                    //compare questionaire
                    var different = inQuestionaire.CompareTo(qn) == 0;
                    if (different)
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            return(0);
        }
Example #2
0
        public override void ReadJson(JObject obj)
        {
            base.ReadJson(obj);

            if (obj["CreatedBy"] != null && ((JValue)obj["CreatedBy"]).Value != null)
            {
                CreatedBy = ((JValue)obj["CreatedBy"]).Value.ToString();
            }

            if (obj["Name"] != null && ((JValue)obj["Name"]).Value != null)
            {
                Name = ((JValue)obj["Name"]).Value.ToString();
            }

            Questionaires.Clear();
            Questionaires.ReadJson(obj);
        }
Example #3
0
        public DatabaseQueries GenerateDatabase(DataProviders provider, Questionaires importedDataObjects = null)
        {
            DatabaseQueries queries = new DatabaseQueries();

            if (importedDataObjects == null)
            {
                foreach (Questionaire dataObject in _questionaires)
                {
                    queries.Append(dataObject.GenerateDatabase(provider));
                }
            }
            else
            {
                //first drop
                DataCollectionObject configObj = null;

                foreach (Questionaire form in importedDataObjects)
                {
                    configObj = ByKey(form.Key);
                    if (configObj == null)
                    {
                        //drop it
                        queries.Append(form.DropTable());
                    }
                }


                ////first check the cached config and add a data object thats missing
                foreach (DataCollectionObject form in _questionaires)
                {
                    var importedDataObject = importedDataObjects.ByKey(form.Key);
                    if (importedDataObject == null)
                    {
                        queries.Append(form.GenerateDatabase(provider));
                    }
                }
            }
            return(queries);
        }
Example #4
0
 public Category(DCAnalyticsObject parent) : base(parent)
 {
     Questionaires = new Questionaires();
 }
Example #5
0
 public Category()
 {
     Questionaires = new Questionaires();
 }