private void InitializeType() { repository.With(access.GetElementType()); MetaDescription type = repository.GetDescription(access.GetElementType()); instance.Type = type; }
public virtual void Add(object element) { MetaDescription meta = metamodel.GetDescription(element.GetType()); elements.Add(element); foreach (PropertyDescription property in meta.AllAttributes()) { if (!property.IsPrimitive()) { Boolean isRoot = property.Type.IsRoot(); foreach (object value in property.ReadAll(element)) { if (!(isRoot && (value is String || value is Boolean || Number.IsNumber(value)))) { try { this.Add(value); } catch (ClassNotMetadescribedException e) { throw new ElementInPropertyNotMetadescribed(property); } } } } } }
public void SetUp() { MetaDescriptionFactory factory; Tower tower = new Tower(); factory = new MetaDescriptionFactory(typeof(Unicorn), tower.metamodel); subject = factory.CreateInstance(); factory.InitializeInstance(); }
public MetaDescription CreateInstance() { var name = type.GetTypeInfo().GetCustomAttribute <FameDescriptionAttribute>(); if (name != null) { instance = new MetaDescription(name.Value) { BaseClass = type }; } else { if (type.GetTypeInfo().FullName == "System.String") { instance = MetaDescription.STRING; } else if (type.GetTypeInfo().FullName == "System.Boolean") { instance = MetaDescription.BOOLEAN; } else { instance = new MetaDescription(type.GetTypeInfo().Name) { BaseClass = type } }; } return(instance); }
private PropertyDescription ChildrenProperty(MetaDescription meta) { foreach (PropertyDescription attr in meta.Attributes) { if (attr.IsComposite()) { return(attr); } } return(null); }
private void InitializeSuperclass() { if (type.BaseType != null) { repository.With(type.BaseType); MetaDescription superclass = repository.GetDescription(type.BaseType); if (superclass != null) { instance.SuperClass = superclass; } } }
public void RegisterType(Type type) { if (!classes.ContainsKey(type)) { MetaDescriptionFactory factory = new MetaDescriptionFactory(type, this); MetaDescription instance = factory.CreateInstance(); if (instance != null) { classes.Add(type, instance); factory.InitializeInstance(); this.Add(instance); } } }
public virtual void MergeFrom(SeoInfo source) { SemanticUrl = source.SemanticUrl; LanguageCode = source.LanguageCode; StoreId = source.StoreId; if (PageTitle.IsNullOrEmpty()) { PageTitle = source.PageTitle; } if (MetaDescription.IsNullOrEmpty()) { MetaDescription = source.MetaDescription; } }
private static void AnalyzeMetas(ref PageFragment pf, ref HtmlDocument htmlDocument) { List <HtmlNode> metas = htmlDocument.DocumentNode.Descendants("meta").ToList(); foreach (HtmlNode meta in metas) { if (meta.GetAttributeValue("name", "null") == "robots") { if (meta.GetAttributeValue("content", "null") == "noindex") { pf.Indexability = "Non-Indexable"; pf.IndexabilityStatus = "Noindex"; } } else if (meta.GetAttributeValue("name", "null") == "description") { if (pf.MetaDescriptions.Count == Utils.MaxDescs) { continue; } MetaDescription metaDesc = new MetaDescription(); metaDesc.MetaDescriptionText = meta.GetAttributeValue("content", ""); metaDesc.MetaDescriptionLength = metaDesc.MetaDescriptionText.Length; Font arialBold = new Font("Arial", 13.0F); metaDesc.MetaDescriptionPixelWidth = System.Windows.Forms.TextRenderer .MeasureText(metaDesc.MetaDescriptionText, arialBold).Width; pf.MetaDescriptions.Add(metaDesc); } else if (meta.GetAttributeValue("name", "null") == "keywords") { if (pf.MetaKeywords.Count == Utils.MaxKeywords) { continue; } MetaKeywords metaKey = new MetaKeywords(); metaKey.MetaKeywordsText = meta.GetAttributeValue("content", ""); metaKey.MetaKeywordsLength = metaKey.MetaKeywordsText.Length; pf.MetaKeywords.Add(metaKey); } } }
protected override ChurchInfo Parse() { return(new ChurchInfo { SimbahanID = ToInt(SimbahanID), StreetNo = ToInt(StreetNo), StreetName = StreetName.ToString(), Barangay = Barangay.ToString(), StateProvince = StateOrProvince.ToString(), City = City.ToString(), ZipCode = ZipCode.ToString(), CompleteAddress = CompleteAddress.ToString(), Diocese = Diocese.ToString(), Parish = Parish.ToString(), Priest = ParishPriest.ToString(), Vicariate = Vicariate.ToString(), DateEstablished = DateEstablished.ToString(), LastUpdate = ToDateTime(LastUpdate), FeastDay = FeastDay.ToString(), ContactNo = ContactNo.ToString(), Latitude = ToDouble(Latitude), Longitude = ToDouble(Longitude), HasAdorationChapel = ToBoolean(HasAdorationChapel), ChurchHistory = ChurchHistory.ToString(), OfficeHours = OfficeHours.ToString(), ChurchTypeID = ToInt(ChurchTypeID), Website = Website.ToString(), EmailAddress = EmailAddress.ToString(), DevotionSchedule = DevotionSchedule.ToString(), LocationID = ToInt(LocationID), ChurchCode = ChurchCode.ToString(), MaskData = MaskingData.ToString(), MetaTitle = MetaTitle.ToString(), MetaDescription = MetaDescription.ToString() }); }
private IEnumerable <object> RootElements(Repository repo) { List <object> result = new List <object>(); foreach (object each in repo.GetElements()) { MetaDescription meta = repo.DescriptionOf(each); PropertyDescription containerProperty = meta.ContainerPropertyOrNull(); if (containerProperty != null) { Object container = containerProperty.Read(each); if (container == null) { result.Add(each); } } else { result.Add(each); } } ; return(result); }
private void showContent() { LangID = System.Threading.Thread.CurrentThread.CurrentCulture.ToString(); MAHAITDBAccess = new BL.BL(System.Configuration.ConfigurationManager.AppSettings["APPID"].ToString()); if (Request.QueryString["Keyword"] != null) { hdn_keyword.Value = Request.QueryString["Keyword"]; } if (hdn_keyword.Value != string.Empty) { KeywordChange = Convert.ToString(hdn_keyword.Value); SearchString = "<span style='background:yellow;'>" + KeywordChange + "</span>"; } //TODO Check Why "MenuID" contain "Images", should contain int only if (this.Page.RouteData.Values["MenuID"] != null) { if (Int32.TryParse(this.Page.RouteData.Values["MenuID"].ToString(), out MenuID) == false) { MenuID = 0; } } else if (this.Request.QueryString["MenuID"] != null) { if (Int32.TryParse(this.Request.QueryString["MenuID"].ToString(), out MenuID) == false) { MenuID = 0; } } if (this.Page.RouteData.Values["ContentID"] != null) { if (Int32.TryParse(this.Page.RouteData.Values["ContentID"].ToString(), out ContentID) == false) { ContentID = 0; } } else if (this.Request.QueryString["ContentID"] != null) { if (Int32.TryParse(this.Request.QueryString["ContentID"].ToString(), out ContentID) == false) { ContentID = 0; } } //------------ t_SQLCmd = new SqlCommand(); if (ContentID != 0) { objCMSSchema.MenucontentID = ContentID; objCMSSchema.MenuID = MenuID; objCMSSchema.IsQuickMenu = false; objCMSSchema.LangType = Convert.ToString(LangID).ToLower(); ds = objCMSBL.GetCMSMoreDetails(objCMSSchema); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { lblHeading.Text = Convert.ToString(ds.Tables[0].Rows[0]["PageTitle"]); PageTile = Convert.ToString(ds.Tables[0].Rows[0]["PageTitle"]); if (ds.Tables[1].Rows.Count > 0) { MetaDescription = Convert.ToString(ds.Tables[1].Rows[0]["MetaDescription"]) != "" ? Convert.ToString(ds.Tables[1].Rows[0]["MetaDescription"]) : ""; MetaKeywords = Convert.ToString(ds.Tables[1].Rows[0]["MetaKeywords"]) != "" ? Convert.ToString(ds.Tables[1].Rows[0]["MetaKeywords"]) : ""; } this.Page.Title = PageTile; this.Page.MetaDescription = MetaDescription; this.Page.MetaKeywords = MetaKeywords; StringBuilder contentHtml = new StringBuilder(); foreach (DataRow dr in ds.Tables[0].Rows) { contentHtml.Append("<div class='archive-more'>"); if (Convert.ToString(dr["ShortDescription"]) != "" || Convert.ToString(dr["LongDescription"]) != "") { contentHtml.Append("<p> "); contentHtml.Append(Convert.ToString(dr["ShortDescription"]).Replace("~", Request.Url.OriginalString.Replace(HttpUtility.UrlDecode(Request.Url.PathAndQuery), string.Empty))); contentHtml.Append("</p> "); contentHtml.Append(Convert.ToString(dr["LongDescription"]).Replace("~", Request.Url.OriginalString.Replace(HttpUtility.UrlDecode(Request.Url.PathAndQuery), string.Empty))); } else { contentHtml.Append("Information not Available !!!"); } contentHtml.Append("</div>"); } if (KeywordChange != "") { CMSContent.InnerHtml = HttpUtility.HtmlDecode(Convert.ToString(Regex.Replace(contentHtml.ToString(), KeywordChange, SearchString, RegexOptions.IgnoreCase))); } else { CMSContent.InnerHtml = HttpUtility.HtmlDecode(Convert.ToString(contentHtml)); } if (KeywordChange != "") { lblHeading.Text.Replace(KeywordChange, SearchString); PageTile.Replace(KeywordChange, SearchString); MetaDescription.Replace(KeywordChange, SearchString); MetaKeywords.Replace(KeywordChange, SearchString); } } } else { CMSContent.InnerHtml = "Web site Content Under Departmental Aproval !!!"; } } }
public void TestPrimitiveStringGetsString() { Assert.AreEqual(MetaDescription.STRING, MetaDescription.PrimitiveNamed("String")); }
public void TestPrimitiveBooleanGetsBoolean() { Assert.AreEqual(MetaDescription.BOOLEAN, MetaDescription.PrimitiveNamed("Boolean")); }
private MetaItem CreateOperationMetaItem(string baseUri, ApiDescription description, IServiceProvider serviceProvider) { var relativePath = Uri.UnescapeDataString(description.RelativePath ?? string.Empty); var url = $"{baseUri}/{relativePath}"; var operation = new MetaOperation { auth = ResolveOperationAuth(description), proxy = new { }, certificate = new { }, method = description.HttpMethod, description = new MetaDescription { content = "", type = MediaTypeNames.Text.Markdown, version = null }, header = new List <MetaParameter> { new MetaParameter { disabled = false, description = "", /* new MetaDescription * { * content = "", * type = MediaTypeNames.Markdown, * version = null * },*/ key = HeaderNames.ContentType, value = MediaTypeNames.Application.Json } }, body = default }; operation.url = MetaUrl.FromRaw(url); foreach (var provider in _parameterProviders) { provider.Enrich(url, operation, serviceProvider); } var item = new MetaItem { id = Guid.NewGuid(), name = relativePath, description = new MetaDescription { content = "", type = MediaTypeNames.Text.Markdown, version = null }, variable = new List <dynamic>(), @event = new List <dynamic>(), request = operation, response = new List <dynamic>(), protocolProfileBehavior = new { } }; if (description.SupportedRequestFormats.Count > 0) { var bodyParameter = description.ParameterDescriptions.SingleOrDefault( x => x.Source.IsFromRequest && x.Source.Id == "Body"); // // Token Capture: if (item.request.method == "POST" && bodyParameter?.Type?.Name == "BearerTokenRequest") { [email protected](new { listen = "test", script = new { id = "66a87d23-bc0e-432c-acee-cb48d3704947", exec = new List <string> { "var data = JSON.parse(responseBody);\r", "postman.setGlobalVariable(\"accessToken\", data.accessToken);" }, type = "text/javascript" } }); item.request.body = new { mode = "raw", raw = "{\r\n\t\"IdentityType\": \"Username\",\r\n\t\"Identity\": \"\",\r\n\t\"Password\": \"\"\r\n}" }; } // // Body Definition (roots only): if (bodyParameter != null && bodyParameter.Type != null && !typeof(IEnumerable).IsAssignableFrom(bodyParameter.Type)) { item.request.body = new { mode = "raw", raw = JsonConvert.SerializeObject( FormatterServices.GetUninitializedObject(bodyParameter.Type)) } } ; } // // Bearer: if (item.request?.auth != null && (item.request.auth.Equals("bearer", StringComparison.OrdinalIgnoreCase) || item.request.auth.Equals("platformbearer", StringComparison.OrdinalIgnoreCase))) { item.request.header.Add(new MetaParameter { key = "Authorization", value = "Bearer {{accessToken}}", description = "Access Token", type = "text" }); } return(item); }
public void TestPrimitiveNumberGetsNumber() { Assert.AreEqual(MetaDescription.NUMBER, MetaDescription.PrimitiveNamed("Number")); }
public void TestPrimitiveDateGetsDate() { Assert.AreEqual(MetaDescription.DATE, MetaDescription.PrimitiveNamed("Date")); }
private void AcceptElement(object each) { MetaDescription meta = repo.DescriptionOf(each); visitor.BeginElement(meta.Fullname); visitor.Serial(GetSerialNumber(meta, each)); // XXX there can be more than one children property per element! PropertyDescription childrenProperty = ChildrenProperty(meta); if (childrenProperty == null || !childrenProperty.IsContainer) { foreach (PropertyDescription property in meta.AllAttributes().OrderBy(prop => prop.Name)) { if (property.IsDerived || property.IsContainer) { continue; } ICollection <object> values = property.ReadAll(each); if (property.Type == MetaDescription.BOOLEAN && (values.Count == 1) && !property.IsMultivalued) { var enumerator = values.GetEnumerator(); enumerator.MoveNext(); if (!(bool)enumerator.Current) { continue; } } if (property.Type.Fullname == "System.Int32" && (values.Count == 1)) { var enumerator = values.GetEnumerator(); enumerator.MoveNext(); if ((int)enumerator.Current == 0) { continue; } } if (values.Count > 0) { bool isPrimitive = property.Type.IsPrimitive(); visitor.BeginAttribute(property.Name); bool isRoot = property.Type.IsRoot(); bool isComposite = (property == childrenProperty); var enumerator = values.GetEnumerator(); while (enumerator.MoveNext()) { object value = enumerator.Current; if (value.GetType() == typeof(MetaDescription)) { MetaDescription m = (MetaDescription)value; if (m.IsPrimitive() || m.IsRoot()) { visitor.Reference(m.Name); continue; } } if (isPrimitive || (isRoot && (value.GetType() == typeof(String) || value.GetType() == typeof(bool) || Number.IsNumber(value)))) { visitor.Primitive(value); } else { if (isComposite) { this.AcceptElement(value); } else { int serial = GetSerialNumber(property, value); visitor.Reference(serial); } } } visitor.EndAttribute(property.Name); } } visitor.EndElement(meta.Fullname); } }
public void TestPrimitiveUnexistantTypeGetsException() { MetaDescription.PrimitiveNamed("Unexistant"); }
public void TestPrimitiveObjectGetsObject() { Assert.AreEqual(MetaDescription.OBJECT, MetaDescription.PrimitiveNamed("Object")); }
private void showContent() { MAHAITDBAccess = new BL.BL(System.Configuration.ConfigurationManager.AppSettings["APPID"].ToString()); LangID = System.Threading.Thread.CurrentThread.CurrentCulture.ToString(); if (Request.QueryString["Keyword"] != null) { hdn_keyword.Value = Request.QueryString["Keyword"]; } if (hdn_keyword.Value != string.Empty) { KeywordChange = Convert.ToString(hdn_keyword.Value); SearchString = "<span style='background:yellow;'>" + KeywordChange + "</span>"; } string siteUrl = string.Empty; siteUrl = Request.Url.OriginalString.Replace(HttpUtility.UrlDecode(Request.Url.PathAndQuery), string.Empty); int tempMenuID = 0; if (Int32.TryParse(this.Page.RouteData.Values["MenuID"].ToString(), out tempMenuID)) { MenuID = Convert.ToInt32(this.Page.RouteData.Values["MenuID"].ToString()); } else if (this.Request.QueryString["MenuID"] != null) { if (Int32.TryParse(this.Request.QueryString["MenuID"].ToString(), out tempMenuID)) { MenuID = Convert.ToInt32(this.Request.QueryString["MenuID"].ToString()); } } //if (this.Page.RouteData.Values["MenuID"] != null) //{ // MenuID = Convert.ToInt32(this.Page.RouteData.Values["MenuID"].ToString()); //} //else //{ // MenuID = Convert.ToInt32(this.Request.QueryString["MenuID"].ToString()); //} if (MenuID != 0) { objCMSSchema.MenuID = MenuID; //To Bind Menu BindLeftMenu(objCMSSchema.MenuID); objCMSSchema.LangType = Convert.ToString(LangID).ToLower(); objCMSSchema.IsQuickMenu = false; ds = objCMSBL.GetCMSDetails(objCMSSchema); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { if (objCMSSchema.MenuID != 1030) { lblHeading.Text = Convert.ToString(ds.Tables[0].Rows[0]["PageHeading"]); lblHeading.Visible = true; } PageTile = Convert.ToString(ds.Tables[0].Rows[0]["PageTitle"]); MetaDescription = Convert.ToString(ds.Tables[0].Rows[0]["MetaDescription"]); MetaKeywords = Convert.ToString(ds.Tables[0].Rows[0]["MetaKeywords"]); string DepartmentName = string.Empty; if (Convert.ToString(LangID).ToLower() == Convert.ToString("mr-IN").ToLower()) { DepartmentName = System.Configuration.ConfigurationManager.AppSettings["DepartmentNameMarathi"].ToString(); } else if (Convert.ToString(LangID).ToLower() == Convert.ToString("en-IN").ToLower()) { DepartmentName = System.Configuration.ConfigurationManager.AppSettings["DepartmentNameEnglish"].ToString(); } else { DepartmentName = System.Configuration.ConfigurationManager.AppSettings["DepartmentNameUrdu"].ToString(); } this.Page.Title = PageTile + "-" + DepartmentName; this.Page.MetaDescription = MetaDescription; this.Page.MetaKeywords = MetaKeywords; StringBuilder contentHtml = new StringBuilder(); if (rowscount != 0) { foreach (DataRow dr in ds.Tables[1].Rows) { contentHtml.Append("<div class='col-xs-12 col-sm-9 col-md-9 col-lg-9 border-l'> "); contentHtml.Append("<div class='archive'>"); if (Convert.ToString(dr["PageTitle"]) != string.Empty) { contentHtml.Append("<h2>"); contentHtml.Append(Convert.ToString(dr["PageTitle"])); contentHtml.Append("</h2>"); } contentHtml.Append("<div>"); if (Convert.ToString(dr["ShortDescription"]) != "") { contentHtml.Append(Convert.ToString(dr["ShortDescription"])); } else { if (Convert.ToString(dr["LongDescription"]) != "") { contentHtml.Append(Convert.ToString(dr["LongDescription"]).Replace("~", Request.Url.OriginalString.Replace(HttpUtility.UrlDecode(Request.Url.PathAndQuery), string.Empty))); } else { contentHtml.Append("Information not Available !!!"); } } contentHtml.Append("</div>"); if (Convert.ToString(dr["ShortDescription"]) != "") { if (LangID == "en-IN") { contentHtml.Append("<a class='read_more' href='" + siteUrl + "/" + dr["MenuID"] + "/" + Convert.ToString(dr["MenuContentID"]) + "/" + Convert.ToString(dr["Title"]).Replace(" ", "-") + "'> More " + Convert.ToString(dr["PageTitle"]) + " </a>"); } else { contentHtml.Append("<a class='read_more' href='" + siteUrl + "/" + dr["MenuID"] + "/" + Convert.ToString(dr["MenuContentID"]) + "/" + Convert.ToString(dr["Title"]).Replace(" ", "-") + "'> अधिक " + Convert.ToString(dr["PageTitle"]) + "</a>"); } } contentHtml.Append("</div>"); contentHtml.Append("</div>"); } } else { foreach (DataRow dr in ds.Tables[1].Rows) { contentHtml.Append("<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'> "); contentHtml.Append("<div class='archive'>"); if (Convert.ToString(dr["PageTitle"]) != string.Empty) { contentHtml.Append("<h2>"); contentHtml.Append(Convert.ToString(dr["PageTitle"])); contentHtml.Append("</h2>"); } contentHtml.Append("<div>"); if (Convert.ToString(dr["ShortDescription"]) != "") { contentHtml.Append(Convert.ToString(dr["ShortDescription"])); } else { if (Convert.ToString(dr["LongDescription"]) != "") { contentHtml.Append(Convert.ToString(dr["LongDescription"]).Replace("~", Request.Url.OriginalString.Replace(HttpUtility.UrlDecode(Request.Url.PathAndQuery), string.Empty))); } else { contentHtml.Append("Information not Available !!!"); } } contentHtml.Append("</div>"); if (Convert.ToString(dr["ShortDescription"]) != "") { if (LangID == "en-IN") { contentHtml.Append("<a class='read_more' href='" + siteUrl + "/" + dr["MenuID"] + "/" + Convert.ToString(dr["MenuContentID"]) + "/" + Convert.ToString(dr["Title"]).Replace(" ", "-") + "'> More " + Convert.ToString(dr["PageTitle"]) + " </a>"); } else { contentHtml.Append("<a class='read_more' href='" + siteUrl + "/" + dr["MenuID"] + "/" + Convert.ToString(dr["MenuContentID"]) + "/" + Convert.ToString(dr["Title"]).Replace(" ", "-") + "'> अधिक " + Convert.ToString(dr["PageTitle"]) + "</a>"); } } contentHtml.Append("</div>"); contentHtml.Append("</div>"); } } if (KeywordChange != "") { CMSContent.InnerHtml = HttpUtility.HtmlDecode(Convert.ToString(Regex.Replace(contentHtml.ToString(), KeywordChange, SearchString, RegexOptions.IgnoreCase))); } else { CMSContent.InnerHtml = HttpUtility.HtmlDecode(Convert.ToString(contentHtml)); } if (KeywordChange != "") { lblHeading.Text.Replace(KeywordChange, SearchString); PageTile.Replace(KeywordChange, SearchString); MetaDescription.Replace(KeywordChange, SearchString); MetaKeywords.Replace(KeywordChange, SearchString); } } } } else { CMSContent.InnerHtml = "Error !!!"; } }