示例#1
0
    private string getUpdateObject(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "Private Function update" + pClass.Name.Capitalized() + "(ByVal my" + pClass.Name.Capitalized() + " As " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized() + ") As Boolean");
            strB.AppendLine(Strings.Space((int)tab.XX) + "If my" + pClass.Name.Capitalized() + ".dbUpdate() > 0 Then");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addSuccess(StringToolkit.getDatabaseSuccessString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit))");
            strB.AppendLine(Strings.Space((int)tab.XX) + "Else");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addError(StringToolkit.getDatabaseErrorString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit))");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End If");
            strB.AppendLine(Strings.Space((int)tab.X) + "End Function");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "private bool update" + pClass.Name.Capitalized() + "(" + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized() + " my" + pClass.Name.Capitalized() + ")");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "if (my" + pClass.Name.Capitalized() + ".dbUpdate() > 0)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addSuccess(StringToolkit.getDatabaseSuccessString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit));");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX) + "else");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addError(StringToolkit.getDatabaseErrorString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit));");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.X) + "}");
        }
        return(strB.ToString());
    }
示例#2
0
    private static string getPropertyText(ProjectClass pClass, ClassVariable classVar, string namSpace,
                                          language lang, CodeGeneration.Format codeFormat, string DAL = "")
    {
        DataType      mDataType             = classVar.ParameterType;
        string        nameWithUnderscore    = "_" + classVar.Name;
        string        nameWithoutUnderScore = classVar.Name;
        StringBuilder retStrB = new StringBuilder();

        retStrB.Append(cg.getMetaDataText(string.Format("Gets or sets the {0} for this {1}.{2} object.",
                                                        nameWithoutUnderScore, pClass.NameSpaceVariable.NameBasedOnID, pClass.Name.Text()),
                                          false, (int)tab.XX, lang, mDataType.Name(), namSpace));
        string propertyAttribute = "";

        if (classVar.IsPropertyXMLIgnored)
        {
            propertyAttribute = cg.GetByLanguage(lang, "<XmlIgnore()> ", "[XmlIgnore]");
        }

        if (cg.isRegularDataType(mDataType.Name()) | DAL.Length == 0)
        {
            retStrB.Append(getPropertyStringForRegularType(classVar, propertyAttribute,
                                                           nameWithoutUnderScore, nameWithUnderscore, lang, codeFormat));
        }
        else
        {
            retStrB.Append(getPropertyStringForDerivedObject(pClass, classVar, propertyAttribute,
                                                             nameWithoutUnderScore, nameWithUnderscore, mDataType, namSpace, DAL, lang, codeFormat));
        }

        return(retStrB.ToString());
    }
示例#3
0
    public string getViewForm(ProjectClass pClass, bool useLists, language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.AppendLine(getHeaderLine(pClass, lang, pageVersion.View));
        strB.AppendLine(generateContentHeaders(pClass, false, useLists, lang));
        return(strB.ToString());
    }
