Exemple #1
0
 public void DoRepository(Table replaceClass, ref List<string> fileName)
 {
   string newValue1 = string.Empty;
   string newValue2 = string.Empty;
   string newValue3 = string.Empty;
   string str1 = string.Empty;
   string newValue4 = string.Empty;
   string primaryKeyType = replaceClass.PrimaryKeyType;
   if (replaceClass.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refId)
     {
       newValue3 += this.m_ReposLocalDan.Replace(this.m_ReplaceAttribute, refIdName.Ref).Replace('@', '"');
       newValue4 += this.m_ByRefId.Replace(this.m_String, refIdName.RefType).Replace(this.m_ReplaceClassCode, refIdName.Ref).Replace(this.m_ReplaceAttribute, replaceClass.Name).Replace(this.m_ReplaceClassName, replaceClass.Code).Replace('@', '"');
     }
   }
   string str2;
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refNotId)
     {
       newValue2 += this.m_ReposLocal.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_Id, refIdName.Id).Replace('@', '"');
       newValue1 += this.m_RefGetSelectDuo.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace('@', '"').Replace("^SysRole^", replaceClass.Code);
     }
     str2 = Common.Read(BaseClass.m_DempDirectory + this.m_DuoMoban).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_GetByRefId, newValue4).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace(this.m_ReposDan, newValue3).Replace(this.m_RefGetSelectList, newValue1).Replace(this.m_Repos, newValue2).Replace(this.m_String, primaryKeyType);
   }
   else
     str2 = Common.Read(BaseClass.m_DempDirectory + this.m_DanMoban).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_GetByRefId, newValue4).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace(this.m_ReposDan, newValue3).Replace(this.m_String, primaryKeyType);
   string content = str2.Replace(BaseClass.m_DALnamespace, replaceClass.NameSpace + "DAL");
   Common.Write(BaseClass.m_RootDirectory + "/" + this.m_DAL + "/" + replaceClass.Code + "Repository.cs", content);
   fileName.Add(replaceClass.Code);
 }
Exemple #2
0
 public void DoWorkflow(Table replaceClass, ref List<string> fileName)
 {
   StringBuilder stringBuilder1 = new StringBuilder();
   foreach (Column column in replaceClass.Columns)
   {
     if (Common.IsWorkFlow(column.Comment))
     {
       StringBuilder stringBuilder2 = new StringBuilder();
       string oldValue = "<Compile Include=@Properties\\AssemblyInfo.cs@ />".Replace('@', '"');
       string str1 = column.Comment.Replace('【', '[').Replace('】', ']').Replace(',', ',');
       string[] strArray = str1.Substring(str1.IndexOf('[') + 1, str1.IndexOf(']') - str1.IndexOf('[') - 1).Split(',');
       string newValue1 = str1.Substring(0, str1.ToUpper().IndexOf("WORKFLOW"));
       for (int index = 0; index < strArray.Length; ++index)
       {
         string newValue2 = replaceClass.Code + column.Code + index.ToString();
         string content = Common.Read(BaseClass.m_DempDirectory + "/CodeActivity1.cs").Replace("DAL", replaceClass.NameSpace + "DAL").Replace("WFActivitys", replaceClass.NameSpace + "WFActivitys").Replace("CodeActivity1", newValue2).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceAttribute, strArray[index]).Replace("^State^", column.Code).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace("WF", newValue1);
         Common.Write(BaseClass.m_RootDirectory + "/WFActivitys/" + newValue2 + ".cs", content);
         string str2 = "    <Compile Include=@Framework@ />\r\n            ".Replace('@', '"');
         stringBuilder2.Append(str2.Replace("Framework", newValue2 + ".cs"));
       }
       stringBuilder2.Append(oldValue);
       string path = BaseClass.m_RootDirectory + "/WFActivitys/WFActivitys.csproj";
       Common.Write(path, Common.Read(path).Replace(oldValue, stringBuilder2.ToString()).Replace("<RootNamespace>WFActivitys</RootNamespace>", "<RootNamespace>" + replaceClass.NameSpace + "WFActivitys</RootNamespace>"));
       stringBuilder2.Clear();
     }
   }
 }
Exemple #3
0
 public void DoIRepository(Table replaceClass, ref List<string> fileName)
 {
   string str1 = string.Empty;
   string str2 = string.Empty;
   string newValue1 = string.Empty;
   string newValue2 = string.Empty;
   string str3 = string.Empty;
   string primaryKeyType = replaceClass.PrimaryKeyType;
   string nullPrimaryKeyType = Common.GetNullPrimaryKeyType(replaceClass.PrimaryKeyType);
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refNotId)
     {
       newValue2 += this.m_IRefGetSelectDuo.Replace(this.m_ReplaceAttribute, refIdName.RefTableCode).Replace('@', '"');
       if (refIdName.IsRefSelf)
         newValue2 += this.m_IRefSet.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, replaceClass.Code).Replace('@', '"');
     }
   }
   if (replaceClass.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refId)
       newValue2 += this.m_ByRefId.Replace(this.m_String, refIdName.RefType).Replace(this.m_ReplaceClassCode, refIdName.Ref).Replace(this.m_ReplaceAttribute, replaceClass.Name).Replace(this.m_ReplaceClassName, replaceClass.Code).Replace('@', '"');
   }
   string content = Common.Read(BaseClass.m_DempDirectory + this.m_AreasIRepository).Replace(BaseClass.m_IBLLnamespace, replaceClass.NameSpace + "IBLL").Replace(BaseClass.m_DALnamespace, replaceClass.NameSpace + "DAL").Replace(this.m_IRefGetSelectList, newValue2).Replace(this.m_RefById, newValue1).Replace(this.m_String, primaryKeyType).Replace(this.m_StringCreate, nullPrimaryKeyType).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceClassCode, replaceClass.Code);
   string path = BaseClass.m_RootDirectory + "/" + this.m_IBusinessRules + "/";
   Directory.CreateDirectory(path);
   Common.Write(path + "I" + replaceClass.Code + "BLL.cs", content);
   fileName.Add(replaceClass.Code);
 }
Exemple #4
0
 public void DoWcf(Table replaceClass, ref List<string> fileName)
 {
   string str = "<%@ ServiceHost Language=!C#! Debug=!true! Service=!" + replaceClass.NameSpace + "BLL." + replaceClass.Code + "BLL!  %>";
   string path = BaseClass.m_RootDirectory + "/WcfHost/";
   Directory.CreateDirectory(path);
   Common.Write(path + replaceClass.Code + ".svc", str.Replace('!', '"'));
   fileName.Add(replaceClass.Code);
 }
