예제 #1
0
 internal void Remove(CodeGeneratorCommon.GeneratorsType pGeneratorsType)
 {
     if (_GeneratorsList.ContainsKey(pGeneratorsType))
     {
         _GeneratorsList.Remove(pGeneratorsType);
     }
 }
예제 #2
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
 static string GenBatchMethod(TableViewBase pTable, CodeGeneratorCommon.MethodActionType t)
 {
     StringBuilder wMethod = new StringBuilder(FwkGeneratorHelper.TemplateDocument.GetTemplate("MethodBatch").Content);
     wMethod.Replace("[SummaryParams]", GenParametersSummary(t, pTable));
     wMethod.Replace("[ParamArgs]", GenMethodParameters(t, pTable));
     wMethod.Replace("[MethodName]", t.ToString());
     wMethod.Replace("[StoredProcedureName]", GetSPName(pTable, t));
     wMethod.Replace("[Parameters]", GenSPParameters_Batch(pTable, t));
     return wMethod.ToString();
 }
예제 #3
0
 internal void Add(CodeGenerator.FrmBase frm, CodeGeneratorCommon.GeneratorsType pGeneratorsType)
 {
     if (!_GeneratorsList.ContainsKey(pGeneratorsType))
     {
         _GeneratorsList.Add(pGeneratorsType, frm);
         if (_Metadata == null)
             _Metadata = frm.Metadata;
         else
             frm.Metadata = _Metadata;
     }
 }
예제 #4
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
 static string GenMethod(TableViewBase pTable, CodeGeneratorCommon.MethodActionType t)
 {
     StringBuilder wMethod = new StringBuilder(_Method_tt);
     wMethod.Replace("[SummaryParams]", GenParametersSummary(t, pTable));
     wMethod.Replace("[ParamArgs]", GenMethodParameters(t, pTable));
     wMethod.Replace("[MethodName]", t.ToString());
     wMethod.Replace("[RetType]", GetRetType(pTable, t));
     wMethod.Replace("[StoredProcedureName]", GetSPName(pTable, t));
     wMethod.Replace("[Parameters]", GenSPParameters(pTable, t));
     wMethod.Replace("[Declarations]", GenDeclaration(pTable, t));
     wMethod.Replace("[Return]", GenMethodReturn(pTable, t));
     return wMethod.ToString();
 }
예제 #5
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        private static string GenMethodReturn(TableViewBase pTable, CodeGeneratorCommon.MethodActionType t)
        {
            StringBuilder wBuilderReturn = null;
            switch (t)
            {
                case CodeGeneratorCommon.MethodActionType.Insert:
                    {
                        Column pPK = FwkGeneratorHelper.GetPrimaryKey(pTable);
                        if (pPK != null)
                        {
                            
                            wBuilderReturn = new StringBuilder("  wDataBase.ExecuteNonQuery(wCmd);");
                            wBuilderReturn.AppendLine(FwkGeneratorHelper.TemplateDocument.GetTemplate("InsertReturn").Content);
                            wBuilderReturn.Replace(CodeGeneratorCommon.CommonConstants.CONST_ENTITY_PROPERTY_NAME, pPK.Name);
                            wBuilderReturn.Replace(CodeGeneratorCommon.CommonConstants.CONST_TYPENAME, FwkGeneratorHelper.GetCSharpType(pPK));

                            return wBuilderReturn.ToString();
                        }
                        else
                            return "  wDataBase.ExecuteNonQuery(wCmd);";
                    }
                case CodeGeneratorCommon.MethodActionType.Update:
                    return "  wDataBase.ExecuteNonQuery(wCmd);";

                case CodeGeneratorCommon.MethodActionType.SearchByParam:

                    wBuilderReturn = new StringBuilder(FwkGeneratorHelper.TemplateDocument.GetTemplate("SearchReturn").Content);

                    return wBuilderReturn.ToString();
                case CodeGeneratorCommon.MethodActionType.Delete:
                    return  "  wDataBase.ExecuteNonQuery(wCmd);";

            }

            return string.Empty;

        }
