Example #1
0
 public Method GetCallMethod()
 {
     if (CallBack == null)
     {
         CallBack = new Method();
         CallBack.Name = "CallBack_" + this.GetTagName();
         CallBack.ReturnType = "CallbackResult";
         CallBack.InPageLoad = false;
         if (!CheckDataUseable())
         {
             CallBack.Body.AppendFormat("{0}/*{1}*/\r\n", Method.getSpaces(2), this.TabledisAbledMsg());
         }
         else
         {
             CallBack.Body.Append(Helper.Linq_getJson(this.DataName, this.BaseParams, out ModType, this.GetTagName()));
         }
     }
     return CallBack;
 }
Example #2
0
        public Method GetIGlobalMethod()
        {
            if (this.SubPage != null && LoadAscx == null)
            {
                LoadAscx = new Method();
                LoadAscx.Name = "Load_" + this.TagName;
                LoadAscx.InPageLoad = true;
                LoadAscx.WillTestBeforLoad = this.TestBeforLoad;
                LoadAscx.SetTestBeforLoad(this.BeforLoadTests);

                if (ParPageName == this.LabeName)
                {
                    LoadAscx.Body.AppendFormat("{0}/*(--未加载套用自己的标签--{1})*/\r\n", Method.getSpaces(2), this.LabeName);
                }
                else
                {
                    LoadAscx.Body.AppendFormat("{0}SubControl uc_label=(SubControl) LoadControl( \"{1}.ascx\");\r\n", Method.getSpaces(2), this.LabeName);
                    LoadAscx.Body.AppendFormat("{0}uc_label.SetDb(this.Db_Context);\r\n", Method.getSpaces(2));
                    LoadAscx.Body.AppendFormat("{0}uc_label.SetConfig(this.config);\r\n", Method.getSpaces(2));
                    LoadAscx.Body.AppendFormat("{0}{1}.Controls.Add(uc_label);\r\n", Method.getSpaces(2), this.GetTagName());
                }
            }
            return LoadAscx;
        }
Example #3
0
 public Method GetIGlobalMethod()
 {
     if (ReadData == null)
     {
         ReadData = new Method();
         ReadData.Name = "Bind_" + this.GetTagName();
         ReadData.InPageLoad = true;
         ReadData.WillTestBeforLoad = this.TestBeforLoad;
         ReadData.SetTestBeforLoad(this.BeforLoadTests);
         if (!CheckDataUseable())
         {
             ReadData.Body.AppendFormat("{0}/*{1}*/\r\n", Method.getSpaces(2), this.TabledisAbledMsg());
         }
         else
         {
             ReadData.Body.Append(Helper.Linq_getRead(this.DataName, this.BaseParams, out ModType, UpDataname, this.HasStyle() ? this.TagName : "read"));
             if (this.HasStyle())
             {
                 if (subLsitMethod != null)
                 {
                     foreach (var x in subLsitMethod)
                     {
                         ReadData.Body.AppendFormat("{0}{1}({2});\r\n", Method.getSpaces(2), x.Name, this.TagName);
                     }
                 }
             }
         }
     }
     return ReadData;
 }
Example #4
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;
 }
Example #5
0
 private void GetMethodsLines(Method method)
 {
     if (method != null)
     {
         if (method.InPageLoad)
         {
             if (method.WillTestBeforLoad)
             {
                 MethodLines.AppendFormat("{0}if ( {1} )\r\n", Method.getSpaces(4), method.GetTestBeforLoadStr());
                 MethodLines.Append(Method.getSpaces(4) + "{\r\n");
                 MethodLines.AppendFormat("{0}{1}();\r\n", Method.getSpaces(5), method.Name);
                 MethodLines.Append(Method.getSpaces(4) + "}\r\n");
             }
             else
             {
                 MethodLines.AppendFormat("{0}{1}();\r\n", Method.getSpaces(4), method.Name);
             }
         }
         MethodRects.Append(method.ToFullMethodRect());
     }
 }