Exemple #5
0
 public void DoDetails(Table replaceClass, ref List<string> fileName)
 {
   StringBuilder stringBuilder = new StringBuilder();
   string newValue = string.Empty;
   int num = 0;
   foreach (Column column in replaceClass.Columns)
   {
     ++num;
     if (!Common.IsPrimaryKey(replaceClass, column.Id) && !Common.IsStampType(column.DataType) && !Common.IsNotDisplay(column.Comment))
     {
       if (!string.IsNullOrWhiteSpace(replaceClass.childTableColumnRef) && replaceClass.childTableColumnRef == column.Id)
       {
         newValue += this.m_DetailsRef.Replace(this.m_ReplaceAttribute, column.Code).Replace(this.m_ReplaceClassCode, replaceClass.Code + "2").Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).Replace('@', '"');
       }
       else
       {
         RefIdName foreignKey = Common.GetForeignKey(replaceClass, column);
         if (foreignKey != null)
           newValue += this.m_DetailsRef.Replace(this.m_ReplaceAttribute, column.Code).Replace(this.m_ReplaceClassCode, foreignKey.RefTableCode).Replace(this.m_Id, foreignKey.Id).Replace(this.m_Name, foreignKey.Name).Replace('@', '"');
         else if (!string.IsNullOrWhiteSpace(column.Code) && !string.IsNullOrWhiteSpace(column.DataType))
           newValue = !Common.IsStringType(column.DataType) ? newValue + this.m_DetailsString.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"') : (string.IsNullOrWhiteSpace(column.Length) || Convert.ToInt32(column.Length) <= 200 ? newValue + this.m_DetailsString.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"') : newValue + this.m_TextAreaForDetails.Replace(this.m_ReplaceAttribute, column.Code).Replace('\'', '"'));
       }
     }
   }
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refNotId)
     {
       ++num;
       newValue += this.m_DetailsNotRef.Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_Id, refIdName.Id).Replace(this.m_Name, refIdName.Name).Replace("ids", "ids" + num.ToString()).Replace("item", "item" + num.ToString()).Replace('@', '"');
     }
   }
   string content = Common.Read(BaseClass.m_DempDirectory + "/Details.aspx").Replace("ViewPage<DAL.", "ViewPage<" + replaceClass.NameSpace + "DAL.").Replace(this.m_Details, newValue).Replace(this.m_DetailsmMster, this.m_DetailsSmall).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name);
   string path = BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code;
   Directory.CreateDirectory(path);
   Common.Write(path + "/Details.aspx", content);
   fileName.Add(replaceClass.Code + "/Details.aspx");
 }
Exemple #6
0
 public void DoEdit(Table replaceClass, ref List<string> fileName)
 {
   StringBuilder stringBuilder = new StringBuilder();
   string newValue1 = string.Empty;
   string newValue2 = string.Empty;
   int num = 0;
   string newValue3 = "";
   string newValue4 = "";
   bool flag = false;
   foreach (Column column in replaceClass.Columns)
   {
     ++num;
     if (Common.IsPrimaryKey(replaceClass, column.Id))
       newValue2 = newValue2 + "<%: Html.HiddenFor(model => model." + column.Code + " ) %>";
     else if (Common.IsStampType(column.DataType) || Common.IsCreatePerson(column) || Common.IsCreateTime(column))
       newValue2 = newValue2 + "<%: Html.HiddenFor(model => model." + column.Code + " ) %>";
     else if (!Common.IsUpdatePerson(column) && !Common.IsUpdateTime(column) && !Common.IsCreatePerson(column) && (!Common.IsCreateTime(column) && !Common.IsNotDisplay(column.Comment)) && !Common.IsWorkFlow(column.Comment))
     {
       if (!string.IsNullOrWhiteSpace(replaceClass.childTableColumnRef) && replaceClass.childTableColumnRef == column.Id)
       {
         newValue2 += this.m_SelfEdit.Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).Replace(this.m_ReplaceAttribute, column.Code).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace('@', '"');
       }
       else
       {
         RefIdName foreignKey = Common.GetForeignKey(replaceClass, column);
         if (foreignKey != null)
           newValue2 += this.m_EditRef.Replace(this.m_Name, foreignKey.Name).Replace(this.m_ReplaceAttribute, foreignKey.Ref).Replace(this.m_ReplaceClassCode, foreignKey.RefTableCode).Replace('@', '"');
         else if (!string.IsNullOrWhiteSpace(column.Code) && !string.IsNullOrWhiteSpace(column.DataType))
         {
           if (Common.IsIntType(column.DataType))
             newValue2 += this.m_EditorForInt.Replace(this.m_ReplaceAttribute, column.Code).Replace('*', '"');
           else if (Common.IsDateType(column.DataType))
           {
             if (!flag)
               flag = true;
             newValue2 += this.m_EditorForDate.Replace(this.m_ReplaceAttribute, column.Code).Replace('*', '"');
           }
           else if (Common.IsDecimalType(column.DataType))
             newValue2 += this.m_EditorFor.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"');
           else if (Common.IsStringType(column.DataType))
           {
             if (column.Comment.Contains("RadioButton"))
               newValue2 = !(column.Mandatory == "1") ? newValue2 + this.m_CreateRadioButtonFor.Replace(this.m_ReplaceClassCode, column.TableCode).Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"').Replace(this.m_RadioButtonListChecked, "false") : newValue2 + this.m_CreateRadioButtonFor.Replace(this.m_ReplaceClassCode, column.TableCode).Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"').Replace(this.m_RadioButtonListChecked, "true");
             else if (column.Comment.Contains("DropDown"))
               newValue2 += this.m_CreateEditorFor.Replace(this.m_ReplaceClassCode, column.TableCode).Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"');
             else if (column.Comment.Contains("Cascade"))
             {
               string newValue5 = column.Comment.Substring(0, column.Comment.IndexOf("Cascade"));
               newValue2 += this.m_LianDongEditorFor.Replace(this.m_ReplaceClassCode, column.TableCode).Replace(this.m_ReplaceAttribute, column.Code).Replace("^MyParent^", newValue5).Replace('@', '"');
               newValue3 += "\r\n            \r\n            $(@#myparent@).change(function () { get^ReplaceAttribute^(@#^ReplaceAttribute^@); });\r\n".Replace(this.m_ReplaceAttribute, column.Code).Replace("myparent", newValue5).Replace('@', '"');
               newValue4 += "\r\n        function get^ReplaceAttribute^(^ReplaceAttribute^) {\r\n            $(^ReplaceAttribute^).empty();\r\n            $(@<option></option>@)\r\n                    .val(@@)\r\n                    .text(@请选择@)\r\n                    .appendTo($(^ReplaceAttribute^));\r\n            bindDropDownList(^ReplaceAttribute^, @#myparent@);\r\n            $(^ReplaceAttribute^).change();\r\n        }\r\n".Replace(this.m_ReplaceAttribute, column.Code).Replace("myparent", newValue5).Replace('@', '"');
             }
             else
               newValue2 = string.IsNullOrWhiteSpace(column.Length) || Convert.ToInt32(column.Length) <= 200 ? newValue2 + this.m_EditorFor.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"') : newValue2 + this.m_TextAreaFor.Replace(this.m_ReplaceAttribute, column.Code).Replace('\'', '"');
           }
           else
             newValue2 += this.m_EditorFor.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"');
         }
       }
     }
   }
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refNotId)
     {
       ++num;
       if (!refIdName.IsRefSelf)
       {
         if (refIdName.RefTableCode.ToUpper() == "FILEUPLOADER")
         {
           newValue2 += this.m_EditNotRefUp.Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_Id, refIdName.Id).Replace(this.m_Name, refIdName.Name).Replace("ids", "ids" + num.ToString()).Replace("item", "item" + num.ToString()).Replace('@', '"');
           newValue3 += this.m_UpLodeJs.Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace('@', '"');
           newValue1 += this.m_UpLoaderScript.Replace('@', '"');
         }
         else
           newValue2 += this.m_EditNotRef.Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_Id, refIdName.Id).Replace(this.m_Name, refIdName.Name).Replace("ids", "ids" + num.ToString()).Replace("item", "item" + num.ToString()).Replace('@', '"');
       }
     }
   }
   string content = Common.Read(BaseClass.m_DempDirectory + "/Edit.aspx").Replace("ViewPage<DAL.", "ViewPage<" + replaceClass.NameSpace + "DAL.").Replace("App.", replaceClass.NameSpace + "App.").Replace("liandongchushihua", newValue3).Replace("liandonghanshu", newValue4).Replace(this.m_CreatePage, newValue2).Replace(this.m_PickTimeCrea, newValue1).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name);
   string path = BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code;
   Directory.CreateDirectory(path);
   Common.Write(path + "/Edit.aspx", content);
   fileName.Add(replaceClass.Code + "/Edit.aspx");
 }