示例#4
0
    private static string getMVCMetaData(string spacer, ClassVariable clsVar, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (clsVar.ParameterType.Name().ToLower() == "string" && clsVar.LengthOfDatabaseProperty > 0)
        {
            if (lang == language.VisualBasic)
            {
                strB.Append(spacer + "<StringLength(" + clsVar.LengthOfDatabaseProperty.ToString());
                strB.Append(", ErrorMessage:= \"The length of " + clsVar.Name + " can not exceed ");
                strB.Append(clsVar.LengthOfDatabaseProperty.ToString() + " characters.\")>");
                strB.AppendLine();
                strB.AppendLine(spacer + "<Display(Name:=\"" + cg.MakeHumanReadable(clsVar.ParentClass.DatabaseTableName) + " " + cg.MakeHumanReadable(clsVar.DatabaseColumnName) + "\")>");
                if (clsVar.IsRequired)
                {
                    strB.AppendLine("<Required(ErrorMessage:=\"" + clsVar.DatabaseColumnName + " is required.\")>");
                }
                if (clsVar.IsDouble)
                {
                    strB.AppendLine("<Range(0.00,100.0,ErrorMessage:=\"" + clsVar.DatabaseColumnName + " is required.\")>");
                }
                if (clsVar.IsDate)
                {
                    strB.AppendLine("<DataType(DataType.DateTime)>");
                }
                if (clsVar.DatabaseColumnName.ToLower().Contains("email"))
                {
                    strB.AppendLine("<DataType(DataType.EmailAddress)>");
                }
            }
            else
            {
                strB.Append(spacer + "[StringLength(" + clsVar.LengthOfDatabaseProperty.ToString());
                strB.Append(", ErrorMessage = \"The length of " + clsVar.Name + " can not exceed ");
                strB.Append(clsVar.LengthOfDatabaseProperty.ToString() + " characters.\")]");
                strB.AppendLine();
                strB.AppendLine(spacer + "[Display(Name =\"" + cg.MakeHumanReadable(clsVar.ParentClass.DatabaseTableName) + " " + cg.MakeHumanReadable(clsVar.DatabaseColumnName) + "\")]");
                if (clsVar.IsRequired)
                {
                    strB.AppendLine(spacer + "[Required(ErrorMessage =\"" + clsVar.DatabaseColumnName + " is required.\")]");
                }
                if (clsVar.IsDouble)
                {
                    strB.AppendLine(spacer + "[Range(0.00,100.0,ErrorMessage =\"" + clsVar.DatabaseColumnName + " is required.\")]");
                }
                if (clsVar.IsDate)
                {
                    strB.AppendLine("[DataType(DataType.DateTime)]");
                }
                if (clsVar.DatabaseColumnName.ToLower().Contains("email"))
                {
                    strB.AppendLine("[DataType(DataType.EmailAddress)]");
                }
            }
        }
        return(strB.ToString());
    }
示例#5
0
    private static string getHeader(language lang)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append(cg.getPageImports(lang, includeWebUI: true));
        sb.AppendLine("Public MustInherit Class BasePage");
        sb.AppendLine(Strings.Space((int)tab.X) + "Inherits Web.UI.Page");
        return(sb.ToString());
    }
    /// <summary>
    ///     ''' Creates all view files required
    ///     ''' </summary>
    ///     ''' <param name="pClass">Project Class</param>
    ///     ''' <param name="lang"></param>
    ///     ''' <returns>A dictionary with with the name of the view as the key and the data as the value </returns>
    ///     ''' <remarks></remarks>
    public Dictionary <string, string> getAllViewPages(ProjectClass pClass, language lang)
    {
        Dictionary <string, string> retDict = new Dictionary <string, string>();

        retDict.Add("Create", getCreateView(pClass, lang));
        retDict.Add("Delete", getDeleteView(pClass, lang));
        retDict.Add("Details", getDetailsView(pClass, lang));
        retDict.Add("Edit", getEditView(pClass, lang));
        retDict.Add("Index", getIndexView(pClass, lang));
        retDict.Add("_Details", getDetailsPartialView(pClass, lang));
        retDict.Add("_Form", getFormPartialView(pClass, lang));
        return(retDict);
    }
示例#7
0
    private string getHeaderLine(ProjectClass pClass, language lang, pageVersion pVersion)
    {
        string codeExt = "vb";
        string codeVer = "VB";

        if (lang == language.CSharp)
        {
            codeExt = "cs"; codeVer = "C#";
        }
        string pageName = pVersion == pageVersion.Edit ? "Edit" + pClass.Name.Capitalized() : pClass.Name.PluralAndCapitalized;

        return(string.Format("<%@ Page Title=\"\" Language=\"{3}\" MasterPageFile=\"~/{0}\" AutoEventWireup=\"false\" CodeFile=\"~/{1}.aspx.{2}"
                             + "\" Inherits=\"_{1}\" %>", pClass.MasterPage.FileName, pageName, codeExt, codeVer));
    }
