public void DoRepository(View replaceClass, ref List<string> fileName) { string newValue = string.Empty; string content = Common.Read(BaseClass.m_DempDirectory + this.m_ViewDanMoban).Replace(this.m_ReplaceClassName, replaceClass.Name).Replace(this.m_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, replaceClass.Columns[0].Code).Replace(this.m_ReposDan, newValue).Replace(BaseClass.m_DALnamespace, replaceClass.NameSpace + "DAL"); Common.Write(BaseClass.m_RootDirectory + "/" + this.m_DAL + "/" + replaceClass.Code + "Repository.cs", content); fileName.Add(replaceClass.Code); }
public void DoIRepository(View 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 content = Common.Read(BaseClass.m_DempDirectory + this.m_ViewIRepository).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_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); }
public bool DoModels(View replaceClass, ref List<string> fileName) { int num = 1; string newValue = string.Empty; foreach (Column column in replaceClass.Columns) { if (!string.IsNullOrWhiteSpace(column.Code)) { if (!string.IsNullOrWhiteSpace(column.Name)) this.m_Content.Append("\t\t\t[Display(Name = \"" + (object) column.Name + "\", Order = " + (string) (object) num + ")]\n"); else this.m_Content.Append("\t\t\t[Display(Name = \"" + (object) column.Code + "\", Order = " + (string) (object) num + ")]\n"); this.m_Content.Append("\t\t\tpublic object " + column.Code + " { get; set; }\n\n"); ++num; } } string content = Common.Read(BaseClass.m_DempDirectory + "/ViewModel.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; }
public void DoControllers(View replaceClass, ref List<string> fileName) { string newValue1 = string.Empty; string newValue2 = string.Empty; string newValue3 = string.Empty; int num = 0; foreach (Column column in replaceClass.Columns) { ++num; if (num == 1) newValue3 = newValue3 + column.Code + " = s." + column.Code + "\n\t\t\t\t\t"; else newValue3 = newValue3 + "," + column.Code + " = s." + column.Code + "\n\t\t\t\t\t"; } string content = Common.Read(BaseClass.m_DempDirectory + this.m_ViewDanMoban).Replace("^clomus^", newValue3).Replace(this.m_CreateSef, newValue2).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, replaceClass.Columns[0].Code); string path = BaseClass.m_RootDirectory + "/" + this.m_App + "/" + this.m_Controllers + "/"; Directory.CreateDirectory(path); Common.Write(path + replaceClass.Code + "Controller.cs", content); fileName.Add("Controllers\\" + replaceClass.Code + "Controller.cs"); }
public void DoIndex(View 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 flag = false; int num1 = replaceClass.Columns.Count - 4; if (num1 <= 0) num1 = 3; int num2 = 678 / num1; int num3 = 582 / num1; int num4 = 0; string str3 = string.Empty; string newValue4 = string.Empty; foreach (Column column in replaceClass.Columns) { if (Common.IsSort(column.Comment)) newValue4 = column.Code; if (!Common.IsNotDisplay(column.Comment)) { ++num4; if (num4 == 1) str2 = str2 + (object) "\n\t\t\t\t\t{ field: '" + column.Code + "', title: '<%: Html.DisplayNameFor(model => model." + column.Code + ") %>', width: " + (string) (object) num2 + " }"; else if (Common.IsDateType(column.DataType)) str2 = str2 + (object) "\n\t\t\t\t\t,{ field: '" + column.Code + "', title: '<%: Html.DisplayNameFor(model => model." + column.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(column.DataType)) str2 = str2 + (object) "\n\t\t\t\t\t,{ field: '" + column.Code + "', title: '<%: Html.DisplayNameFor(model => model." + column.Code + ") %>', width: " + (string) (object) num2 + ", hidden: true }"; else str2 = str2 + (object) "\n\t\t\t\t\t,{ field: '" + column.Code + "', title: '<%: Html.DisplayNameFor(model => model." + column.Code + ") %>', width: " + (string) (object) num2 + " }"; if (!string.IsNullOrWhiteSpace(column.Comment) && column.Comment.Contains("Research")) { if (Common.IsIntType(column.DataType)) newValue2 += this.m_SearchInt.Replace(this.m_ReplaceAttribute, column.Code).Replace('\'', '"'); else if (Common.IsDateType(column.DataType)) { if (!flag) { newValue3 += this.m_PickTime.Replace(this.m_ReplaceAttribute, column.Code); flag = true; } newValue2 += this.m_SearchDateTime.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"'); } else if (column.Comment.Contains("DropDown")) newValue2 += this.m_SearchZhuangtai.Replace(this.m_ReplaceClassCode, column.TableCode).Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"'); else if (column.Comment.Contains("Equal")) { newValue2 += this.m_SearchEqString.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"'); } else { newValue2 += this.m_SearchString.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"'); newValue1 += this.m_SearchAuto.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"'); } } else if (!string.IsNullOrWhiteSpace(column.Comment) && column.Comment.Contains("Equal")) newValue2 += this.m_SearchEqString.Replace(this.m_ReplaceAttribute, column.Code).Replace('@', '"'); } } foreach (Column column in replaceClass.Columns) { if (Common.IsSort(column.Comment)) { newValue4 = column.Code; break; } } if (string.IsNullOrEmpty(newValue4)) newValue4 = replaceClass.Columns[0].Code; string newValue5 = str2 + str1; string content = Common.Read(BaseClass.m_DempDirectory + "/ViewIndex.aspx").Replace(this.m_Id, newValue4).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, newValue5).Replace(this.m_Name, Common.GetShowColumnCode((TableView) replaceClass)).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 + "/Index.aspx", content); fileName.Add(replaceClass.Code + "/Index.aspx"); }
public bool DoBLL(View replaceClass, ref List<string> fileName) { string newValue1 = string.Empty; string newValue2 = string.Empty; string newValue3 = string.Empty; string str = string.Empty; if (!string.IsNullOrWhiteSpace(newValue3)) newValue3 += "\r\n }\r\n"; string content = Common.Read(BaseClass.m_DempDirectory + this.m_ViewDanMoban).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_ReplaceClassCode, replaceClass.Code).Replace(this.m_Id, replaceClass.Columns[0].Code).Replace(BaseClass.m_BLLnamespace, replaceClass.NameSpace + "BLL").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 true; }
public static List<View> ConvertT(List<ViewData> dataSourse) { List<View> list = new List<View>(); if (dataSourse != null) { foreach (ViewData viewData in dataSourse) { View view = new View(); view.Code = viewData.Code; view.Columns = viewData.Columns; view.Id = viewData.Id; view.Name = viewData.Name; view.SQLQuery = viewData.SQLQuery; list.Add(view); } } return list; }