Exemple #7
0
 public static List<Table> ConvertT(List<TableData> dataSourse)
 {
   List<Table> list = new List<Table>();
   if (dataSourse != null)
   {
     foreach (TableData tableData in dataSourse)
     {
       Table table = new Table();
       table.Code = tableData.Code;
       table.Columns = tableData.Columns;
       table.Id = tableData.Id;
       table.Name = tableData.Name;
       table.PrimaryKey = tableData.PrimaryKey;
       list.Add(table);
     }
   }
   return list;
 }
Exemple #8
0
 public void DoIndex(Table replaceClass, ref List<string> fileName)
 {
   string str1 = string.Empty;
   string str2 = string.Empty;
   string newValue1 = string.Empty;
   string newValue2 = string.Empty;
   string newValue3 = string.Empty;
   bool flag1 = false;
   int num1 = replaceClass.Columns.Count - 2;
   if (num1 <= 0)
     num1 = 3;
   int num2 = 678 / num1;
   int num3 = 582 / num1;
   int num4 = 0;
   string newValue4 = string.Empty;
   string newValue5 = string.Empty;
   bool flag2 = false;
   foreach (Column column in replaceClass.Columns)
   {
     Column item = column;
     if (Common.IsSort(item.Comment))
       newValue5 = item.Code;
     if (!Common.IsNotDisplay(item.Comment))
     {
       ++num4;
       if (num4 > 3)
       {
         if (Common.IsStampType(item.DataType))
           newValue4 = newValue4 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title: '<%: Html.DisplayNameFor(model => model." + item.Code + ") %>', width: " + (string) (object) num2 + ", hidden: true }";
         else if (Common.IsDateType(item.DataType))
           newValue4 = newValue4 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title:  '<%: Html.DisplayNameFor(model => model." + item.Code + ") %>', width: " + (string) (object) num2 + "\r\n                    , formatter: function (value, rec) {\r\n                        if (value) {\r\n                            return dateConvert(value);\r\n                        } \r\n                    } \r\n}";
         else if (Common.GetForeignKey(replaceClass, item) != null)
           newValue4 = newValue4 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title: '<%: Html.DisplayNameFor(model => model." + item.Code + "Old) %>', width: " + (string) (object) num2 + "}";
         else
           newValue4 = newValue4 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title:  '<%: Html.DisplayNameFor(model => model." + item.Code + ") %>', width: " + (string) (object) num2 + " }";
       }
       if (!Common.IsPrimaryKey(replaceClass, item.Id))
       {
         if (!flag2)
         {
           flag2 = true;
           str2 = str2 + (object) "\n\t\t\t\t\t{ field: '" + item.Code + "', title: '<%: Html.DisplayNameFor(model => model." + item.Code + ") %>', width: " + (string) (object) num2 + " }";
         }
         else if (Common.IsDateType(item.DataType))
           str2 = str2 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title:  '<%: Html.DisplayNameFor(model => model." + item.Code + ") %>', width: " + (string) (object) num2 + "\r\n                    , formatter: function (value, rec) {\r\n                        if (value) {\r\n                            return dateConvert(value);\r\n                        } \r\n                    } \r\n}";
         else if (Common.IsStampType(item.DataType))
           str2 = str2 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title: '<%: Html.DisplayNameFor(model => model." + item.Code + ") %>', width: " + (string) (object) num2 + ", hidden: true }";
         else if (Common.GetForeignKey(replaceClass, item) != null)
           str2 = str2 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title: '<%: Html.DisplayNameFor(model => model." + item.Code + "Old) %>', width: " + (string) (object) num2 + " }";
         else
           str2 = str2 + (object) "\n\t\t\t\t\t,{ field: '" + item.Code + "', title:  '<%: Html.DisplayNameFor(model => model." + item.Code + ") %>', width: " + (string) (object) num2 + " }";
         if (!string.IsNullOrWhiteSpace(item.Comment) && item.Comment.Contains("Research"))
         {
           if (Common.IsIntType(item.DataType))
             newValue2 += this.m_SearchInt.Replace(this.m_ReplaceAttribute, item.Code).Replace('\'', '"');
           else if (Common.IsDateType(item.DataType))
           {
             if (!flag1)
             {
               newValue3 += this.m_PickTime.Replace(this.m_ReplaceAttribute, item.Code);
               flag1 = true;
             }
             newValue2 += this.m_SearchDateTime.Replace(this.m_ReplaceAttribute, item.Code).Replace('@', '"');
           }
           else if (item.Comment.Contains("DropDown"))
             newValue2 += this.m_SearchZhuangtai.Replace(this.m_ReplaceClassCode, item.TableCode).Replace(this.m_ReplaceAttribute, item.Code).Replace('@', '"');
           else if (item.Comment.Contains("Equal"))
           {
             newValue2 += this.m_SearchEqString.Replace(this.m_ReplaceAttribute, item.Code).Replace('@', '"');
           }
           else
           {
             newValue2 += this.m_SearchString.Replace(this.m_ReplaceAttribute, item.Code).Replace('@', '"');
             newValue1 += this.m_SearchAuto.Replace(this.m_ReplaceAttribute, item.Code).Replace('@', '"');
           }
         }
         else if (!string.IsNullOrWhiteSpace(item.Comment) && item.Comment.Contains("Equal"))
           newValue2 += this.m_SearchEqString.Replace(this.m_ReplaceAttribute, item.Code).Replace('@', '"');
         else if (replaceClass.refNotId != null && Enumerable.FirstOrDefault<RefIdName>(Enumerable.Where<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId, (Func<RefIdName, bool>) (a => item.Code.Contains(a.RefTableCode) && item.Code.Contains(a.Id)))) != null)
           newValue2 += this.m_SearchRefDuo.Replace(this.m_ReplaceClassCode, item.TableCode).Replace(this.m_ReplaceAttribute, item.Code).Replace('@', '"');
       }
     }
   }
   if (string.IsNullOrEmpty(newValue5))
     newValue5 = Common.GetFirstPrimaryKeyCode(replaceClass);
   string newValue6 = str2 + str1;
   string str3 = "/Index.aspx";
   string path1 = BaseClass.m_DempDirectory + str3;
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refNotId)
     {
       newValue6 = newValue6 + (object) "\t\t\t\t\t//, { display: '<%: Html.DisplayNameFor(model => model." + refIdName.RefTableCode + refIdName.Id + ") %>', name: '" + refIdName.RefTableCode + refIdName.Id + "', width: " + (string) (object) num2 + ", sortable: false, align: 'left' }\n";
       if (refIdName.IsRefSelf)
       {
         path1 = BaseClass.m_DempDirectory + "/TreeIndexWai.aspx";
         string content1 = Common.Read(path1).Replace("ViewPage<DAL.", "ViewPage<" + replaceClass.NameSpace + "DAL.").Replace("^m_RefTableName^", refIdName.RefTableName).Replace("^m_Wai^", refIdName.RefTableCode).Replace(this.m_PickTimeReplace, newValue3).Replace(this.m_Search, newValue2).Replace(this.m_ReplaceAttribute, newValue6).Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Sort, newValue5).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass));
         string path2 = BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code;
         Directory.CreateDirectory(path2);
         Common.Write(path2 + "/Index.aspx", content1);
         path1 = BaseClass.m_DempDirectory + "/Index.aspx";
         string content2 = Common.Read(path1).Replace("ViewPage<DAL.", "ViewPage<" + replaceClass.NameSpace + "DAL.").Replace(this.m_SearchAutoComplete, newValue1).Replace(this.m_PickTimeReplace, newValue3).Replace(this.m_Search, newValue2).Replace(this.m_ReplaceAttribute, newValue6).Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Sort, newValue5).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass));
         string path3 = BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code;
         Directory.CreateDirectory(path3);
         Common.Write(path3 + "/IndexSef.aspx", content2);
         path1 = BaseClass.m_DempDirectory + "/Set.aspx";
         string content3 = Common.Read(path1).Replace("ViewPage<DAL.", "ViewPage<" + replaceClass.NameSpace + "DAL.").Replace(this.m_ReplaceAttribute, refIdName.RefTableCode).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name);
         Directory.CreateDirectory(BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code);
         Common.Write(path2 + "/Set" + refIdName.RefTableCode + ".aspx", content3);
         return;
       }
     }
   }
   if (replaceClass.childTableColumnRef != null)
   {
     Common.GetColumnByKey(replaceClass, replaceClass.childTableColumnRef);
     string content = Common.Read(BaseClass.m_DempDirectory + "/IndexTree.aspx").Replace("ViewPage<DAL.", "ViewPage<" + replaceClass.NameSpace + "DAL.").Replace(this.m_ReplaceAttribute, newValue4).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name);
     string path2 = BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code;
     Directory.CreateDirectory(path2);
     Common.Write(path2 + str3, content);
     str3 = "/IndexSef.aspx";
   }
   string content4 = Common.Read(path1).Replace(this.m_Sort, newValue5).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace("ViewPage<DAL.", "ViewPage<" + replaceClass.NameSpace + "DAL.").Replace("App.", replaceClass.NameSpace + "App.").Replace(this.m_SearchAutoComplete, newValue1).Replace(this.m_PickTimeReplace, newValue3).Replace(this.m_Search, newValue2).Replace(this.m_ReplaceAttribute, newValue6).Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, replaceClass.Name);
   string path4 = BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code;
   Directory.CreateDirectory(path4);
   Common.Write(path4 + str3, content4);
   fileName.Add(replaceClass.Code + str3);
 }
