private string GetWordByCodeToGenerateType(CodeToGenerateType codeToGenerateType)
        {
            switch (codeToGenerateType)
            {
            case CodeToGenerateType.DataLayerBase:
                return(MyConstants.WordDataLayerBase);

            case CodeToGenerateType.DataLayer:
                return(MyConstants.WordDataLayer);

            case CodeToGenerateType.BusinessObjectBase:
                return(MyConstants.WordBase);

            case CodeToGenerateType.BusinessObject:
                return(string.Empty);

            case CodeToGenerateType.CodeExample:
                return(MyConstants.WordExample);

            case CodeToGenerateType.StoredProcedure:
                return(string.Empty);

            case CodeToGenerateType.DynamicSql:
                return(MyConstants.WordSQL);

            case CodeToGenerateType.Models:
                return(MyConstants.WordModel);

            case CodeToGenerateType.ModelsBase:
                return(MyConstants.WordModelBase);

            default:
                return((string)null);
            }
        }
 private void GenerateTagsAfterLinks(StringBuilder sb, CodeToGenerateType codeToGenerateType)
 {
     sb.AppendLine("                </ul>");
     sb.AppendLine("            </td>");
     sb.AppendLine("            <td style=\"vertical-align: top;\">");
     this.GenerateFeaturesForCodeToGenerate(sb, codeToGenerateType);
     sb.AppendLine("            </td>");
     sb.AppendLine("        </tr>");
 }
 private void WriteLinks(StringBuilder sb, string title, CodeToGenerateType codeToGenerateType)
 {
     this.GenerateTagsBeforeLinks(sb, title);
     if (codeToGenerateType == CodeToGenerateType.Helper || codeToGenerateType == CodeToGenerateType.DomainHelper)
     {
         this.GenerateLinks(sb, codeToGenerateType, (Table)null);
     }
     else
     {
         foreach (Table selectedTable in (List <Table>) this._selectedTables)
         {
             if (!selectedTable.IsContainsPrimaryAndForeignKeyColumnsOnly)
             {
                 this.GenerateLinks(sb, codeToGenerateType, selectedTable);
             }
         }
     }
     this.GenerateTagsAfterLinks(sb, codeToGenerateType);
 }
        private string GetFolderByCodeToGenerateType(CodeToGenerateType codeToGenerateType)
        {
            switch (codeToGenerateType)
            {
            case CodeToGenerateType.DataLayerBase:
                return(MyConstants.DirectoryDataLayerBase);

            case CodeToGenerateType.DataLayer:
                return(MyConstants.DirectoryDataLayer);

            case CodeToGenerateType.BusinessObjectBase:
                return(MyConstants.DirectoryBusinessObjectBase);

            case CodeToGenerateType.BusinessObject:
                return(MyConstants.DirectoryBusinessObject);

            case CodeToGenerateType.BusinessObjectCollection:
                return(MyConstants.DirectoryBusinessObjectCollection);

            case CodeToGenerateType.CodeExample:
                return(MyConstants.DirectoryExamples);

            case CodeToGenerateType.StoredProcedure:
                return(MyConstants.DirectoryDynamicSQL);

            case CodeToGenerateType.DynamicSql:
                return(MyConstants.DirectoryDynamicSQL);

            case CodeToGenerateType.Models:
                return(MyConstants.DirectoryModels);

            case CodeToGenerateType.ModelsBase:
                return(MyConstants.DirectoryModelsBase);

            default:
                return((string)null);
            }
        }