예제 #6
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        static string GenSPParameters_Batch(TableViewBase pTable, CodeGeneratorCommon.MethodActionType pMethodActionType)
        {

            StringBuilder wParams = new StringBuilder();
            int i = 0;
            bool appendProperty = true;
            Column primaryKey = FwkGeneratorHelper.GetPrimaryKey(pTable);
            foreach (Column c in pTable.Columns)
            {
                i++;
                if (pMethodActionType == CodeGeneratorCommon.MethodActionType.Insert ||
                    pMethodActionType == CodeGeneratorCommon.MethodActionType.Update)
                {

                    if (primaryKey != null)
                        appendProperty = !(primaryKey == c && pMethodActionType == CodeGeneratorCommon.MethodActionType.Insert);

                    if (appendProperty)
                        //i == pTable.Columns.Count --> Fin de la coleccion
                        wParams.Append(Get_Property_Batch(c, (i == pTable.Columns.Count)));

                }
               

            }
            return wParams.ToString();
        }
예제 #7
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        static string GenSPParameters(TableViewBase pTable, CodeGeneratorCommon.MethodActionType pMethodActionType)
        {

            StringBuilder wParams = new StringBuilder();



            switch (pMethodActionType)
            {
                case CodeGeneratorCommon.MethodActionType.Insert:
                    foreach (Column c in pTable.Columns)
                    {
                        if (!FwkGeneratorHelper.NotSupportTypes_ToIncludeInBackEnd.Contains(c.DataType.SqlDataType.ToString().ToLower()))
                        {
                            if (c.InPrimaryKey)
                            {
                                wParams.Append(GetOutParameter(pTable, c));
                            }
                            else
                            {
                                wParams.Append(GetInParameter(pTable, c));
                            }
                        }
                    }
                    break;

                case CodeGeneratorCommon.MethodActionType.Update:
                    foreach (Column c in pTable.Columns)
                    {
                        if (!FwkGeneratorHelper.NotSupportTypes_ToIncludeInBackEnd.Contains(c.DataType.SqlDataType.ToString().ToLower()))
                        {
                            wParams.Append(GetInParameter(pTable, c));
                        }
                    }
                    break;
                case CodeGeneratorCommon.MethodActionType.Delete:

                    Column cPK = FwkGeneratorHelper.GetPrimaryKey(pTable);
                    if (cPK != null)
                        wParams.Append(GetInParameter(cPK.Name, FwkGeneratorHelper.GetDBType(cPK)));
                    else
                        wParams.Append(GetInParameter("Id", "System.Data.DbType.Int32"));

                    break;
                case CodeGeneratorCommon.MethodActionType.SearchByParam:
               
                    foreach (Column c in pTable.Columns)
                    {
                        if (FwkGeneratorHelper.GeColumnFindeable(c))
                            wParams.Append(GetInParameter(pTable, c));

                    }
                    break;
                case CodeGeneratorCommon.MethodActionType.Get:
                    wParams.Append(string.Empty);
                    break;

            }
            return wParams.ToString();
        }
예제 #8
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        /// <summary>
        /// Retorno del metodo
        /// </summary>
        /// <param name="pTable"></param>
        /// <param name="pMethodActionType"></param>
        /// <returns></returns>
        static string GetSPName(TableViewBase pTable, CodeGeneratorCommon.MethodActionType pMethodActionType)
        {
            String sufix = string.Empty;

            switch (pMethodActionType)
            {
                case CodeGeneratorCommon.MethodActionType.Insert:
                    sufix = "_i";
                    break;
                case CodeGeneratorCommon.MethodActionType.GetByParam:
                    sufix = "_gp";
                    break;
                case CodeGeneratorCommon.MethodActionType.Update:
                    sufix = "_u";
                    break;
                case CodeGeneratorCommon.MethodActionType.Delete:
                    sufix = "_d";
                    break;
                case CodeGeneratorCommon.MethodActionType.SearchByParam:

                    sufix = "_sp";
                    break;
                case CodeGeneratorCommon.MethodActionType.Get:
                    sufix = "_g";
                    break;

            }

            return string.Concat(pTable.Name, sufix);
        }