示例#8
0
    private string getIndexGET(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.None) + "namespace ViewModels");
            strB.AppendLine(Strings.Space((int)tab.None) + "{");
            strB.AppendLine(Strings.Space((int)tab.X) + "public Class SpecimenViewModel");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "private " + pClass.Name.Capitalized() + " _spec;");
            strB.AppendLine(Strings.Space((int)tab.None));
            strB.AppendLine(Strings.Space((int)tab.XX) + "public " + pClass.Name.Capitalized() + " Obj { get { return _spec; } }");
            strB.AppendLine(Strings.Space((int)tab.XX) + "private Collection _Collection;");
            strB.AppendLine(Strings.Space((int)tab.XX) + "private Person _Scanner;");
            strB.AppendLine(Strings.Space((int)tab.None));
            strB.AppendLine(Strings.Space((int)tab.XX) + "public Person Scanner");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "get { return _Scanner; }");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "set");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "if (value == null) value = Person.CreateEmpty();");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "_Scanner = value; _spec.ScannedByID = value.ID;");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX) + "public Collection Collection");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "get { return _Collection; }");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "set");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "if (value == null) value = Collection.CreateEmpty();");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "_Collection = value; _spec.CollectionID = value.ID;");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.None) + "");
            strB.AppendLine(Strings.Space((int)tab.XX) + "public SpecimenViewModel(Specimen sp)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "_Spec = sp;");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Collection = IVLDAL.GetCollection(sp.CollectionID);");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Scanner = IVLDAL.GetPerson(sp.ScannedByID);");
            strB.AppendLine(Strings.Space((int)tab.None) + "");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.X) + "}");
            strB.AppendLine(Strings.Space((int)tab.None) + "}");
        }
        return(strB.ToString());
    }
示例#9
0
    public static string getBasePage(language lang)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append(getHeader(lang));
        sb.Append(getPrivateVariables());
        sb.Append(getPreInit());
        sb.Append(getCurrentUser());
        sb.Append(getCurrentAliasGroup());
        sb.Append(getHandlerPermissions());
        sb.Append(getRedirect());
        sb.Append(getReturnPath());
        return(sb.ToString());
    }