Exemple #9
0
 public void DoControllers(Table replaceClass, ref List<string> fileName)
 {
   string newValue1 = string.Empty;
   string str1 = string.Empty;
   string str2 = string.Empty;
   string newValue2 = string.Empty;
   string str3 = string.Empty;
   string oldValue = "entity.^m_Id^ = Result.GetNewId();";
   string newValue3 = oldValue;
   string str4 = string.Empty;
   string str5 = string.Empty;
   string primaryKeyType = replaceClass.PrimaryKeyType;
   string nullPrimaryKeyType = Common.GetNullPrimaryKeyType(replaceClass.PrimaryKeyType);
   string newValue4;
   if (replaceClass.PrimaryKeyType == "int")
   {
     newValue3 = string.Empty;
     newValue4 = replaceClass.PrimaryKeyType + "[] deleteId = collection[@query@].GetString().Split(',').Select(s => Convert.ToInt32(s)).ToArray();".Replace('@', '"');
   }
   else if (replaceClass.PrimaryKeyType == "Guid")
   {
     newValue3 = string.Empty;
     newValue4 = replaceClass.PrimaryKeyType + "[] deleteId = collection[@query@].GetString().Split(',').Select(s => new Guid(s)).ToArray();".Replace('@', '"');
   }
   else if (replaceClass.PrimaryKeyType == "long")
   {
     newValue3 = string.Empty;
     newValue4 = replaceClass.PrimaryKeyType + "[] deleteId = collection[@query@].GetString().Split(',').Select(s => Convert.ToInt64(s)).ToArray();".Replace('@', '"');
   }
   else if (replaceClass.PrimaryKeyType == "short")
   {
     newValue3 = string.Empty;
     newValue4 = replaceClass.PrimaryKeyType + "[] deleteId = collection[@query@].GetString().Split(',').Select(s => Convert.ToInt16(s)).ToArray();".Replace('@', '"');
   }
   else
     newValue4 = "string[] deleteId = collection[@query@].GetString().Split(',');".Replace('@', '"');
   string newValue5 = string.Empty;
   int num1 = 0;
   foreach (Column column in replaceClass.Columns)
   {
     Column it = column;
     ++num1;
     RefIdName refIdName = new RefIdName();
     if (replaceClass.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId) > 0)
       refIdName = Enumerable.FirstOrDefault<RefIdName>(Enumerable.Where<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId, (Func<RefIdName, bool>) (s => s.Ref == it.Code)));
     if (num1 == 1)
       newValue5 = newValue5 + it.Code + " = s." + it.Code + "\n\t\t\t\t\t";
     else if (refIdName != null && !string.IsNullOrWhiteSpace(refIdName.Id))
       newValue5 = newValue5 + "," + it.Code + " =   s." + it.Code + "Old\n\t\t\t\t\t";
     else
       newValue5 = newValue5 + "," + it.Code + " = s." + it.Code + "\n\t\t\t\t\t";
   }
   if (replaceClass.childTableColumnRef != null)
   {
     Column columnByKey = Common.GetColumnByKey(replaceClass, replaceClass.childTableColumnRef);
     string str6 = string.Empty;
     string str7 = !(replaceClass.PrimaryKeyType == "long") ? (!(replaceClass.PrimaryKeyType == "short") ? (!(replaceClass.PrimaryKeyType == "int") ? (!(replaceClass.PrimaryKeyType == "Guid") ? Common.Read(BaseClass.m_DempDirectory + this.m_TreeController).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace("^parentId^", "parentId") : Common.Read(BaseClass.m_DempDirectory + this.m_TreeController).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace("^parentId^", "new Guid(parentId)")) : Common.Read(BaseClass.m_DempDirectory + this.m_TreeController).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace("^parentId^", "Convert.ToInt32(parentId)")) : Common.Read(BaseClass.m_DempDirectory + this.m_TreeController).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace("^parentId^", "Convert.ToInt16(parentId)")) : Common.Read(BaseClass.m_DempDirectory + this.m_TreeController).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace("^parentId^", "Convert.ToInt64(parentId)");
     Common.Write(BaseClass.m_RootDirectory + "/" + this.m_App + "/" + this.m_Controllers + "/" + replaceClass.Code + "TreeController.cs", str7.Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)));
     fileName.Add("Controllers\\" + replaceClass.Code + "TreeController.cs");
     string content1 = Common.Read(BaseClass.m_DempDirectory + this.m_TreeModel).Replace("ParentId", columnByKey.Code).Replace(this.m_String, nullPrimaryKeyType).Replace("Name", Common.GetShowColumnCode((TableView) replaceClass)).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceAttribute, columnByKey.Code).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass));
     Common.Write(BaseClass.m_RootDirectory + "/" + this.m_App + "/" + this.m_Models + "/" + replaceClass.Code + "TreeModel.cs", content1);
     fileName.Add("Models\\" + replaceClass.Code + "TreeModel.cs");
     string content2 = Common.Read(BaseClass.m_DempDirectory + this.m_TreeIndex).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassCode, replaceClass.Code);
     string path = BaseClass.m_RootDirectory + "/" + this.m_App + this.m_Views + "/" + replaceClass.Code + "Tree";
     Directory.CreateDirectory(path);
     Common.Write(path + "/Index.aspx", content2);
     fileName.Add("Views\\" + replaceClass.Code + "\\Index.aspx");
     int num2 = 0;
     foreach (Column column in replaceClass.Columns)
     {
       Column it = column;
       ++num2;
       RefIdName refIdName = new RefIdName();
       if (replaceClass.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId) > 0)
         refIdName = Enumerable.FirstOrDefault<RefIdName>(Enumerable.Where<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId, (Func<RefIdName, bool>) (s => s.Ref == it.Code)));
       if (num2 == 1)
         str3 = str3 + it.Code + " = s." + it.Code + "\n\t\t\t\t\t";
       else if (it.Id == columnByKey.Id)
         str3 = str3 + ",_parentId =   s." + it.Code + "\n\t\t\t\t\t,state = s." + replaceClass.Code + "1.Any(a => a." + it.Code + " == s." + Common.GetFirstPrimaryKeyCode(replaceClass) + ") ? @closed@ : null\n\t\t\t\t\t".Replace('@', '"');
       else if (refIdName != null && !string.IsNullOrWhiteSpace(refIdName.Id))
         str3 = str3 + "," + it.Code + "Old =   s." + it.Code + "//自连接的表要注意,等号两边可能需要换位\n\t\t\t\t\t";
       else if (it.Code.ToUpper() == "ICONIC")
         str3 = str3 + ",iconCls = s." + it.Code + "\n\t\t\t\t\t";
       else
         str3 = str3 + "," + it.Code + " = s." + it.Code + "\n\t\t\t\t\t";
     }
     newValue1 = newValue1 + "\r\n        /// <summary>\r\n        /// 获取树形列表的数据\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        [HttpPost]\r\n        public ActionResult GetAllMetadata(^string^ id)\r\n        {\r\n            ^ReplaceClassCode^BLL m_BLL = new ^ReplaceClassCode^BLL();\r\n            IQueryable<^ReplaceClassCode^> rows = m_BLL.GetAllMetadata(id);\r\n            if (rows.Any())\r\n            {//是否可以省\r\n                return Json(new treegrid\r\n                {\r\n                    rows = rows.Select(s =>\r\n                        new\r\n                        {\r\n                          ".Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_String, primaryKeyType) + str3 + "\r\n                        }\r\n                        ).OrderBy(o => o.^m_Id^)\r\n                });\r\n            }\r\n            return Content(\"[]\");\r\n        }";
   }
   string content;
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refNotId)
     {
       if (refIdName.IsRefSelf)
       {
         newValue2 = !(replaceClass.PrimaryKeyType == "int") ? (!(replaceClass.PrimaryKeyType == "Guid") ? newValue2 + this.m_Create.Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, refIdName.RefTableCode).Replace("^Name^", refIdName.Name).Replace("^id^", "id") : newValue2 + this.m_Create.Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, refIdName.RefTableCode).Replace("^Name^", refIdName.Name).Replace("^id^", "new Guid(id)")) : newValue2 + this.m_Create.Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, refIdName.RefTableCode).Replace("^Name^", refIdName.Name).Replace("^id^", "Convert.ToInt32(id)");
         newValue1 += this.m_GetTrees.Replace(this.m_ReplaceAttribute, refIdName.RefTableCode).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceClassName, refIdName.RefTableName).Replace("^Name^", Common.GetShowColumnCode((TableView) replaceClass)).Replace(this.m_String, primaryKeyType).Replace('@', '"');
       }
     }
     content = Common.Read(BaseClass.m_DempDirectory + this.m_DuoMoban).Replace("^clomus^", newValue5).Replace(this.m_TreeSef, newValue1).Replace(oldValue, newValue3).Replace(this.m_String, primaryKeyType).Replace(this.m_StringCreate, nullPrimaryKeyType).Replace("^query^", newValue4).Replace(this.m_CreateSef, newValue2).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace(this.m_Application, this.m_App);
   }
   else
     content = Common.Read(BaseClass.m_DempDirectory + this.m_DanMoban).Replace("^clomus^", newValue5).Replace(this.m_CreateSef, newValue2).Replace(oldValue, newValue3).Replace(this.m_String, primaryKeyType).Replace(this.m_StringCreate, nullPrimaryKeyType).Replace("^query^", newValue4).Replace(this.m_TreeSef, newValue1).Replace(this.m_Application, this.m_App).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass));
   string str8 = BaseClass.m_RootDirectory + "/" + this.m_App + "/" + this.m_Controllers + "/";
   foreach (Column column in replaceClass.Columns)
   {
     if (Common.IsCreatePerson(column))
       content = content.Replace("//entity.CreatePerson = currentPerson;", "entity." + column.Code + " = currentPerson;");
     else if (Common.IsCreateTime(column))
       content = content.Replace("//entity.CreateTime = DateTime.Now;", "entity." + column.Code + " = DateTime.Now;");
     else if (Common.IsUpdatePerson(column))
       content = content.Replace("//entity.UpdatePerson = currentPerson;", "entity." + column.Code + " = currentPerson;");
     else if (Common.IsUpdateTime(column))
       content = content.Replace("//entity.UpdateTime = DateTime.Now;", "entity." + column.Code + " = DateTime.Now;");
   }
   Common.Write(str8 + replaceClass.Code + "Controller.cs", content);
   fileName.Add("Controllers\\" + replaceClass.Code + "Controller.cs");
 }