예제 #9
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        /// <summary>
        /// Retorno del metodo
        /// </summary>
        /// <param name="pTable"></param>
        /// <param name="pMethodActionType"></param>
        /// <returns></returns>
        static string GetRetType(TableViewBase pTable, CodeGeneratorCommon.MethodActionType pMethodActionType)
        {
            String wBuilder = string.Empty;
            Column c = FwkGeneratorHelper.GetPrimaryKey(pTable);
            switch (pMethodActionType)
            {
                case CodeGeneratorCommon.MethodActionType.Insert:

                case CodeGeneratorCommon.MethodActionType.Update:
                case CodeGeneratorCommon.MethodActionType.Delete:
                    wBuilder = "void";
                    break;
                case CodeGeneratorCommon.MethodActionType.SearchByParam:
                    wBuilder = string.Concat(pTable.Name, "List");
                    break;
                case CodeGeneratorCommon.MethodActionType.GetByParam:
                    wBuilder = pTable.Name;
                    break;
            }
            return wBuilder;
        }
예제 #10
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        /// <summary>
        /// Genera código de parámetros de llamado a un método.
        /// </summary>
        /// <param name="CodeGeneratorCommon.MethodActionType">información sobre el método a generar.</param>
        /// <param name="pTable">tabla.</param>
        /// <returns>Código que representa los parámetros para ejecutar el método.</returns>
        /// <author>Marcelo Oviedo</author>
        static string GenMethodParameters(CodeGeneratorCommon.MethodActionType pMethodActionType, TableViewBase pTable)
        {
            String wBuilder = string.Empty;
            switch (pMethodActionType)
            {
                case CodeGeneratorCommon.MethodActionType.Insert:
                case CodeGeneratorCommon.MethodActionType.Update:
                case CodeGeneratorCommon.MethodActionType.GetByParam:
                case CodeGeneratorCommon.MethodActionType.SearchByParam:

                    wBuilder = string.Concat(pTable.Name, " p", pTable.Name);
                    break;
                case CodeGeneratorCommon.MethodActionType.Delete:
                    Column pPK = FwkGeneratorHelper.GetPrimaryKey(pTable);
                    if (pPK != null)
                    {
                        FwkGeneratorHelper.GetCSharpType(pPK);
                        wBuilder = String.Concat(FwkGeneratorHelper.GetCSharpType(pPK), " p", pPK.Name);
                    }
                    else
                    {
                        wBuilder = String.Concat("int pId");
                    }

                    break;
            }
            return wBuilder;


        }