示例#10
0
    public static string getDatabaseStrings(ProjectClass pClass, language lang)
    {
        StringBuilder retStrB = new StringBuilder();

        foreach (ClassVariable classVar in pClass.ClassVariables)
        {
            if (classVar.IsDatabaseBound)
            {
                retStrB.AppendLine(Strings.Space((int)tab.XX) + cg.GetByLanguage(lang,
                                                                                 "Friend Const db_" + classVar.Name + " As String = \"" + classVar.DatabaseColumnName + "\"",
                                                                                 "internal const string db_" + classVar.Name + "= \"" + classVar.DatabaseColumnName + "\";"));
            }
        }
        return(retStrB.ToString());
    }
    private string getDetailsView(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@ModelType " + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h2>@ViewBag.Title</h2>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@using Html.BeginForm()");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.Partial(\"Parts/_Details\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Using");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<p>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Edit\", \"Edit\", new { id = Model." + pClass.NameString + ".ID})");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Delete\", \"Delete\", new { id = Model." + pClass.NameString + ".ID})");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Back to List\", \"Index\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "</p>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@Section Scripts");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Scripts.Render(\"~/bundles/jqueryval\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Section");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@model" + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h2>@ViewBag.Title</h2>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@using(Html.BeginForm()) {");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.Partial(\"Parts/_Details\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<p>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Edit\", \"Edit\", new { id = Model." + pClass.Name.Capitalized() + ".ID})");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Delete\", \"Delete\", new { id = Model." + pClass.Name.Capitalized() + ".ID})");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Back to List\", \"Index\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "</p>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@section Scripts {");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Scripts.Render(\"~/bundles/jqueryval\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
示例#12
0
    public static string getDALFunction_Delete(ProjectClass pClass, string editconn, cg.Language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.Append(cg.getMetaDataText("Attempts to delete the database entry corresponding to the " + pClass.Name.Capitalized(), false,
                                       (int)tab.XX, lang, "Integer"));
        if (lang == CodeGeneration.Language.VisualBasic)
        {
            strB.Append(Strings.Space((int)tab.XX) + "Friend Shared Function Remove" + pClass.Name.Capitalized());
            strB.AppendLine("(ByVal obj As " + pClass.Name.Capitalized() + ") As Integer");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "If obj Is Nothing Then Return -1");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim comm As New SqlCommand");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Try");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "With comm");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "'.CommandText = 'Insert Sproc Name Here");
            // strB.AppendLine(Strings.Space((int)tab.XXXXX) & ".Parameters.AddWithValue(""@"" & " & pClass.Name.Capitalized() & ".db_ID, obj.ID)")
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + getParaString(lang, pClass, "ID", "obj.ID"));
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "End With");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "Return UpdateObject(comm)");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Catch ex As Exception");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "End Try");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Return -1");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Function");
        }
        else
        {
            strB.Append(Strings.Space((int)tab.XX) + "internal static int Remove" + pClass.Name.Capitalized());
            strB.AppendLine("(" + pClass.Name.Capitalized() + " obj)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "if (obj == null) return -1;");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SqlCommand comm = new SqlCommand();");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "try");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "//comm.CommandText = //Insert Sproc Name Here;");
            // strB.AppendLine(Strings.Space((int)tab.XXXX) & "comm.Parameters.AddWithValue(""@"" + " & pClass.Name.Capitalized() & ".db_ID, obj.ID);")
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + getParaString(lang, pClass, "ID", "obj.ID"));
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "return UpdateObject(comm);");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "catch (Exception ex)");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "return -1;");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
    private string getDeleteView(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@ModelType " + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h2>@ViewBag.Title</h2>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h3>Are you sure that you want to delete this?</h3>");
            strB.AppendLine(Strings.Space((int)tab.XX) + "@using Html.BeginForm()");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.Partial(\"Parts/_Details\")");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.Partial(\"_DeletePartial\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Using");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<div>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Back to List\", \"Index\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "</div>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@Section Scripts");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Scripts.Render(\"~/bundles/jqueryval\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Section");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@model" + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h2>@ViewBag.Title</h2>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h3>Are you sure that you want to delete this?</h3>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@using(Html.BeginForm()) {");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.Partial(\"Parts/_Details\")");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.Partial(\"_DeletePartial\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<div>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Back to List\", \"Index\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "</div>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@section Scripts {");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Scripts.Render(\"~/bundles/jqueryval\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
示例#14
0
    public static string getObjectFromQueryString(ProjectClass pClass, cg.Language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.AppendLine(CodeGeneration.getMetaDataText("Gets the " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized()
                                                       + " correposponding with the given ID", false, (int)tab.XX, lang, pClass.Name.Capitalized()));
        if (lang == CodeGeneration.Language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "Public Shared Function Get" + pClass.Name.Capitalized() + "(ByVal idstring As String, ByVAl retNewObject As Boolean) As " + pClass.Name.Capitalized());
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim retObject As " + pClass.Name.Capitalized() + " = Nothing");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim ID As Integer ");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "If Integer.TryParse(idstring, ID) Then ");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "If ID = -1 AndAlso retNewObject Then ");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObject = New " + pClass.Name.Capitalized());
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObject.ID = -1");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "ElseIf ID >= 0 Then");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObject = Get" + pClass.Name.Capitalized() + "(ID)");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "End If");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "End If");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Return retObject");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Function");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "public static " + pClass.Name.Capitalized() + " Get" + pClass.Name.Capitalized() + "(String idstring, Boolean retNewObject)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + pClass.Name.Capitalized() + " retObject = null;");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "int ID;");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "if (int.TryParse(idstring, out ID))");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "if (ID == -1 && retNewObject)");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObject = new " + pClass.Name.Capitalized() + "();");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObject.ID = -1;");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "else if (ID >= 0)");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObject = Get" + pClass.Name.Capitalized() + "(ID);");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "return retObject;");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
示例#15
0
    private static string getParaString(cg.Language lang, ProjectClass projectClass, string strConst, string strValueVar, string conCat = null)
    {
        string strStart   = "";
        string strEndLine = "";

        if (lang == CodeGeneration.Language.CSharp)
        {
            strStart   = "comm";
            strEndLine = ";";
        }
        if (conCat == null)
        {
            conCat = cg.GetByLanguage(lang, "&", "+");
        }
        return(string.Format("{0}.Parameters.AddWithValue(\"@\" {1} {2}.db_{3}, {4}){5}",
                             strStart, conCat, projectClass.Name.Capitalized(), strConst, strValueVar, strEndLine));
    }
    private string getDetailsPartialView(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@ModelType " + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.AntiForgeryToken()");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<fieldset>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "<legend>" + pClass.NameString + "</legend>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            foreach (ClassVariable cVar in pClass.ClassVariables)
            {
                strB.AppendLine(Strings.Space((int)tab.XXX) + "<div class=\"display-label\">");
                strB.AppendLine(Strings.Space((int)tab.XXXX) + "@Html.DisplayNameFor(Function(model) model." + cVar.Name + ")");
                strB.AppendLine(Strings.Space((int)tab.XXX) + "</div>");
                strB.AppendLine(Strings.Space((int)tab.XXX) + "<div class=\"display-field\">");
                strB.AppendLine(Strings.Space((int)tab.XXXX) + "@Html.DisplayFor(Function(model) model." + cVar.Name + ")");
                strB.AppendLine(Strings.Space((int)tab.XXX) + "</div>");
            }
            strB.AppendLine(Strings.Space((int)tab.XX) + "</fieldset>");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@model " + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.AntiForgeryToken()");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<fieldset>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "<legend>" + pClass.NameString + "</legend>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            foreach (ClassVariable cVar in pClass.ClassVariables)
            {
                strB.AppendLine(Strings.Space((int)tab.XXX) + "<div class=\"display-label\">");
                strB.AppendLine(Strings.Space((int)tab.XXXX) + "@Html.DisplayNameFor(model => model." + cVar.Name + ")");
                strB.AppendLine(Strings.Space((int)tab.XXX) + "</div>");
                strB.AppendLine(Strings.Space((int)tab.XXX) + "<div class=\"display-field\">");
                strB.AppendLine(Strings.Space((int)tab.XXXX) + "@Html.DisplayFor(model => model." + cVar.Name + ")");
                strB.AppendLine(Strings.Space((int)tab.XXX) + "</div>");
            }
            strB.AppendLine(Strings.Space((int)tab.XX) + "</fieldset>");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
