/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); Query pageQuery = new Query(); LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
private static void runTest(string culture) { CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(culture); CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(culture); Console.Write("CurrentCulture is {0}. Result: ", CultureInfo.CurrentCulture.Name); Criteria allCriteria = CriteriaFactory.And(new ItemTypeCriteria(64), new PageURLCriteria(ConfigurationManager.AppSettings["pageUrl"])); allCriteria.AddCriteria(new PublicationCriteria(int.Parse(ConfigurationManager.AppSettings["publicationId"]))); Query pageQuery = new Query(); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { foreach (string uri in resultUris) { Console.WriteLine("{0}\n", uri); } } else { Console.WriteLine("NO RESULTS\n"); } }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); PublicationCriteria correctSite = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); allCriteria.AddCriteria(correctSite); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
public byte[] GetBinaryByUrl(string url) { string encodedUrl = HttpUtility.UrlPathEncode(url); // ?? why here? why now? Query findBinary = new Query(); PublicationURLCriteria urlCriteria = new PublicationURLCriteria(url); //MultimediaCriteria isBinary = new MultimediaCriteria(true); //Criteria allCriteria = CriteriaFactory.And(isBinary, urlCriteria); Criteria allCriteria = urlCriteria; findBinary.Criteria = allCriteria; if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } string[] binaryUri = findBinary.ExecuteQuery(); if (binaryUri.Length == 0) { // TODO: find out how to retrieve binary data } throw new NotImplementedException(); }
public ActionResult CreateReq(CreateCriteriaModel req) { ViewBag.ExistMess = Criteria.AddCriteria(req.Criteria, "CriteriaOption"); CreateCriteriaModel NewCriteria = new CreateCriteriaModel(); NewCriteria.CriteriaOption = Criteria.CriteraiValue(); NewCriteria.Criteria = new Criteria(); NewCriteria.listofCriteriaValue = Criteria.GetCriteriaValue(); return(View(NewCriteria)); }
public ActionResult ViewReq(CreateCriteriaModel req) { ViewBag.ExistMess = Criteria.AddCriteria(req.Criteria, "ClinicCriteria"); CreateCriteriaModel NewCriteria = new CreateCriteriaModel(); NewCriteria.listofClinic = clinicModel.GetClinicList(); NewCriteria.listofCriteria = Criteria.GetReqList("-10"); NewCriteria.CriteriaOption = Criteria.CriteraiValue(); NewCriteria.Criteria = new Criteria(); NewCriteria.listofCriteriaValue = Criteria.GetCriteriaValue(); return(View(NewCriteria)); }