예제 #11
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// Genera código fuente de un parámetro del procedimiento almacenado a partir de un campo de la tabla.
        /// </summary>
        /// <param name="pTableFieldInfo">información sobre el parámetro a generar.</param>
        /// <param name="pActionType">Tipo de Acción a realizar por el procedimiento almacenado.</param>
        /// <param name="pSetDirection">Dirección del parámetro.</param>
        /// <param name="pSetDefaultNull">Indica si se pasa NULL como valor por defecto.</param>
        /// <returns>Código fuente del parámetro.</returns>
        /// <date>2007-5-25T00:00:00</date>
        /// <author>Marcelo Oviedo</author>
        static StringBuilder BuildParameter(Column pColumn,
           CodeGeneratorCommon.MethodActionType pActionType, bool pSetDirection, bool pSetDefaultNull)
        {
            string wDirection = string.Empty;
            StringBuilder wBuilder = new StringBuilder();

            wBuilder.Append("\t");
            wBuilder.Append(FwkGeneratorHelper.GetParameterPattern(pColumn));
            //@Nombre
            wBuilder.Replace("[Name]", "@" + pColumn.Name);
            if (pColumn.DataType.ToString().ToLower().Contains("image"))

                wBuilder.Replace("[Type]", "varbinary");
            else
                wBuilder.Replace("[Type]", pColumn.DataType.ToString());

            if (pColumn.DataType.MaximumLength != -1 && pColumn.DataType.MaximumLength != 0)
                wBuilder.Replace("[Length]", pColumn.DataType.MaximumLength.ToString());
            else
                wBuilder.Replace("[Length]", "max");

            wBuilder.Replace("[Precision]", pColumn.DataType.NumericPrecision.ToString());
            wBuilder.Replace("[Scale]", pColumn.DataType.NumericScale.ToString());

            if (pSetDirection)
            {
                ParameterDirection wParamDirection = ((pColumn.InPrimaryKey) && (pActionType == CodeGeneratorCommon.MethodActionType.Insert)) ? ParameterDirection.Output : ParameterDirection.Input;

                switch (wParamDirection)
                {
                    case System.Data.ParameterDirection.Input:
                        {
                            wDirection = String.Empty;
                            break;
                        }
                    case System.Data.ParameterDirection.Output:
                        {
                            wDirection = "OUTPUT";
                            break;
                        }

                    case System.Data.ParameterDirection.InputOutput:
                        {
                            wDirection = String.Empty;
                            break;
                        }
                    default:
                        {
                            wDirection = string.Empty;
                            break;
                        }
                }
            }

            wBuilder.Replace("[Direction]", wDirection);

            if (pSetDefaultNull && pColumn.Nullable)
            {
                wBuilder.Append(" = NULL");
            }

            wBuilder.Append(",\r\n");

            return wBuilder;
        }
예제 #12
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// Genera código de parámetros de un procedimiento almacenado de Búsqueda por clave primaria.
        /// </summary>
        /// <param name="pMethodInfo">información del método para generar stored procedure.</param>
        /// <returns>Código fuente generado.</returns>
        /// <date>2007-5-25T00:00:00</date>
        /// <author>Marcelo Oviedo</author>
        protected string GenCodeParameters(TableViewBase pTable, CodeGeneratorCommon.MethodActionType action)
        {

            StringBuilder wBuilder = new StringBuilder();

            //if (action == MethodActionType.Get)
            //{
            foreach (Column wColumn in pTable.Columns)
            {
                //if (wColumn.KeyField)// && wColumn.Selected)
                //{
                StringBuilder wParamBuilder = BuildParameter(wColumn, action, false, false);
                wBuilder.Append(wParamBuilder.ToString());
                //}
            }
            //}
            //else
            //{
            //    foreach (ParameterInfo wParameterInfo in pMethodInfo.Parameters)
            //    {

            //        StringBuilder wParamBuilder = base.BuildParameter(wParameterInfo);
            //        wBuilder.Append(wParamBuilder.ToString());
            //    }
            //}

            RemoveChars(wBuilder, 3);

            return wBuilder.ToString();

        }
