コード例 #1
0
        public static bool HasBlock(Placeholders pch, XmlTag middleBlock)
        {
            bool status = false;

            status = middleBlock.LSTChildNodes.Exists(
                delegate(XmlTag tag)
            {
                return(Utils.CompareStrings(GetAttributeValueByName(tag, XmlAttributeTypes.NAME), pch));
            }
                );
            return(status);
        }
コード例 #2
0
        public static string GetTagInnerHtml(Placeholders pch, XmlTag middleBlock)
        {
            XmlTag currentTag = new XmlTag();

            currentTag = middleBlock.LSTChildNodes.Find(
                delegate(XmlTag tag)
            {
                return(Utils.CompareStrings(Utils.GetAttributeValueByName(tag, XmlAttributeTypes.NAME), pch));
            }
                );
            return(currentTag.InnerHtml);
        }
コード例 #3
0
ファイル: Utils.cs プロジェクト: Dindows-Systems/Aspxcommerce
        public static string GetAttributeValueByName(XmlTag tag, XmlAttributeTypes _type, string defaultValue)
        {
            string          value = string.Empty;
            string          name  = _type.ToString();
            LayoutAttribute attr  = new LayoutAttribute();

            attr = tag.LSTAttributes.Find(
                delegate(LayoutAttribute attObj)
            {
                return(Utils.CompareStrings(attObj.Name, name));
            }
                );
            return(attr == null ? defaultValue : attr.Value);
        }
コード例 #4
0
        public static bool IsCustomBlockDefined(XmlTag placeholder)
        {
            string activeTemplate = HttpContext.Current.Session["SageFrame.ActiveTemplate"] != null ? HttpContext.Current.Session["SageFrame.ActiveTemplate"].ToString() : "Default";
            string pchName        = Utils.GetAttributeValueByName(placeholder, XmlAttributeTypes.NAME);
            string FilePath       = "E://DotNetProjects//sftemplating//SageFrame//" + activeTemplate + "//sections";
            bool   status         = false;

            if (Directory.Exists(FilePath))
            {
                DirectoryInfo dir = new DirectoryInfo(FilePath);
                foreach (FileInfo file in dir.GetFiles("*.htm"))
                {
                    if (Utils.CompareStrings(Path.GetFileNameWithoutExtension(file.Name), pchName))
                    {
                        status = true;
                        break;
                    }
                }
            }
            return(status);
        }
コード例 #5
0
        public static string CalculateColumnWidth(XmlTag section, Placeholders _type)
        {
            string width = "20";

            foreach (XmlTag tag in section.LSTChildNodes)
            {
                if (Utils.CompareStrings(_type, GetAttributeValueByName(tag, XmlAttributeTypes.NAME)))
                {
                    int widthIndex = -1;
                    widthIndex = tag.LSTAttributes.FindIndex(
                        delegate(LayoutAttribute tagAttr)
                    {
                        return(Utils.CompareStrings(tagAttr.Name, XmlAttributeTypes.WIDTH));
                    }
                        );
                    if (widthIndex > -1)
                    {
                        width = tag.LSTAttributes[widthIndex].Value;
                    }
                    else
                    {
                        foreach (LayoutAttribute attr in section.LSTAttributes)
                        {
                            if (Utils.CompareStrings(attr.Name, XmlAttributeTypes.WIDTH))
                            {
                                width = attr.Value;
                            }
                            else if (Utils.CompareStrings(attr.Name, XmlAttributeTypes.COLWIDTH))
                            {
                                width = attr.Value;
                            }
                        }
                    }
                }
            }
            return(width);
        }