Esempio n. 1
0
        public Method GetIGlobalMethod()
        {
            bool in_page_load = false;

            if (this.HasReadParams)
            {
                in_page_load = Inside_Read ? false : true;
            }
            else
            {
                in_page_load = true;
            }
            if (this.SubPage != null && BindList == null)
            {
                BindList                   = new Method();
                BindList.Name              = string.Concat("Bind_", this.GetTagName());
                BindList.InPageLoad        = in_page_load;
                BindList.WillTestBeforLoad = this.TestBeforLoad;
                BindList.SetTestBeforLoad(this.BeforLoadTests);
                if (!CheckDataUseable())
                {
                    BindList.Body.AppendFormat("{0}/*{1}*/\r\n", Method.getSpaces(2), this.TabledisAbledMsg());
                }
                else if (ParPageName == this.ItemName)
                {
                    BindList.Body.AppendFormat("{0}/*(未加载套用自己的标签)。{1}*/\r\n", Method.getSpaces(2), this.TagName);
                }
                else
                {
                    BindList.Body.Append(Helper.Linq_getList(this.DataName, this.BaseParams,
                                                             this.ItemFields, out ModType, this.UpDataname, out UpModType, Pager));
                    BindList.Body.AppendFormat("{0}if (totalsize == 0)\r\n", Method.getSpaces(2));
                    BindList.Body.Append(Method.getSpaces(2) + "{\r\n");
                    EmptyTag empty = (this.SubPage as ItemPage).Empty;
                    if (empty != null)
                    {
                        BindList.Body.AppendFormat("{0}{1}Empty = true;\r\n", Method.getSpaces(3), this.GetTagName());
                    }
                    else
                    {
                        string emptytext = "暂无内容";
                        Match  m         = Regex.Match(BaseParams, @"(?<=emptytext=)[^&]+?(?=&|$)");
                        if (m.Success)
                        {
                            emptytext = m.Value;
                        }
                        if (emptytext != "none")
                        {
                            BindList.Body.AppendFormat("{0}empty_{1}.Text = \"<div class='emptydiv'><span class='emptytext'>{2}</span></div>\";\r\n",
                                                       Method.getSpaces(3), this.GetTagName(), emptytext);
                        }
                    }
                    BindList.Body.Append(Method.getSpaces(3) + "return;\r\n");
                    BindList.Body.Append(Method.getSpaces(2) + "}\r\n");
                    BindList.Body.Append(!this.HasSubList() ? BindRepeater() : BindPlaceHolder());
                }
            }
            return(BindList);
        }
Esempio n. 2
0
 public void FindEmpty()
 {
     Match m = this.Config.tagregex.EmptyPairTest.Match(this.Html);
     string style = "";
     if (m.Success)
     {
         style = m.Groups["style"].Value;
         Empty = new EmptyTag(style, m.Value, Deep, this.Config, this.Deep + this.TagList.Count);
         this.Html = this.Html.Replace(m.Value, Empty.GetContentPlaceholder(style));
     }
 }
Esempio n. 3
0
        public string GetGloabalField()
        {
            if (this.SubPage == null)
            {
                return(string.Empty);
            }
            StringBuilder sb    = new StringBuilder();
            EmptyTag      empty = (this.SubPage as ItemPage).Empty;

            if (empty != null)
            {
                sb.AppendFormat("{0}protected bool {1}Empty = false;\r\n", Method.getSpaces(1), this.GetTagName());
            }
            if (this.isSublist && UpDataname != null)
            {
                sb.AppendFormat("{0}protected {1} item;\r\n", Method.getSpaces(1), UpModType);
                sb.AppendFormat("{0}public override void SetItem(object mItem)\r\n", Method.getSpaces(1));
                sb.Append(Method.getSpaces(1) + "{\r\n");
                sb.AppendFormat("{0}this.item = mItem as {1};\r\n", Method.getSpaces(2), UpModType);
                sb.Append(Method.getSpaces(1) + "}\r\n");
            }
            return(sb.ToString());
        }