예제 #13
0
        /// <summary>
        /// Genera fisicamente los archivos corespondientes al codigo 
        /// Para cada modulo crea una carpata una carpeta con su nombre.-
        /// Para los SP ademas genera una subfolder con el nombre de la entidad y dentro de ella 
        /// graba un archivo *.spl por cada metodo.-
        /// </summary>
        /// <param name="pzsPath">Ruta raiz </param>
        /// <param name="pComponentLayer">Modulo (BE,DAC,TDG SVC, SP)</param>
        /// <param name="pGeneratedCodeList">Coleccion de GeneratedCodes</param>
        private void SaveGeneratedCodeFiles(string pzsPath, CodeGeneratorCommon.ComponentLayer pComponentLayer)
        {
            //if (pGeneratedCodeList.Count == 0) return;
            GeneratedCode wGeneratedCode = null;
            DirectoryInfo wdiModule = null;
            string wzsFile = String.Empty;

            if(pComponentLayer != CodeGeneratorCommon.ComponentLayer.SVC)
                wdiModule = Directory.CreateDirectory(pzsPath + Path.DirectorySeparatorChar + Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), pComponentLayer));
            else
             wdiModule = Directory.CreateDirectory(pzsPath + Path.DirectorySeparatorChar );
            
            #region BE, DAC y TDG
            if (pComponentLayer != CodeGeneratorCommon.ComponentLayer.SP && pComponentLayer != CodeGeneratorCommon.ComponentLayer.SVC)
            {


                foreach (TreeNode wNode in trvCodeGenerated.Nodes[Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), pComponentLayer)].Nodes)
                {
                    wGeneratedCode = (GeneratedCode) wNode.Tag;

                    wzsFile = wdiModule.FullName + Path.DirectorySeparatorChar + wGeneratedCode.Id + Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), pComponentLayer) + ".cs";
                    FileFunctions.SaveTextFile(wzsFile, wGeneratedCode.Code.ToString());
                }
            }
            #endregion

            #region StoredProcedures
            if (pComponentLayer == CodeGeneratorCommon.ComponentLayer.SP)
            {
                DirectoryInfo wdiEntity = null;
                string wzsAux = string.Empty;
                foreach (TreeNode wNodeTable in trvCodeGenerated.Nodes[Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), pComponentLayer)].Nodes)
                {
                    foreach (TreeNode wNodeMethod in wNodeTable.Nodes)
                    {
                        wGeneratedCode = (GeneratedCode)wNodeMethod.Tag;

                        if (wzsAux != wGeneratedCode.Id)
                        {
                            wdiEntity = Directory.CreateDirectory(wdiModule.FullName + Path.DirectorySeparatorChar + wGeneratedCode.Id);
                        }

                        wzsFile = wdiEntity.FullName + Path.DirectorySeparatorChar + wGeneratedCode.Id + "_" + wGeneratedCode.MethodActionType.ToString() + ".sql";
                        FileFunctions.SaveTextFile(wzsFile, wGeneratedCode.Code.ToString());
                    }
                    
                }
            
            }
            #endregion

            if (pComponentLayer == CodeGeneratorCommon.ComponentLayer.SVC)
            {


                DirectoryInfo wdiSVC = Directory.CreateDirectory(wdiModule.FullName + Path.DirectorySeparatorChar + Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), pComponentLayer));
                DirectoryInfo wdiISVC = Directory.CreateDirectory(wdiModule.FullName + Path.DirectorySeparatorChar + Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), CodeGeneratorCommon.ComponentLayer.ISVC));


                TreeNode wNodeService =
                    trvCodeGenerated.Nodes[Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), pComponentLayer)];

                if (wNodeService.Nodes.Count == 0)
                    return;

                if (wNodeService.Nodes[0].Name != "ServiceTable")
                {
                    ///Custom Serivices (SVC) & interfases(SVC)
                    foreach (TreeNode wNodeClass in wNodeService.Nodes)
                    {
                        wGeneratedCode = (GeneratedCode) wNodeClass.Tag;

                        if (wGeneratedCode.Id.Substring(wGeneratedCode.Id.Length - 10, 10) == "Service.cs")
                        {
                            wzsFile = wdiSVC.FullName + Path.DirectorySeparatorChar + wGeneratedCode.Id;
                        }
                        else
                        {
                            wzsFile = wdiISVC.FullName + Path.DirectorySeparatorChar + wGeneratedCode.Id;
                        }

                        FileFunctions.SaveTextFile(wzsFile, wGeneratedCode.Code.ToString());
                    }
                }
                if (wNodeService.Nodes[0].Name == "ServiceTable")
                {
                    foreach (TreeNode wNodeServiceTable in wNodeService.Nodes)
                    {
                        foreach (TreeNode wNodeMethod in wNodeServiceTable.Nodes)
                        {
                            foreach (TreeNode wNodeClasses in wNodeMethod.Nodes)
                            {
                                wGeneratedCode = (GeneratedCode)wNodeClasses.Tag;

                                if (wGeneratedCode.Id.Substring(wGeneratedCode.Id.Length - 10, 10) == "Service.cs")
                                {
                                    wzsFile = wdiSVC.FullName + Path.DirectorySeparatorChar + wGeneratedCode.Id;
                                }
                                else
                                {
                                    wzsFile = wdiISVC.FullName + Path.DirectorySeparatorChar + wGeneratedCode.Id;
                                }

                                FileFunctions.SaveTextFile(wzsFile, wGeneratedCode.Code.ToString());
                            }
                        }
                    }
                }

               




             


            }

        }