Exemple #10
0
 public bool DoModels(Table replaceClass, ref List<string> fileName)
 {
   int num = 1;
   string newValue = string.Empty;
   if (replaceClass.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refId)
       newValue += this.m_CustomMetadataRef.Replace('@', '"').Replace("Id", refIdName.Ref).Replace("主键", refIdName.RefName);
   }
   if (replaceClass.childTableColumnRef != null)
   {
     Column columnByKey = Common.GetColumnByKey(replaceClass, replaceClass.childTableColumnRef);
     newValue += this.m_CustomMetadataRef.Replace('@', '"').Replace("Id", columnByKey.Code).Replace("主键", columnByKey.Name);
   }
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refNotId)
       newValue += this.m_CustomMetadataNotRef.Replace('@', '"').Replace("Id", refIdName.RefTableCode + refIdName.Id).Replace("主键", refIdName.RefTableName);
   }
   foreach (Column column in replaceClass.Columns)
   {
     if (!string.IsNullOrWhiteSpace(column.Code))
     {
       if (Common.IsPrimaryKey(replaceClass, column.Id))
       {
         this.m_Content.Append("\t\t\t[ScaffoldColumn(false)]\n");
         this.m_Content.Append("\t\t\t[Display(Name = \"" + (object) column.Name + "\", Order = " + (string) (object) num + ")]\n");
         this.m_Content.Append("\t\t\tpublic object " + column.Code + " { get; set; }\n\n");
         ++num;
       }
       else
       {
         this.m_Content.Append("\t\t\t[ScaffoldColumn(true)]\n");
         this.m_Content.Append("\t\t\t[Display(Name = \"" + (object) column.Name + "\", Order = " + (string) (object) num + ")]\n");
         if (!string.IsNullOrWhiteSpace(column.Mandatory) && column.Mandatory.Trim() == "1")
           this.m_Content.Append("\t\t\t[Required(ErrorMessage = @不能为空@)]\n".Replace('@', '"'));
         if (!string.IsNullOrEmpty(column.Length) && Common.IsStringType(column.DataType))
           this.m_Content.Append("\t\t\t[StringLength(" + column.Length + ", ErrorMessage = \"长度不可超过" + column.Length + "\")]\n");
         string code = this.GetCode(column.Code);
         if (string.IsNullOrWhiteSpace(code))
           this.SetAttributeName(column);
         else
           this.m_Content.Append(code);
         if (Common.IsIntType(column.DataType))
           this.m_Content.Append("\t\t\tpublic int? " + column.Code + " { get; set; }\n\n");
         else if (Common.IsDateType(column.DataType))
         {
           if (Common.IsCreateTime(column) || Common.IsUpdateTime(column))
           {
             this.m_Content.Append("\t\t\tpublic DateTime? " + column.Code + " { get; set; }\n\n");
           }
           else
           {
             this.m_Content.Append("\t\t\t[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = \"{0:d}\")]\n\n");
             this.m_Content.Append("\t\t\tpublic DateTime? " + column.Code + " { get; set; }\n\n");
           }
         }
         else
           this.m_Content.Append("\t\t\tpublic object " + column.Code + " { get; set; }\n\n");
         ++num;
       }
     }
   }
   string content = Common.Read(BaseClass.m_DempDirectory + "/Model.cs").Replace(this.m_CustomEntity, newValue).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceAttribute, this.m_Content.ToString()).Replace(BaseClass.m_DALnamespace, replaceClass.NameSpace + "DAL");
   Common.Write(BaseClass.m_RootDirectory + "/" + this.m_DAL + "/" + replaceClass.Code + ".cs", content);
   fileName.Add(replaceClass.Code);
   this.m_Content.Clear();
   return true;
 }
