//public int GetCodeFunctionEntityID(int entityID, int CodeFunctionID)
        //{
        //    List<CodeFunction_EntityDTO> result = new List<CodeFunction_EntityDTO>();
        //    using (var projectContext = new DataAccess.MyProjectEntities())
        //    {
        //        //projectContext.Configuration.LazyLoadingEnabled = false;

        //        var item = projectContext.CodeFunction_TableDrivedEntity.FirstOrDefault(x => x.TableDrivedEntityID == entityID && x.CodeFunctionID == CodeFunctionID);
        //        if (item != null)
        //            return item.ID;
        //        else
        //            return 0;

        //    }
        //}
        private List <CodeFunction_Entity_ColumnDTO> ToCodeFunctionEntityColumnsDTO(CodeFunction_TableDrivedEntity cItem)
        {
            BizColumn bizColumn = new BizColumn();
            List <CodeFunction_Entity_ColumnDTO> result = new List <CodeFunction_Entity_ColumnDTO>();

            foreach (var column in cItem.CodeFunction_TableDrivedEntity_Parameters)
            {
                var item = new CodeFunction_Entity_ColumnDTO();
                item.ID = column.ID;
                item.CodeFunctionParameterID = column.CodeFunctionParameterID;
                item.CodeFunction_EntityID   = column.CodeFunction_TableDrivedEntityID;
                item.ColumnID   = column.ColumnID;
                item.ColumnName = column.Column.Name;

                item.FunctionColumnDotNetType = Type.GetType(column.CodeFunctionParameter.DataType);
                item.FunctionColumnParamName  = column.CodeFunctionParameter.ParamName;
                result.Add(item);
            }
            return(result);
        }
Beispiel #2
0
        //private void SetCodeFunctionParametersToGrid(CodeFunction_EntityDTO codeFunctionEntity,int codeFunctionID)
        //{

        //}

        private void SetCodeFunctionParametersToGrid(List <CodeFunctionColumnDTO> functionColumns, CodeFunction_EntityDTO codeFunctionEntity)
        {
            dtgCodeFunctionParams.ItemsSource = null;
            List <CodeFunction_Entity_ColumnDTO> gridColumns = new List <CodeFunction_Entity_ColumnDTO>();

            foreach (var item in functionColumns)
            {
                var row = new CodeFunction_Entity_ColumnDTO();
                row.CodeFunctionParameterID  = item.ID;
                row.FunctionColumnParamName  = item.ParameterName;
                row.FunctionDataType         = item.DataType;
                row.FunctionColumnDotNetType = item.DotNetType;
                var existingRow = codeFunctionEntity.CodeFunctionEntityColumns.FirstOrDefault(x => x.FunctionColumnParamName == item.ParameterName);
                if (existingRow != null)
                {
                    row.ColumnID = existingRow.ColumnID;
                }
                gridColumns.Add(row);
            }


            dtgCodeFunctionParams.ItemsSource = gridColumns;
        }