public UserCollection( BaseClasses.BaseCore owner, string tableName, string databaseProvider, string connectionString, StorageMethodType storageMethod = StorageMethodType.Database ) : base(owner, tableName, databaseProvider, connectionString, true, storageMethod) { }
/// <summary> /// Gets a variable response collection of a variable. /// </summary> /// <param name="idVariable">The id of the variable for the response collection.</param> public BaseCollection <Response> this[Guid idVariable, StorageMethodType xmlStorage = StorageMethodType.Database] { get { // Create a new base collection for the variable's responses. BaseCollection <Response> result = new BaseCollection <Response>( this.Owner, "resp.Var_" + idVariable, false ); result.StorageMethod = xmlStorage; //result.StorageMethod = StorageMethodType.Xml; return(result); } }
public UserCollection(BaseClasses.BaseCore owner, string tableName, StorageMethodType storageMethod = StorageMethodType.Database) : base(owner, tableName, true, storageMethod) { }
public object GetValue(StorageMethodType storageType, string name, bool create = true) { object result = null; string path; switch (storageType) { case StorageMethodType.Database: try { //result = this.Core.Tables[this.Source].GetValue(name, "Id", Guid.Parse(this.GetValue("Id").ToString())); result = this.Core.Tables[this.Source].GetValue(name, this.Path); } catch { result = null; } break; case StorageMethodType.Xml: if (this.XmlNode != null && this.XmlNode.Attributes[name] != null) { result = this.XmlNode.Attributes[name].Value; } else if (this.XmlNode != null) { string source = ""; path = ""; switch (this.TypeName) { case "TaxonomyCategory": case "ScoreGroup": source = "TaxonomyCategories"; break; case "TaxonomyVariable": source = "TaxonomyVariables"; break; case "Category": source = "Categories"; break; case "Variable": source = "Variables"; break; } if (source == "") { return(result); } path = "Id=" + this.GetValue("Id"); string _name = name; if (name.StartsWith("Label")) { _name = "Label"; switch (source) { case "TaxonomyVariables": source = "TaxonomyVariableLabels"; path = "IdTaxonomyVariable=" + this.GetValue("Id"); break; case "TaxonomyCategories": source = "TaxonomyCategoryLabels"; path = "IdTaxonomyCategory=" + this.GetValue("Id"); break; case "Variables": source = "VariableLabels"; path = "IdVariable=" + this.GetValue("Id"); break; case "Categories": source = "CategoryLabels"; path = "IdCategory=" + this.GetValue("Id"); break; } int idLanguage; if (int.TryParse(name.Replace("Label", ""), out idLanguage)) { path += "&IdLanguage=" + idLanguage; } } DefinitionObject score = new DefinitionObject(this.Core, source, path); try { result = score.GetValue(_name, create); } catch { result = null; } SetValue(name, result); } break; } return(result); }