Exemple #11
0
 public static bool IsPrimaryKey(Table table, string id)
 {
   return !string.IsNullOrWhiteSpace(id) && table.PrimaryKey != null && table.PrimaryKey.ColumnRef != null && Enumerable.Contains<string>((IEnumerable<string>) table.PrimaryKey.ColumnRef, id);
 }
Exemple #12
0
 public string DoBLL(Table replaceClass, ref List<string> fileName)
 {
   string newValue1 = string.Empty;
   string newValue2 = string.Empty;
   string newValue3 = string.Empty;
   string str1 = string.Empty;
   string newValue4 = string.Empty;
   string primaryKeyType = replaceClass.PrimaryKeyType;
   string nullPrimaryKeyType = Common.GetNullPrimaryKeyType(replaceClass.PrimaryKeyType);
   if (replaceClass.childTableColumnRef != null)
   {
     Column columnByKey = Common.GetColumnByKey(replaceClass, replaceClass.childTableColumnRef);
     if (string.IsNullOrWhiteSpace(newValue3))
       newValue3 += "\r\n                    foreach (var item in queryData)\r\n                    {";
     newValue3 += this.m_FlexigridSelfRef.Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_ReplaceAttribute, columnByKey.Code).Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).Replace('@', '"');
     int num = 0;
     foreach (Column column in replaceClass.Columns)
     {
       Column it = column;
       if (!Common.IsStampType(it.DataType))
       {
         ++num;
         RefIdName refIdName = new RefIdName();
         if (replaceClass.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId) > 0)
           refIdName = Enumerable.FirstOrDefault<RefIdName>(Enumerable.Where<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId, (Func<RefIdName, bool>) (s => s.Ref == it.Code)));
       }
     }
     newValue2 += "\r\n        public IQueryable<^ReplaceClassCode^> GetAllMetadata(^string^ id)\r\n        { \r\n            if (id == null)\r\n            {\r\n                return db.^ReplaceClassCode^.Where(w => w.^ParentId^ == null).AsQueryable();\r\n            }\r\n            else\r\n            {\r\n                return db.^ReplaceClassCode^.Where(w => w.^ParentId^ == id).AsQueryable();\r\n            }\r\n        }\r\n".Replace("^ParentId^", columnByKey.Code).Replace(this.m_String, primaryKeyType);
   }
   if (replaceClass.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refId) > 0)
   {
     foreach (RefIdName refIdName in replaceClass.refId)
     {
       if (string.IsNullOrWhiteSpace(newValue3))
         newValue3 += "\r\n                    foreach (var item in queryData)\r\n                    {";
       newValue3 += this.m_FlexigridRef.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.Ref).Replace(this.m_Name, refIdName.Name).Replace('@', '"');
       newValue4 += this.m_ByRefId.Replace(this.m_String, refIdName.RefType).Replace(this.m_ReplaceClassCode, refIdName.Ref).Replace(this.m_ReplaceAttribute, replaceClass.Name).Replace(this.m_ReplaceClassName, replaceClass.Code).Replace('@', '"');
     }
   }
   string str2;
   if (replaceClass.refNotId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) replaceClass.refNotId) > 0)
   {
     string newValue5 = string.Empty;
     string newValue6 = string.Empty;
     string newValue7 = string.Empty;
     foreach (RefIdName refIdName in replaceClass.refNotId)
     {
       if (string.IsNullOrWhiteSpace(newValue3))
         newValue3 += "\r\n                    foreach (var item in queryData) \r\n                    {";
       newValue3 += this.m_FlexigridNotRef.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_Name, refIdName.Name).Replace('@', '"');
       if (refIdName.RefType == "int")
       {
         newValue6 += this.m_CreateDown.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_Id, refIdName.Id).Replace("^item^", "Convert.ToInt32(item)");
         newValue5 += this.m_EditDown.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_Id, refIdName.Id).Replace("^item^", "Convert.ToInt32(item)");
       }
       else if (refIdName.RefType == "Guid")
       {
         newValue6 += this.m_CreateDown.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_Id, refIdName.Id).Replace("^item^", "new Guid(item)");
         newValue5 += this.m_EditDown.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_Id, refIdName.Id).Replace("^item^", "new Guid(item)");
       }
       else
       {
         newValue6 += this.m_CreateDown.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_Id, refIdName.Id).Replace("^item^", "item");
         newValue5 += this.m_EditDown.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_Id, refIdName.Id).Replace("^item^", "item");
       }
       if (refIdName.IsRefSelf)
       {
         newValue7 += this.m_ReplaceFlexigridSefContent.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace('@', '"');
         newValue1 = !(refIdName.RefType == "int") ? (!(refIdName.RefType == "Guid") ? newValue1 + this.m_SetToMany.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_PickTimeCrea, replaceClass.Code).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_ReplaceClassName, refIdName.RefTableName).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace('@', '"').Replace("^item^", "item") : newValue1 + this.m_SetToMany.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_PickTimeCrea, replaceClass.Code).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_ReplaceClassName, refIdName.RefTableName).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace('@', '"').Replace("^item^", "new Guid(item)")) : newValue1 + this.m_SetToMany.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace(this.m_PickTimeCrea, replaceClass.Code).Replace(this.m_ReplaceAttribute, refIdName.RefTableCode + refIdName.Id).Replace(this.m_ReplaceClassName, refIdName.RefTableName).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace('@', '"').Replace("^item^", "Convert.ToInt32(item)");
       }
       newValue1 += this.m_RefGetSelectDuo.Replace(this.m_ReplaceClassCode, refIdName.RefTableCode).Replace('@', '"');
     }
     if (!string.IsNullOrWhiteSpace(newValue3))
       newValue3 += "\r\n                    }\r\n";
     str2 = Common.Read(BaseClass.m_DempDirectory + this.m_DuoMoban).Replace(this.m_RefGetSelectList, newValue1).Replace(this.m_ReplaceFlexigridSef, newValue7).Replace(this.m_CopyMetadata, string.IsNullOrWhiteSpace(newValue2) ? "" : this.m_CopyMetadata2.Replace(this.m_CopyMetadata, newValue2)).Replace(this.m_ReplaceFlexigrid, newValue3).Replace(this.m_DuoRefCreateDown, newValue6).Replace(this.m_DuoRefEditDown, newValue5).Replace(this.m_GetByRefId, newValue4).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace(this.m_String, primaryKeyType);
   }
   else
   {
     if (!string.IsNullOrWhiteSpace(newValue3))
       newValue3 += "\r\n                    }\r\n";
     str2 = Common.Read(BaseClass.m_DempDirectory + this.m_DanMoban).Replace(this.m_CopyMetadata, string.IsNullOrWhiteSpace(newValue2) ? "" : this.m_CopyMetadata2.Replace(this.m_CopyMetadata, newValue2)).Replace(this.m_ReplaceFlexigrid, newValue3).Replace(this.m_RefGetSelectList, newValue1).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_GetByRefId, newValue4).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, Common.GetFirstPrimaryKeyCode(replaceClass)).Replace(this.m_String, primaryKeyType);
   }
   string newValue8 = string.Empty;
   foreach (Column column in replaceClass.Columns)
   {
     if (column.Comment.Contains("Sort"))
     {
       newValue8 = newValue8 + ".OrderBy(o => o." + column.Code + ")";
       break;
     }
   }
   if (string.IsNullOrEmpty(newValue8))
   {
     if (Common.GetFirstPrimaryKey(replaceClass) == null)
       return replaceClass.Name + ",表没有主键";
     newValue8 = ".OrderBy(o => o." + Common.GetFirstPrimaryKey(replaceClass).Code + ")";
   }
   string content = str2.Replace("^m_Sort^", newValue8).Replace(BaseClass.m_BLLnamespace, replaceClass.NameSpace + "BLL").Replace(this.m_StringCreate, nullPrimaryKeyType).Replace(BaseClass.m_DALnamespace, replaceClass.NameSpace + "DAL");
   Common.Write(BaseClass.m_RootDirectory + "/" + this.m_BLL + "/" + replaceClass.Code + this.m_BLL + ".cs", content);
   fileName.Add(replaceClass.Code);
   this.m_Content.Clear();
   return string.Empty;
 }
