/// <summary> /// Create a user parameter selection instance. /// </summary> public UserParameterSelection() { _factors = new FactorList(true); _hosts = new TaxonList(true); _individualCategories = new IndividualCategoryList(true); _periods = new PeriodList(true); _references = new ReferenceList(true); _taxa = new TaxonList(true); }
/// <summary> /// Add references to the data identifier list. /// </summary> /// <param name='references'>References.</param> public void AddRange(ReferenceList references) { if (references.IsNotEmpty()) { foreach (Reference reference in references) { Add(reference); } } }
/// <summary> /// Private constructor. Makes a clone of a UserParameterSelection. /// </summary> /// <param name="userParameterSelection">UserParameterSelection to clone</param> private UserParameterSelection(UserParameterSelection userParameterSelection) { _factors = new FactorList(true); _factors.AddRange(userParameterSelection.Factors); _hosts = new TaxonList(true); _hosts.AddRange(userParameterSelection.Hosts); _individualCategories = new IndividualCategoryList(true); _individualCategories.AddRange(userParameterSelection.IndividualCategories); _periods = new PeriodList(true); _periods.AddRange(userParameterSelection.Periods); _references = new ReferenceList(true); _references.AddRange(userParameterSelection.References); _taxa = new TaxonList(true); _taxa.AddRange(userParameterSelection.Taxa); }
/// <summary> /// Get all references. /// </summary> /// <param name='refresh'> /// Indicates if data cache should be updated /// with information from the web service. /// </param> /// <returns>All references.</returns> public static ReferenceList GetReferences(Boolean refresh) { ReferenceList references = null; if (refresh) { References = null; } for (Int32 getAttempts = 0; (references.IsNull()) && (getAttempts < 3); getAttempts++) { LoadReferences(); references = References; } return(references); }
/// <summary> /// Get all references that match a search string. /// </summary> /// <param name="searchString">Search string.</param> /// <returns>All references that matches the search string.</returns> public static ReferenceList GetReferences(String searchString) { ReferenceList references = new ReferenceList(); // Get data from web service. references = new ReferenceList(); foreach (WebReference webReference in WebServiceClient.GetReferencesBySearchString(searchString)) { references.Add(new Reference(webReference.Id, webReference.Name, webReference.Year, webReference.Text)); } return(references); }
/// <summary> /// Get all references from web service. /// </summary> private static void LoadReferences() { ReferenceList references; if (References.IsNull()) { // Get data from web service. references = new ReferenceList(true); foreach (WebReference webReference in WebServiceClient.GetReferences()) { references.Add(new Reference(webReference.Id, webReference.Name, webReference.Year, webReference.Text)); } References = references; } }
/// <summary> /// Create a new reference. /// </summary> /// <param name="reference">New reference.</param> public static void CreateReference(Reference reference) { WebReference webReference = new WebReference(); // Check arguments. reference.CheckNotNull("reference"); webReference.Id = 0; #if DATA_SPECIFIED_EXISTS webReference.IdSpecified = true; #endif webReference.Name = reference.Name; webReference.Year = reference.Year; #if DATA_SPECIFIED_EXISTS webReference.YearSpecified = true; #endif webReference.Text = reference.Text; WebServiceClient.CreateReference(webReference); //Make sure that we load new references when we reach LoadReferences References = null; }
/// <summary> /// Refresh cached data. /// </summary> private static void RefreshCache() { References = null; }