示例#17
0
    private static string getToStringFunction(string objectName, language lang)
    {
        StringBuilder retStrB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "Public Overrides Function ToString() As String");
            retStrB.AppendLine(Strings.Space((int)tab.XXX) + "Return Me.GetType().ToString()");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "End Function");
        }
        else
        {
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "public override string ToString()");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "{");
            retStrB.AppendLine(Strings.Space((int)tab.X + (int)tab.XX) + "return this.GetType().ToString();");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        return(retStrB.ToString());
    }
示例#18
0
    public string getEditCodeBehind(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.Append(cg.getPageImports(lang));
        strB.Append(cg.getClassDeclaration(lang, "_Edit" + pClass.Name.Capitalized(), tab.None, "BasePage"));
        strB.AppendLine();
        strB.AppendLine(getPageLoadForEdit(pClass, lang));
        strB.AppendLine(getPageInstructions(lang));
        strB.AppendLine(getGetFunctionForQueryString(pClass, lang));
        strB.AppendLine(getFillFormForEdit(pClass, lang));
        strB.AppendLine(getCancelForEdit(pClass, lang));
        strB.AppendLine(getValidateFunction(pClass, lang));
        strB.AppendLine(getSaveChanges(pClass, lang));
        strB.AppendLine(getAddObject(pClass, lang));
        strB.AppendLine(getUpdateObject(pClass, lang));
        strB.AppendLine(cg.GetByLanguage(lang, "End Class", "}"));
        return(strB.ToString());
    }
示例#19
0
    private string getCancelForEdit(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click");
            strB.AppendLine(Strings.Space((int)tab.XX) + "Redirect(\"" + pClass.Name.PluralAndCapitalized + ".aspx\")");
            strB.AppendLine(Strings.Space((int)tab.X) + "End Sub");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "protected void btnCancel_Click(object sender, System.EventArgs e)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Redirect(\"" + pClass.Name.PluralAndCapitalized + ".aspx\");");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
示例#20
0
    private static string getProperties(ProjectClass pClass, language lang, CodeGeneration.Format codeFormat)
    {
        StringBuilder retStrB  = new StringBuilder();
        string        namSpace = pClass.NameSpaceVariable.NameBasedOnID;

        foreach (ClassVariable cv in pClass.ClassVariables)
        {
            try {
                if (cv.IsPropertyInherited || cv.ParameterType.IsImage)
                {
                    continue;
                }
                retStrB.AppendLine(getPropertyText(pClass, cv, namSpace, lang, codeFormat, pClass.DALClassVariable.Name));
            } catch (Exception ex) {
                retStrB.AppendLine(string.Format("{3}ERROR: While Adding Variable({0}), the following error occured: " +
                                                 "{1}{3}MSG: {2}{1}", cv.Name, Constants.vbCrLf, ex.Message, cg.getCommentString(lang)));
            }
        }
        return(retStrB.ToString());
    }