Exemple #13
0
 public static RefIdName GetForeignKey(Table table, Column column)
 {
   if (table.refId != null && Enumerable.Count<RefIdName>((IEnumerable<RefIdName>) table.refId) > 0)
     return Enumerable.FirstOrDefault<RefIdName>(Enumerable.Where<RefIdName>((IEnumerable<RefIdName>) table.refId, (Func<RefIdName, bool>) (f => column.Code == f.Ref)));
   return (RefIdName) null;
 }
Exemple #14
0
 public static string PrimaryKeyType(Table table)
 {
   if (table != null && table.PrimaryKey != null)
   {
     IEnumerable<Column> source1 = Enumerable.Where<Column>(Enumerable.Where<Column>((IEnumerable<Column>) table.Columns, (Func<Column, bool>) (f => Enumerable.Contains<string>((IEnumerable<string>) table.PrimaryKey.ColumnRef, f.Id))), (Func<Column, bool>) (f => Common.IsLongType(f.DataType)));
     if (source1 != null && Enumerable.Count<Column>(source1) > 0)
       return "long";
     IEnumerable<Column> source2 = Enumerable.Where<Column>(Enumerable.Where<Column>((IEnumerable<Column>) table.Columns, (Func<Column, bool>) (f => Enumerable.Contains<string>((IEnumerable<string>) table.PrimaryKey.ColumnRef, f.Id))), (Func<Column, bool>) (f => Common.IsShotType(f.DataType)));
     if (source2 != null && Enumerable.Count<Column>(source2) > 0)
       return "short";
     IEnumerable<Column> source3 = Enumerable.Where<Column>(Enumerable.Where<Column>((IEnumerable<Column>) table.Columns, (Func<Column, bool>) (f => Enumerable.Contains<string>((IEnumerable<string>) table.PrimaryKey.ColumnRef, f.Id))), (Func<Column, bool>) (f => Common.IsIntType(f.DataType)));
     if (source3 != null && Enumerable.Count<Column>(source3) > 0)
       return "int";
     IEnumerable<Column> source4 = Enumerable.Where<Column>(Enumerable.Where<Column>((IEnumerable<Column>) table.Columns, (Func<Column, bool>) (f => Enumerable.Contains<string>((IEnumerable<string>) table.PrimaryKey.ColumnRef, f.Id))), (Func<Column, bool>) (f => Common.IsUniqueidentifierType(f.DataType)));
     if (source4 != null && Enumerable.Count<Column>(source4) > 0)
       return "Guid";
   }
   return "string";
 }