예제 #14
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// Genera código de parámetros de un procedimiento almacenado de borrado.
        /// </summary>
        /// <param name="pMethodInfo">información del método para generar stored procedure.</param>
        /// <returns>Código fuente generado.</returns>
        /// <date>2007-5-25T00:00:00</date>
        /// <author>Marcelo Oviedo</author>
        static string GenCodeDeleteParameters(TableViewBase pTable, CodeGeneratorCommon.MethodActionType action)
        {
            StringBuilder wBuilder = new StringBuilder();

            foreach (Column wColumn in pTable.Columns)
            {
                if (wColumn.InPrimaryKey) //&& wColumn.Selected)
                {
                    StringBuilder wParamBuilder = BuildParameter(wColumn, action, false, false);
                    wBuilder.Append(wParamBuilder.ToString());
                }
            }

            RemoveChars(wBuilder, 3);

            return wBuilder.ToString();
        }
예제 #15
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        ///TODO: Ver si se utiliza esto
        static string GenCodeInsertReturnAutogenerated(TableViewBase pTable, CodeGeneratorCommon.MethodActionType action)
        {
            StringBuilder wBuilder = new StringBuilder();
            string wText = string.Empty;

            foreach (Column wColumn in pTable.Columns)
            {
                if (wColumn.Identity)
                {
                    wBuilder.Append("@");
                    wBuilder.Append(wColumn.Name);

                    //wText = Properties.Settings.Default.GetReturnAutogeneratedPattern.Replace("[Name]", wBuilder.ToString());
                    break;
                }
            }

            string wOutputIdentitySet = FwkGeneratorHelper.TemplateDocument.GetTemplate("SP_OutputIdentitySet").Content;
            if (wBuilder.Length == 0)
                return String.Empty;
            else
                return wOutputIdentitySet.Replace("[OutputVariable]", wBuilder.ToString());
        }
예제 #16
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pMethodInfo"></param>
        /// <returns></returns>
        /// <author>Marcelo Oviedo</author>
        static string GenCodeInsertValues(TableViewBase pTable, CodeGeneratorCommon.MethodActionType action)
        {
            StringBuilder wBuilder = new StringBuilder();

            foreach (Column wColumn in pTable.Columns)
            {
                //wColumn.Selected 
                if (IsColumnValidToInsert(wColumn))
                {
                    wBuilder.AppendLine(string.Concat("@", wColumn.Name,","));
                }
            }

            RemoveChars(wBuilder, 3);

            return wBuilder.ToString();
        }
예제 #17
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pMethodInfo"></param>
        /// <returns></returns>
        /// <author>Marcelo Oviedo</author>
        static string GenCodeInsertFields(TableViewBase pTable, CodeGeneratorCommon.MethodActionType action)
        {
            StringBuilder wBuilder = new StringBuilder();

            foreach (Column wColumn in pTable.Columns)
            {
                //!wColumn.Autogenerated && wColumn.Selected &&
                if (IsColumnValidToInsert(wColumn))
                {
                    wBuilder.AppendLine(wColumn.Name);
                    wBuilder.Append(",");
                }
            }

            RemoveChars(wBuilder, 2);

            return wBuilder.ToString();
        }