예제 #5
0
 private void GenerateLinks(StringBuilder sb, CodeToGenerateType codeToGenerateType, Table table)
 {
     if (codeToGenerateType == CodeToGenerateType.Helper)
     {
         if (this._appType == ApplicationType.ASPNET45)
         {
             sb.AppendLine("                    <li>Dbase" + this._fileExtension + "</li>");
             if (!this._isFormsGenProduct)
             {
                 return;
             }
             sb.AppendLine("                    <li>Functions" + this._fileExtension + "</li>");
         }
         else
         {
             sb.AppendLine("                    <li><a href=\"" + this._directory + "\\Helper\\Dbase" + this._fileExtension + "\">Dbase" + this._fileExtension + "</a></li>");
             if (!this._isFormsGenProduct)
             {
                 return;
             }
             sb.AppendLine("                    <li><a href=\"" + this._directory + "\\Helper\\Functions" + this._fileExtension + "\">Functions" + this._fileExtension + "</a></li>");
         }
     }
     else
     {
         string codeToGenerateType1 = this.GetWordByCodeToGenerateType(codeToGenerateType);
         string str1 = table.Name + codeToGenerateType1 + this._fileExtension;
         if (this._appType == ApplicationType.ASPNET45)
         {
             sb.AppendLine("                    <li>" + str1 + "</li>");
         }
         else
         {
             string str2 = this._directory + this.GetFolderByCodeToGenerateType(codeToGenerateType) + table.Name + codeToGenerateType1 + this._fileExtension;
             sb.AppendLine("                    <li><a href=\"" + str2 + "\">" + str1 + "</a></li>");
         }
     }
 }
        private void GenerateLinks(StringBuilder sb, CodeToGenerateType codeToGenerateType, Table table)
        {
            switch (codeToGenerateType)
            {
            case CodeToGenerateType.Helper:
                if (!this._isFormsGenProduct)
                {
                    break;
                }
                sb.AppendLine("                    <li>Functions" + this._fileExtension + "</li>");
                break;

            case CodeToGenerateType.DomainHelper:
                sb.AppendLine("                    <li>CrudOperation" + this._fileExtension + "</li>");
                sb.AppendLine("                    <li>FieldType" + this._fileExtension + "</li>");
                break;

            default:
                string codeToGenerateType1 = this.GetWordByCodeToGenerateType(codeToGenerateType);
                string str = table.Name + codeToGenerateType1 + this._fileExtension;
                sb.AppendLine("                    <li>" + str + "</li>");
                break;
            }
        }
        private void GenerateFeaturesForCodeToGenerate(StringBuilder sb, CodeToGenerateType codeToGenerateType)
        {
            switch (codeToGenerateType)
            {
            case CodeToGenerateType.DataLayerBase:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Used as the base class to the Data Layer class</b></li>");
                sb.AppendLine("                    <li><b>Do not add or edit code here</b></li>");
                sb.AppendLine("                    <li>Encapsulates calls to Stored Procedures or Dynamic SQL</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryDataLayerBase + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.DataLayer:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Used as the gateway data layer object the middle tier objects call</b></li>");
                sb.AppendLine("                    <li>Inherits from the respective DataLayerBase class</li>");
                sb.AppendLine("                    <li>You can add additional code here (it will not be overwritten by the generator)</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryDataLayer + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.BusinessObjectBase:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Used as the base class to the Business Object class</b></li>");
                sb.AppendLine("                    <li><b>Do not add or edit code here</b></li>");
                sb.AppendLine("                    <li>Contains table fields as properties</li>");
                sb.AppendLine("                    <li>Encapsulates calls to the data layer</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryBusinessObjectBase + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.BusinessObject:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li style=\"color: red;\"><b>Note: The only code you call from your application</b></li>");
                sb.AppendLine("                    <li><b>Used as the gateway middle layer object the client calls</b></li>");
                sb.AppendLine("                    <li>Most CRUD calls can be made in one (1) line of code</li>");
                sb.AppendLine("                    <li>Inherits from the respective BusinessObjectBase class</li>");
                sb.AppendLine("                    <li>You can add additional code here (it will not be overwritten by the generator)</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryBusinessObject + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.BusinessObjectCollection:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Used as the Collection of the Business Object Class</b></li>");
                sb.AppendLine("                    <li><b>Do not add or edit code here</b></li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryBusinessObjectCollection + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.CodeExample:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li style=\"color: red;\"><b>Generated solely to show how to use the Generated Code</b></li>");
                sb.AppendLine("                    <li>Example code can be copied and pasted directly to your client code (ASP.Net web forms, Win Forms, Web Services, etc.)</li>");
                sb.AppendLine("                    <li>You can delete the whole directory if you don't need it</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryExamples + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.StoredProcedure:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Created in the database and used for CRUD operations</b></li>");
                sb.AppendLine("                    <li><b>Do not rewrite or edit generated stored procedure, instead, add a new one</b></li>");
                sb.AppendLine("                    <li>Generated Stored Procedures may include; select all, select by primary key, insert, update, delete, select/skip/take, select dynamic (search), get record count and more operations</li>");
                sb.AppendLine("                    <li>Generated only when the Stored Procedure option is selected</li>");
                sb.AppendLine("                    <li>At least 5 Stored Procedures are generated per table (for most tables)</li>");
                sb.AppendLine("                    <li>Located directly in the database</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.DynamicSql:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Contains T-SQL CRUD (AD HOC) operations in the code</b></li>");
                sb.AppendLine("                    <li><b>Do not rewrite or edit generated Dynamic SQL, instead, new dynamic sql should be added in the DataLayer class (please see tutorial)</b></li>");
                sb.AppendLine("                    <li>Generated Dynamic SQL may include; select all, select by primary key, insert, update, delete, select/skip/take, select dynamic (search), get record count and more operations</li>");
                sb.AppendLine("                    <li>Generated only when the Dynamic SQL option is selected</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryDynamicSQL + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.Helper:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Contains minimal helper methods</b></li>");
                if (this._isFormsGenProduct)
                {
                    sb.AppendLine("                    <li>Functions" + this._fileExtension + " contains static/shared functions/methods used in GridViews</li>");
                }
                sb.AppendLine("                    <li>Located in the \\Helper\\ folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.Models:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Inherited by the Business Object Base class</b></li>");
                sb.AppendLine("                    <li>Inherits from the respective ModelBase class</li>");
                sb.AppendLine("                    <li>You can add additional code (properties) here (it will not be overwritten by the generator)</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryModels + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.ModelsBase:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Used as the base class to the Models class</b></li>");
                sb.AppendLine("                    <li><b>Promotes code separation.  Fields are separated from the Business Object Base class and placed here instead.</b></li>");
                sb.AppendLine("                    <li><b>Do not add or edit code here</b></li>");
                sb.AppendLine("                    <li>Contains table fields as properties</li>");
                sb.AppendLine("                    <li>Properties contain Data Annotation attributes used for model validation</li>");
                sb.AppendLine("                    <li>One Class is generated per table</li>");
                sb.AppendLine("                    <li>Located in the " + MyConstants.DirectoryModelsBase + " folder</li>");
                sb.AppendLine("                </ul>");
                break;

            case CodeToGenerateType.DomainHelper:
                sb.AppendLine("                <ul>");
                sb.AppendLine("                    <li><b>Contains helper enum methods</b></li>");
                sb.AppendLine("                    <li>Located in the \\Domain\\ folder</li>");
                sb.AppendLine("                </ul>");
                break;
            }
        }