//------------------------------------------------------------------------------------------------------ #endregion public CustomDatabase(Database db) { _dbObject = db; _ProgramatlyName = Globals.GetProgramatlyName(NameInDatabase); //ProjectBuilder.Init(_ProgramatlyName); _Tables = new List <CustomTable>(); CustomTable table = null; //string requiredTables = @"LK_BudgetCategories "; foreach (Table t in _dbObject.Tables) { //if (!requiredTables.Contains(t.Name)) // continue; if (!t.IsSystemObject) { table = new CustomTable(t); Tables.Add(table); } } //read relation foreach (CustomTable ct in this.Tables) { foreach (CustomColumn c in ct.ForeignKeys) { GetRelatedTable(ct.dbObject.ForeignKeys, c); } } }
public static void Create(CustomTable t) { DtoBuilder builder = new DtoBuilder(t); string EntityFile = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Dto.cs"); string genEntityFile = builder.Prepare(EntityFile); FileManager.SaveFile(".cs", builder.CurrentTable.PathOfDtoClass, genEntityFile); }
public static void Create(CustomTable t) { FactoryBuilder factory = new FactoryBuilder(t); string FactoryFile = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Factory.cs"); string genFactoryFile = factory.Prepare(FactoryFile); FileManager.SaveFile(".cs", factory.CurrentTable.PathOfFactoryClass, genFactoryFile); }
public static void Create(CustomTable t) { ModelBuilder sqlProvider = new ModelBuilder(t); string EntityFile = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Entity.cs"); string genEntityFile = sqlProvider.Prepare(EntityFile); FileManager.SaveFile(".cs", sqlProvider.CurrentTable.PathOfModelClass, genEntityFile); }
public static void Create(CustomTable t) { RepositoryBuilder builder = new RepositoryBuilder(t); string repositoryFile = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Repository.cs"); string genFactoryFile = builder.Prepare(repositoryFile); FileManager.SaveFile(".cs", builder.CurrentTable.PathOfRepositoryFile, genFactoryFile); }
public static void Create(CustomTable t) { ControllerBuilder builder = new ControllerBuilder(t); string templatefile = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Controller.cs"); string genratedCode = builder.Prepare(templatefile); FileManager.SaveFile(".cs", builder.CurrentTable.PathOfControllerFile, genratedCode); }
public new static void Create(CustomTable t) { SqlProviderBuilder sqlProvider = new SqlProviderBuilder(t); string SqlDataProviderFile = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/SqlDataProvider.cs"); string genSqlDataProviderFile = sqlProvider.Prepare(SqlDataProviderFile); FileManager.SaveFile(".cs", sqlProvider.CurrentTable.PathOfSqlDataPrviderClass, genSqlDataProviderFile); }
public static void Create(CustomTable t) { ApplicationServiceBuilder builder = new ApplicationServiceBuilder(t); string fileCode = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Service.cs"); string generatedCode = builder.GenerateAllCode(); string tempCode = fileCode.Replace("$code$", generatedCode); string finalCode = builder.Prepare(tempCode); FileManager.SaveFile(".cs", builder.CurrentTable.PathOfApplicatioServiceFile, finalCode); }
//------------------------------------------------------------------------------------------------------ #endregion public static void Create(CustomTable t) { StoredProcedureBuilder sp = new StoredProcedureBuilder(t); string proc = sp.GenerateInsertProcedure(); WriteStoredProcedure(proc); proc += sp.GenerateUpdatePrcedure(); proc += sp.GenerateDeletePrcedure(); proc += sp.GenerateGet(); if (sp.CurrentTable.ID != null) { proc += sp.GenerateGetPageByPage(); } FileManager.SaveFile(".Sql", sp.CurrentTable.PathOfStoredProcerduresFile, proc); //WriteStoredProcedure(proc); }
//------------------------------------------------------------------------------------------------------ #endregion public CustomDatabase(Database db) { _dbObject = db; _ProgramatlyName = Globals.GetProgramatlyName(NameInDatabase); //ProjectBuilder.Init(_ProgramatlyName); _Tables = new List <CustomTable>(); CustomTable table = null; foreach (Table t in _dbObject.Tables) { if (!t.IsSystemObject) { table = new CustomTable(t); Tables.Add(table); } } }
public CustomColumn(Column c, CustomTable parentTable, string tableName, string tableProgramatlyName) { _dbObject = c; ParentTable = parentTable; TableName = tableName; TableProgramatlyName = tableProgramatlyName; ProgramatlyName = Globals.GetProgramatlyName(NameInDatabase); FriendlyName = Globals.GetFriendlyName(ProgramatlyName); LowerProgramatlyName = ProgramatlyName.ToLower(); InputType = SetInputType(); if (c.DefaultConstraint != null) { HasDefaultValue = true; DefaultValue = GetDefaultValue(); } //set data type and complete column analysis SetDataTypes(); }
public FactoryBuilder(CustomTable t) { CurrentTable = t; init(); }
public static void Create(CustomTable t) { }
public DtoBuilder(CustomTable t) { CurrentTable = t; init(); }
public RepositoryBuilder(CustomTable t) { CurrentTable = t; init(); }
public ControllerBuilder(CustomTable t) { CurrentTable = t; Init(); }
public ModelBuilder(CustomTable t) { CurrentTable = t; init(); }
public ApplicationServiceBuilder(CustomTable t) { CurrentTable = t; init(); }
public StoredProcedureBuilder(CustomTable t) { _CurrentTable = t; }
public FormConfigurationBuilder(CustomTable t) { CurrentTable = t; init(); }
public SqlProviderBuilder(CustomTable t) { CurrentTable = t; init(); }
private void init() { /////////////////////////////////////////////////////////////////////// //Calculate flexigrid column width int flexigridColumns = CurrentTable.Columns.Count; if (CurrentTable.ID != null) { --flexigridColumns; } int columnWidth = (ResourcesParameters.FlexiGridWidth / flexigridColumns); /////////////////////////////////////////////////////////////////////// string flwxiGridColumnsPattern = "\t\t\t\tnew FlexigridColumn(\"{0}\",\"{0}\",{1},true,\"left\",false,false)"; string ParametersToCreateFlexiJsonPattern = "\t\t\t\t\t\t\t\t\t\t\t\t\t\tx.{0}"; //string forignkeysCodePatern = "\t\t\t\tViewData[\"{0}\"] = {1}.{2}().Select(x => new SelectListItem { Text = x.{3}, Value = x.{4}.ToString() }).ToList();"; CustomColumn c = null; for (int i = 0; i < CurrentTable.Columns.Count - 1; i++) { c = CurrentTable.Columns[i]; if (!c.InPrimaryKey) { c = CurrentTable.Columns[i]; FlexiGridColumns.AppendFormat(flwxiGridColumnsPattern, new string[] { c.ProgramatlyName, columnWidth.ToString() }); FlexiGridColumns.Append(",\n"); if (c.DotNetType == typeof(DateTime)) { ParametersToCreateFlexiJson.AppendFormat(ParametersToCreateFlexiJsonPattern + ".ToString(\"MM/dd/yyyy\")", new string[] { c.ProgramatlyName }); } else { ParametersToCreateFlexiJson.AppendFormat(ParametersToCreateFlexiJsonPattern, new string[] { c.ProgramatlyName }); } ParametersToCreateFlexiJson.Append(",\n"); } } c = CurrentTable.Columns[CurrentTable.Columns.Count - 1]; FlexiGridColumns.AppendFormat(flwxiGridColumnsPattern, new string[] { c.ProgramatlyName, columnWidth.ToString() }); if (c.DotNetType == typeof(DateTime)) { ParametersToCreateFlexiJson.AppendFormat(ParametersToCreateFlexiJsonPattern + ".ToString(\"MM/dd/yyyy\")", new string[] { c.ProgramatlyName }); } else { ParametersToCreateFlexiJson.AppendFormat(ParametersToCreateFlexiJsonPattern, new string[] { c.ProgramatlyName }); } //----------------------------------------------------------------------------------------------------------------- CustomTable tableOfRelation = null; string columnOFTextFeild = ""; string forignkyText = ""; string primaryKeyText = ""; ForeignKeyColumn rc = null; //------------------------------- foreach (ForeignKey r in CurrentTable.dbObject.ForeignKeys) { tableOfRelation = null; columnOFTextFeild = ""; forignkyText = ""; primaryKeyText = ""; rc = null; if (r != null) { rc = r.Columns[0]; forignkyText = Globals.GetProgramatlyName(rc.Name); primaryKeyText = Globals.GetProgramatlyName(rc.ReferencedColumn); tableOfRelation = ProjectBuilder.db.GetTable(r.ReferencedTable); columnOFTextFeild = tableOfRelation.FirstStringColumnName; ForignkeysCode.Append("\n\t\t\tViewData[\"" + forignkyText + "\"] = " + tableOfRelation.FactoryClass + "." + tableOfRelation.MethodGet + "().Select(x => new SelectListItem { Text = x." + columnOFTextFeild + ", Value = x." + primaryKeyText + ".ToString() }).ToList();"); } } //------------------------------------------------------------------------ }