예제 #18
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// Retorna Nombre del SP segun toipo de accion del SP
        /// </summary>
        /// <param name="pTableName">Nombre de tabla</param>
        /// <param name="pActionType">Puede ser get insert update delente etc</param>
        /// <returns>StoredProcedureName</returns>
        static String GetStoredProcedureName(String pTableName, String pSchema, CodeGeneratorCommon.MethodActionType pActionType)
        {

            String pSpName = String.Empty;

      

            switch (pActionType)
            {
                case CodeGeneratorCommon.MethodActionType.Insert:
                    {
                        pSpName = string.Concat(pSchema, ".",pTableName, "_i");
                        break;
                    }

                case CodeGeneratorCommon.MethodActionType.Update:
                    {
                        pSpName = string.Concat(pSchema, ".", pTableName, "_u");
                        break;
                    }

                case CodeGeneratorCommon.MethodActionType.Delete:
                    {
                        pSpName = string.Concat(pSchema, ".", pTableName, "_d");
                        break;
                    }

                case CodeGeneratorCommon.MethodActionType.SearchByParam:
                    {
                        pSpName = string.Concat(pSchema, ".", pTableName, "_s");
                        break;
                    }

            }
           
            return pSpName;

        }
예제 #19
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        static void GenCodeGetByParam(TableViewBase pTable, string pSpBody, CodeGeneratorCommon.MethodActionType action, List<GeneratedCode> pProceduresCode)
        {
            GeneratedCode wCode = null;

            try
            {
                String wSPCode = GenerateStoreSearchByParam(pTable);

                wCode = new GeneratedCode();
                wCode.Code.Append(wSPCode);
                wCode.MethodActionType = action;
                wCode.Id = pTable.Name;
                pProceduresCode.Add(wCode);

            }
            finally
            {

                wCode = null;
            }
        }
예제 #20
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pMethodInfo"></param>
        /// <returns>string</returns>
        /// <author>Marcelo Oviedo</author>
        static string GenCodeUpdateParameters(TableViewBase pTable, CodeGeneratorCommon.MethodActionType action)
        {
            StringBuilder wBuilder = new StringBuilder();

            foreach (Column wColumn in pTable.Columns)
            {
                if (IsColumnValidToInsert(wColumn))
                {
                    StringBuilder wParamBuilder = BuildParameter(wColumn, action, false, true);
                    wBuilder.Append(wParamBuilder.ToString());
                }
            }

            RemoveChars(wBuilder, 3);

            return wBuilder.ToString();
        }
예제 #21
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        static void GenCodeInsert(TableViewBase pTable, string pSpBody, CodeGeneratorCommon.MethodActionType action, List<GeneratedCode> pProceduresCode)
        {

            StringBuilder wBuilder = null;
            GeneratedCode wCode = null;
            String wIntermediateCode = String.Empty;
            try
            {
                wBuilder = new StringBuilder();

                wBuilder = GenCodeCommon(pTable, pSpBody);
                wIntermediateCode = "(" + GenCodeInsertParameters(pTable, action) + ")";
                wBuilder.Replace("[Parameters]", wIntermediateCode);
                wBuilder.Replace("[Fields]", GenCodeInsertFields(pTable, action));
                wBuilder.Replace("[Values]", GenCodeInsertValues(pTable, action));
                wBuilder.Replace("[ReturnAutogenerated]", GenCodeInsertReturnAutogenerated(pTable, action));

                wBuilder.Replace(CodeGeneratorCommon.CommonConstants.CONST_STOREDPROCEDURE_NAME, GetStoredProcedureName(pTable.Name, pTable.Schema, action));

                //wCode = GetEntityGeneratedCode(pMethodInfo.Entity, pProceduresCode);
                wCode = new GeneratedCode();

                wCode.Id = pTable.Name;
                wCode.Code.Append(wBuilder.ToString());
                wCode.MethodActionType = action;
                pProceduresCode.Add(wCode);
            }
            finally
            {
                wBuilder = null;
                wCode = null;
            }
        }
