public void TestInitialize() { _xsdFile = Helpers.XsdFolder + "UBL-Catalogue-2.1.xsd"; var exampleFile = Helpers.ExampleFolder + "UBL-Catalogue-2.1-Example.xml"; _document = UblDocumentLoader <CatalogueType> .GetDocument(exampleFile); }
/// <summary> /// Creates a single runtime instance of the Catalogue based on the current state of the row read from the DbDataReader (does not advance the reader) /// </summary> /// <param name="repository"></param> /// <param name="r"></param> internal Catalogue(ICatalogueRepository repository, DbDataReader r) : base(repository, r) { if (r["LoadMetadata_ID"] != DBNull.Value) { LoadMetadata_ID = int.Parse(r["LoadMetadata_ID"].ToString()); } Acronym = r["Acronym"].ToString(); Name = r["Name"].ToString(); Description = r["Description"].ToString(); //detailed info url with support for invalid urls Detail_Page_URL = ParseUrl(r, "Detail_Page_URL"); LoggingDataTask = r["LoggingDataTask"] as string; if (r["LiveLoggingServer_ID"] == DBNull.Value) { LiveLoggingServer_ID = null; } else { LiveLoggingServer_ID = (int)r["LiveLoggingServer_ID"]; } ////Type - with handling for invalid enum values listed in database object type = r["Type"]; if (type == null || type == DBNull.Value) { Type = CatalogueType.Unknown; } else { CatalogueType typeAsEnum; if (CatalogueType.TryParse(type.ToString(), true, out typeAsEnum)) { Type = typeAsEnum; } else { throw new Exception(" r[\"Type\"] had value " + type + " which is not contained in Enum CatalogueType"); } } //Periodicity - with handling for invalid enum values listed in database object periodicity = r["Periodicity"]; if (periodicity == null || periodicity == DBNull.Value) { Periodicity = CataloguePeriodicity.Unknown; } else { CataloguePeriodicity periodicityAsEnum; if (CataloguePeriodicity.TryParse(periodicity.ToString(), true, out periodicityAsEnum)) { Periodicity = periodicityAsEnum; } else { throw new Exception(" r[\"Periodicity\"] had value " + periodicity + " which is not contained in Enum CataloguePeriodicity"); } } object granularity = r["Granularity"]; if (granularity == null || granularity == DBNull.Value) { Granularity = CatalogueGranularity.Unknown; } else { CatalogueGranularity granularityAsEnum; if (CatalogueGranularity.TryParse(granularity.ToString(), true, out granularityAsEnum)) { Granularity = granularityAsEnum; } else { throw new Exception(" r[\"granularity\"] had value " + granularity + " which is not contained in Enum CatalogueGranularity"); } } Geographical_coverage = r["Geographical_coverage"].ToString(); Background_summary = r["Background_summary"].ToString(); Search_keywords = r["Search_keywords"].ToString(); Update_freq = r["Update_freq"].ToString(); Update_sched = r["Update_sched"].ToString(); Time_coverage = r["Time_coverage"].ToString(); SubjectNumbers = r["SubjectNumbers"].ToString(); object dt = r["Last_revision_date"]; if (dt == null || dt == DBNull.Value) { Last_revision_date = null; } else { Last_revision_date = (DateTime)dt; } Contact_details = r["Contact_details"].ToString(); Resource_owner = r["Resource_owner"].ToString(); Attribution_citation = r["Attribution_citation"].ToString(); Access_options = r["Access_options"].ToString(); Country_of_origin = r["Country_of_origin"].ToString(); Data_standards = r["Data_standards"].ToString(); Administrative_contact_name = r["Administrative_contact_name"].ToString(); Administrative_contact_email = r["Administrative_contact_email"].ToString(); Administrative_contact_telephone = r["Administrative_contact_telephone"].ToString(); Administrative_contact_address = r["Administrative_contact_address"].ToString(); Ethics_approver = r["Ethics_approver"].ToString(); Source_of_data_collection = r["Source_of_data_collection"].ToString(); if (r["Explicit_consent"] != null && r["Explicit_consent"] != DBNull.Value) { Explicit_consent = (bool)r["Explicit_consent"]; } TimeCoverage_ExtractionInformation_ID = ObjectToNullableInt(r["TimeCoverage_ExtractionInformation_ID"]); PivotCategory_ExtractionInformation_ID = ObjectToNullableInt(r["PivotCategory_ExtractionInformation_ID"]); object oDatasetStartDate = r["DatasetStartDate"]; if (oDatasetStartDate == null || oDatasetStartDate == DBNull.Value) { DatasetStartDate = null; } else { DatasetStartDate = (DateTime)oDatasetStartDate; } ValidatorXML = r["ValidatorXML"] as string; Ticket = r["Ticket"] as string; //detailed info url with support for invalid urls API_access_URL = ParseUrl(r, "API_access_URL"); Browse_URL = ParseUrl(r, "Browse_URL"); Bulk_Download_URL = ParseUrl(r, "Bulk_Download_URL"); Query_tool_URL = ParseUrl(r, "Query_tool_URL"); Source_URL = ParseUrl(r, "Source_URL"); IsDeprecated = (bool)r["IsDeprecated"]; IsInternalDataset = (bool)r["IsInternalDataset"]; IsColdStorageDataset = (bool)r["IsColdStorageDataset"]; Folder = new CatalogueFolder(this, r["Folder"].ToString()); ClearAllInjections(); }
public bool IsValid(CatalogueType catalogueType) { return (catalogueType == CatalogueType.Standard); }
public bool IsValid(CatalogueType catalogueType) { return (catalogueType == CatalogueType.OnSale); }
public bool IsValid(CatalogueType catalogueType) { return (catalogueType == CatalogueType.New); }
private ActionResult SendToView(string categoryDescription, int categoryId, Int16 pageNumber, CatalogueType catalogueType) { currentSelection.MenuIndex = GetCategoryIdByDescription(categoryDescription); Category parentCaregory = hopeLingerieEntities.Categories.FirstOrDefault(x => x.CategoryId == categoryId && x.Active); currentSelection.RootCategory = hopeLingerieEntities.Categories.FirstOrDefault(x => x.CategoryId == categoryId); currentSelection.PageNumber = pageNumber; currentSelection.CategoriesMenu = hopeLingerieEntities.Categories.Where(x => x.ParentCategoryId == null && x.Active).OrderBy(x => x.DisplayOrder).ToList(); currentSelection.Action = categoryDescription; IExecuter[] executers = { new OnSale(), new IsNew(), new Standard() }; IExecuter executer = executers.First(x => x.IsValid(catalogueType)); currentSelection.Products = executer.DoQuery().ToList(); PrepareNavigationSettings(parentCaregory); return View(executer.PickView(), currentSelection); }
public bool IsValid(CatalogueType catalogueType) { return(catalogueType == CatalogueType.Standard); }
public bool IsValid(CatalogueType catalogueType) { return(catalogueType == CatalogueType.New); }
public bool IsValid(CatalogueType catalogueType) { return(catalogueType == CatalogueType.OnSale); }
private ActionResult SendToView(string categoryDescription, int categoryId, Int16 pageNumber, CatalogueType catalogueType) { currentSelection.MenuIndex = GetCategoryIdByDescription(categoryDescription); Category parentCaregory = hopeLingerieEntities.Categories.FirstOrDefault(x => x.CategoryId == categoryId && x.Active); currentSelection.RootCategory = hopeLingerieEntities.Categories.FirstOrDefault(x => x.CategoryId == categoryId); currentSelection.PageNumber = pageNumber; currentSelection.CategoriesMenu = hopeLingerieEntities.Categories.Where(x => x.ParentCategoryId == null && x.Active).OrderBy(x => x.DisplayOrder).ToList(); currentSelection.Action = categoryDescription; IExecuter[] executers = { new OnSale(), new IsNew(), new Standard() }; IExecuter executer = executers.First(x => x.IsValid(catalogueType)); currentSelection.Products = executer.DoQuery().ToList(); PrepareNavigationSettings(parentCaregory); return(View(executer.PickView(), currentSelection)); }
public ChangeCatalogueTypeMessage(CatalogueType catalogueType) { CatalogueType = catalogueType; }