示例#21
0
    private string getPageInstructions(language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "Protected Overrides Sub fillPageInstructions()");
            strB.AppendLine(Strings.Space((int)tab.XX) + "lblPageInstructions.Text=\"\"");
            strB.AppendLine(Strings.Space((int)tab.X) + "End Sub");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "protected override void fillPageInstructions()");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "lblPageInstructions.Text=\"\";");
            strB.AppendLine(Strings.Space((int)tab.X) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
示例#22
0
    // These next few functions need added into the system in both VB and C#
    // These function are already in use in our code and they will help streamline code.
    private static string getEnums(cg.Language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == cg.Language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "Friend Enum dbAction As Integer");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Read");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Edit");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Enum");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "internal enum dbAction ");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Read,");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Edit");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        return(strB.ToString());
    }
示例#23
0
    public static string getDALFunctions(ProjectClass pClass, cg.Language lang)
    {
        StringBuilder strB           = new StringBuilder();
        string        ObjectName     = pClass.Name.Capitalized();
        string        readConnection = pClass.DALClassVariable.ReadOnlyConnectionString.Name;
        string        editConnection = pClass.DALClassVariable.EditOnlyConnectionstring.Name;

        if (readConnection.Length > 0 & editConnection.Length > 0 & ObjectName.Length > 0)
        {
            strB.AppendLine();
            strB.AppendLine(cg.getRegionStart(lang, ObjectName));
            strB.AppendLine(getObjectFromQueryString(pClass, lang));
            strB.AppendLine(getDALFunction_SelectSingle(pClass, readConnection, lang));
            strB.AppendLine(getDALFunction_SelectAll(pClass, readConnection, lang));
            strB.AppendLine(getDALFunction_SelectAssociative(pClass, readConnection, lang));
            strB.AppendLine(getDALFunction_Insert(pClass, editConnection, lang));
            strB.AppendLine(getDALFunction_Update(pClass, editConnection, lang));
            strB.AppendLine(getDALFunction_Delete(pClass, editConnection, lang));
            strB.AppendLine(cg.getRegionEnd(lang));
        }
        return(strB.ToString());
    }
    private string getCreateView(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@ModelType " + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h2>@ViewBag.Title</h2>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@Html.Partial(\"Parts/_Form\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "<div>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Back to List\", \"Index\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "</div>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@Section Scripts {");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Scripts.Render(\"~/bundles/jqueryval\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Section");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "@model" + pClass.NameWithNameSpace);
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<h2>@ViewBag.Title</h2>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@Html.Partial(\"Parts/_Form\")");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "<div>");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Html.ActionLink(\"Back to List\", \"Index\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "</div>");
            strB.AppendLine(Strings.Space((int)tab.XX));
            strB.AppendLine(Strings.Space((int)tab.XX) + "@section Scripts{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "@Scripts.Render(\"~/bundles/jqueryval\")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
    /// <summary>
    ///     ''' Builds all view pages and puts them in the correct folder structure at the file path specified
    ///     ''' </summary>
    ///     ''' <param name="pClass"></param>
    ///     ''' <param name="lang"></param>
    ///     ''' <param name="filePath"></param>
    ///     ''' <returns></returns>
    ///     ''' <remarks></remarks>
    public void buildViewPages(ProjectClass pClass, language lang, string filePath, ref List <string> messages)
    {
        Dictionary <string, string> dictOfViews;

        dictOfViews = getAllViewPages(pClass, lang);
        filePath    = filePath + @"\Views\";

        if (createFolder(filePath))
        {
            if (dictOfViews != null && dictOfViews.Count > 0)
            {
                foreach (string key in dictOfViews.Keys)
                {
                    if (key.Contains('_'))
                    {
                        if (createFolder(filePath + @"\" + pClass.Name.Capitalized() + @"\Parts\"))
                        {
                            writeFileData(dictOfViews[key], key, filePath, lang);
                        }
                        else
                        {
                            messages.Add("Unable to create the view folder for: " + pClass.Name.Capitalized() + ".  Giving up");
                            break;
                        }
                    }
                    else if (createFolder(filePath + @"\" + pClass.Name.Capitalized() + @"\"))
                    {
                        writeFileData(dictOfViews[key], key, filePath, lang);
                    }
                    else
                    {
                        messages.Add("Unable to create the view folder for: " + pClass.Name.Capitalized() + ".  Giving up.");
                        break;
                    }
                }
            }
        }
    }
示例#26
0
    public static string getEntireClass(ProjectClass pClass, string creator, language lang, CodeGeneration.Format codeFormat, ref List <string> warnings)
    {
        StringBuilder retStrB  = new StringBuilder();
        string        namSpace = "";

        if (pClass.NameSpaceVariable != null)
        {
            namSpace = pClass.NameSpaceVariable.NameBasedOnID;
        }
        string Comments = pClass.Summary;
        // Dim txtProperties As String = txtInVars.Text.Trim
        string dalClassName = pClass.DALClassVariable.Name;
        string objName      = pClass.Name.Capitalized();

        if (objName.Length > 0 & dalClassName.Length > 0)
        {
            if (objName.Length > 0)
            {
                retStrB.Append(cg.GetByLanguage(lang,
                                                getEntireClassInVB(pClass, objName, namSpace, Comments, creator, codeFormat),
                                                getEntireClassInCSharp(pClass, objName, namSpace, Comments, creator, codeFormat)
                                                )
                               );
            }
        }
        else
        {
            if (pClass.Name.Text().Length == 0)
            {
                warnings.Add("Invalid Input: You must provide an Object/Class name.");
            }
            if (dalClassName.Length == 0)
            {
                warnings.Add("Invalid Input: You must provide a Data Access Layer Class name");
            }
        }
        return(retStrB.ToString());
    }
 private void writeFileData(string data, string fileName, string path, language lang)
 {
     if (lang == language.VisualBasic)
     {
         if (fileName.Contains('_'))
         {
             File.Create(path + @"\Parts\" + fileName + ".vbhtml");
         }
         else
         {
             File.Create(path + fileName + ".vbhtml");
         }
     }
     else if (fileName.Contains('_'))
     {
         File.Create(path + @"\Parts\" + fileName + ".cshtml");
     }
     else
     {
         File.Create(path + fileName + ".cshtml");
     }
     byte[] fileData = new UTF8Encoding(true).GetBytes(data);
 }
示例#28
0
    private string getGetFunctionForQueryString(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "Private Function get" + pClass.Name.Capitalized() + "FromQueryString() As " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized());
            strB.AppendLine(Strings.Space((int)tab.XX) + "Return " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.DALClassVariable.Name + ".get" + pClass.Name.Capitalized() + "(Request.QueryString(\"id\"), True)");
            strB.AppendLine(Strings.Space((int)tab.X) + "End Function");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "private " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized()
                            + " get" + pClass.Name.Capitalized() + "FromQueryString()");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "return " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.DALClassVariable.Name
                            + ".get" + pClass.Name.Capitalized() + "(Request.QueryString(\"id\"), True);");
            strB.AppendLine(Strings.Space((int)tab.X) + "}");
        }
        strB.AppendLine();

        return(strB.ToString());
    }
示例#29
0
    private string getPageLoadForEdit(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "Protected Sub Page_Load(ByVAl sender As Object, ByVal e As System.EventArgs) Handles Me.Load");
            strB.AppendLine(Strings.Space((int)tab.XX) + "If Not IsPostBack Then");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim myObject As " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized() + " = get" + pClass.Name.Capitalized() + "FromQueryString()");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "If myObject Is Nothing Then");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "SessionVariables.addError(StringToolkit.ObjectNotFound(AliasGroup." + pClass.Name.Capitalized() + "))");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "Redirect(\"" + pClass.Name.PluralAndCapitalized + ".aspx\")");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "End If");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "fillForm(myObject)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End If");
            strB.AppendLine(Strings.Space((int)tab.X) + "End Sub");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "protected void Page_Load(object sender, EventArgs e)");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "if (!IsPostBack)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized()
                            + " myObject = get" + pClass.Name.Capitalized() + "FromQueryString();");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "if (myObject != null)");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "SessionVariables.addError(StringToolkit.ObjectNotFound(AliasGroup." + pClass.Name.Capitalized() + "));");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "Redirect(\"" + pClass.Name.PluralAndCapitalized + ".aspx\");");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "fillForm(myObject);");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.X) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
示例#30
0
    private static string getConstructors(string objName, language lang)
    {
        StringBuilder retStrB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "Public Sub New()");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "End Sub");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "Friend Sub New(ByVal dr As Microsoft.Data.SqlClient.SqlDataReader)");
            retStrB.AppendLine(Strings.Space((int)tab.XXX) + "Fill(dr)");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "End Sub");
        }
        else
        {
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "public " + objName + "()");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "{");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "}");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "internal " + objName + "(Microsoft.Data.SqlClient.SqlDataReader dr)");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "{");
            retStrB.AppendLine(Strings.Space((int)tab.XXX) + "Fill(dr);");
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        return(retStrB.ToString());
    }