コード例 #1
0
        private List <CampoEntidade> ConverteTabelaDeCamposParaLista()
        {
            var linhasTabela = TabelaNomes.Rows;

            var lista = new List <CampoEntidade>();

            for (var count = 0; count < linhasTabela.Count - 1; count++)
            {
                var campoTemp = new CampoEntidade
                {
                    Nome = linhasTabela[count].Cells[0].Value.ToString(),
                    Tipo = linhasTabela[count].Cells[1].Value.ToString()
                };

                lista.Add(campoTemp);
            }
            return(lista);
        }
コード例 #2
0
        private static string RetornaConstantsCampoEntidade(CampoEntidade campo)
        {
            switch (campo.Tipo)
            {
            case "string":
                return("public static " + campo.Tipo + " " + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = ""Str"";");

            case "int":
                return("public static " + campo.Tipo + " " + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 1;");

            case "long":
                return("public static " + campo.Tipo + " " + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 4294967296L;");

            case "decimal":
                return("public static " + campo.Tipo + " " + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 1.5m;");

            case "DateTime":
                return("public static " + campo.Tipo + " " + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = DateTime.Now;");

            default:
                return("public static " + campo.Tipo + " " + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 1;");
            }
        }
コード例 #3
0
        private static string RetornaConstantsCampoEntidadeUpdate(CampoEntidade campo)
        {
            switch (campo.Tipo)
            {
            case "string":
                return("public static " + campo.Tipo + " Novo" + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = ""StrNovo"";");

            case "int":
                return("public static " + campo.Tipo + " Novo" + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 2;");

            case "long":
                return("public static " + campo.Tipo + " Novo" + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 4294967297L;");

            case "decimal":
                return("public static " + campo.Tipo + " Novo" + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 2.5m;");

            case "DateTime":
                return("public static " + campo.Tipo + " Novo" + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = DateTime.Now.AddDays(1);");

            default:
                return("public static " + campo.Tipo + " Novo" + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = 2;");
            }
        }
コード例 #4
0
        private static string RetornaDeclaracaoDoTipo(CampoEntidade campo)
        {
            switch (campo.Tipo)
            {
            case "string":
                return(campo.Tipo + " " + char.ToLower(campo.Nome[0]) + campo.Nome.Substring(1) + " = null,");

            case "int":
                return(campo.Tipo + "? " + char.ToLower(campo.Nome[0]) + campo.Nome.Substring(1) + " = null,");

            case "long":
                return(campo.Tipo + "? " + char.ToLower(campo.Nome[0]) + campo.Nome.Substring(1) + " = null,");

            case "decimal":
                return(campo.Tipo + "? " + char.ToLower(campo.Nome[0]) + campo.Nome.Substring(1) + " = null,");

            case "DateTime":
                return(campo.Tipo + "? " + char.ToLower(campo.Nome[0]) + campo.Nome.Substring(1) + " = null,");

            default:
                return(campo.Tipo + " " + char.ToLower(campo.Nome[0]) + campo.Nome.Substring(1) + " = null,");
            }
        }
コード例 #5
0
ファイル: ModeloTeste.cs プロジェクト: ruanzb/AbpGenerator
        private static string RetornaDeclaracaoDoTipo(CampoEntidade campo, string nome, string precedent, string finalNomeDoCampo)
        {
            switch (campo.Tipo)
            {
            case "string":
                return(nome.ToLower() + precedent + @"." + campo.Nome + @".ShouldBe(" + finalNomeDoCampo + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + ");");

            case "int":
                return(nome.ToLower() + precedent + @"." + campo.Nome + @".ShouldBe(" + finalNomeDoCampo + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + ");");

            case "long":
                return(nome.ToLower() + precedent + @"." + campo.Nome + @".ShouldBe(" + finalNomeDoCampo + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + ");");

            case "decimal":
                return(nome.ToLower() + precedent + @"." + campo.Nome + @".ShouldBe(" + finalNomeDoCampo + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + ");");

            case "DateTime":
                return(nome.ToLower() + precedent + @"." + campo.Nome + @".ShouldBe(" + finalNomeDoCampo + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + ");");

            default:
                return(nome.ToLower() + precedent + @"." + campo.Nome + @".ShouldBe(" + finalNomeDoCampo + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + ");");
            }
        }
コード例 #6
0
 private static string RetornaAtribuicaoDto(CampoEntidade campo, string nome)
 {
     return(nome + "Dto." + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + @" = " + char.ToLower(campo.Nome[0]) + campo.Nome.Substring(1) + " ?? " + char.ToUpper(nome[0]) + nome.Substring(1) + "Constants." +
            char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1) + ";");
 }
コード例 #7
0
ファイル: ModeloDtos.cs プロジェクト: ruanzb/AbpGenerator
        private static string RetornaDeclaracaoDoTipo(CampoEntidade campo)
        {
            var nomeTipo = campo.Tipo + " " + char.ToUpper(campo.Nome[0]) + campo.Nome.Substring(1);

            return(Utils.DeclaracaoCampo.Replace("insereAqui", nomeTipo));
        }
コード例 #8
0
ファイル: ModeloTeste.cs プロジェクト: ruanzb/AbpGenerator
 private static string RetornaAtualizacao(CampoEntidade campo, string nome, string precedent)
 {
     return(nome.ToLower() + precedent + @"." + campo.Nome + " = " + nome + "Constants." + "Novo" + campo.Nome + @";");
 }