Exemple #15
0
 public static Column GetColumnByKey(Table table, string id)
 {
   if (table != null && table.Columns != null && Enumerable.Count<Column>((IEnumerable<Column>) table.Columns) > 0)
     return Enumerable.SingleOrDefault<Column>(Enumerable.Where<Column>((IEnumerable<Column>) table.Columns, (Func<Column, bool>) (f => id == f.Id)));
   return (Column) null;
 }
Exemple #16
0
 public static string GetFirstPrimaryKeyName(Table table)
 {
   if (Common.GetFirstPrimaryKey(table) != null)
     return Common.GetFirstPrimaryKey(table).Name;
   return string.Empty;
 }
Exemple #17
0
 public static Column GetFirstPrimaryKey(Table table)
 {
   if (table != null && table.PrimaryKey != null && table.PrimaryKey.ColumnRef != null)
     return Enumerable.FirstOrDefault<Column>(Enumerable.Where<Column>((IEnumerable<Column>) table.Columns, (Func<Column, bool>) (f => f.Id == Enumerable.FirstOrDefault<string>((IEnumerable<string>) table.PrimaryKey.ColumnRef))));
   return (Column) null;
 }
Exemple #18
0
 public static bool ExitsPrimaryKey(Table table)
 {
   return table != null && table.PrimaryKey != null && table.PrimaryKey.ColumnRef != null;
 }