예제 #22
0
        void LoadGeneratedCode(CodeGeneratorCommon.ComponentLayer pComponentLayer, TreeNode pNodeToClone)
        {
            String wNodeKey = Enum.GetName(typeof(CodeGeneratorCommon.ComponentLayer), pComponentLayer);

            trvCodeGenerated.Nodes[wNodeKey].Nodes.Clear();
            foreach (TreeNode node in pNodeToClone.Nodes)
            {
                trvCodeGenerated.Nodes[wNodeKey].Nodes.Add((TreeNode)node.Clone());
                
            }
           
            ListViewCodeGen.ImageToBackend(trvCodeGenerated.Nodes[wNodeKey]);
        }
예제 #23
0
파일: GenSP.cs 프로젝트: gpanayir/sffwk
        /// <summary>
        /// Genera el listado de campos para el update 
        /// </summary>
        /// <param name="pMethodInfo"></param>
        /// <returns>string</returns>
        /// <author>Marcelo Oviedo</author>
        static string GenCodeUpdateSetStatements(TableViewBase pTable, CodeGeneratorCommon.MethodActionType action)
        {
            StringBuilder wBuilder = new StringBuilder();

            foreach (Column wColumn in pTable.Columns)
            {
                if (!wColumn.Identity)//&& wColumn.Selected)
                {
                    wBuilder.Append(wColumn.Name);
                    wBuilder.Append(" = @");
                    
                    wBuilder.Append(wColumn.Name);
                    wBuilder.Append(",\r\n");
                }
            }

            RemoveChars(wBuilder, 3);

            return wBuilder.ToString();
        }
예제 #24
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        private static string GenDeclaration(TableViewBase pTable, CodeGeneratorCommon.MethodActionType t)
        {

            switch (t)
            {
                case CodeGeneratorCommon.MethodActionType.GetByParam:
                case CodeGeneratorCommon.MethodActionType.SearchByParam:
                    {
                        return FwkGeneratorHelper.TemplateDocument.GetTemplate("EntityAnListDeclaration").Content;
                    }

            }

            return string.Empty;

        }
예제 #25
0
파일: GenDAC.cs 프로젝트: Pelsoft/fwk_10.3
        /// <summary>
        /// Genera comentarios sobre los parámetros de un método.
        /// </summary>
        /// <param name="pMethodInfo">información sobre el método a generar.</param>
        /// <returns>Comentarios sobre los parámetros.</returns>
        /// <author>Marcelo Oviedo</author>
        static string GenParametersSummary(CodeGeneratorCommon.MethodActionType pMethodActionType, TableViewBase pTable)
        {
            StringBuilder wBuilder = new StringBuilder(FwkGeneratorHelper.TemplateDocument.GetTemplate("ParameterSummary").Content);



            switch (pMethodActionType)
            {
                case CodeGeneratorCommon.MethodActionType.Insert:
                case CodeGeneratorCommon.MethodActionType.Update:
                case CodeGeneratorCommon.MethodActionType.GetByParam:
                case CodeGeneratorCommon.MethodActionType.SearchByParam:

                    wBuilder.Replace("[MethodParameterName]", pTable.Name);
                    wBuilder.Replace("[ParameterName]", pTable.Name);
                    break;
                case CodeGeneratorCommon.MethodActionType.Delete:
                    Column pPK = FwkGeneratorHelper.GetPrimaryKey(pTable);
                    if (pPK != null)
                    {
                        wBuilder.Replace("[MethodParameterName]", pPK.Name);
                    }
                    else
                    {
                        wBuilder.Replace("[MethodParameterName]", "pId");
                    }
                    wBuilder.Replace("[ParameterName]", string.Concat("Id por el cual realizar la busqueda de registros a eliminar de tabla ", pTable.Name));
                    break;
            }
            return wBuilder.ToString();




        }
예제 #26
0
 internal Boolean Contains(CodeGeneratorCommon.GeneratorsType pGeneratorsType)
 {
     return _GeneratorsList.ContainsKey(pGeneratorsType);
 }
예제 #27
0
파일: wizBase.cs 프로젝트: Pelsoft/fwk_10.3
 public void DoEvent(object o, CodeGeneratorCommon.WizardButton r)
 {
     if (OnWizardButtonClickEvent != null)
         OnWizardButtonClickEvent(o,r);
 }