private string GetClass(TablesWithColumnsDto tableWithColumns)
        {
            var template = Global.TemplateManager[TemplateType.Class];
            var sysObjects = tableWithColumns.MapToModel<SysObjects>();

            var result =
                template.Render(
                    Hash.FromAnonymousObject(new
                    {
                        table = new TableWithColumnsDrop(sysObjects),
                        columns = GetProperties(sysObjects)
                    }
                                            )
                                );

            return result;
        }
        public string Generate(TemplateType templateType, TablesWithColumnsDto tableWithColumns)
        {
            switch (templateType)
            {
                case TemplateType.Namespace:
                    {
                        if (tableWithColumns != null)
                        {
                            var template = Global.TemplateManager[TemplateType.Namespace];
                            var result =
                                    template.Render(
                                    Hash.FromAnonymousObject(new
                                    {
                                        @class = GetClass(tableWithColumns)
                                    }));

                            return result;
                        }

                        break;
                    }

                case TemplateType.Class:
                    {
                        if (tableWithColumns != null)
                        {
                            return GetClass(tableWithColumns);
                        }
                        break;
                    }
                default:
                    {
                        var template = Global.TemplateManager[TemplateType.Class];
                        break;
                    }
            }

            return string.Empty;
        }
        private void RenderOutput(TablesWithColumnsDto tableWithColumnsDto)
        {
            ////rtxtOutput.Text = _renderOutputtable.RenderOutput(tableWithColumnsDto);

            //rtxtOutput.Clear();

            //rtxtOutput.AppendColoredText( _renderOutputtable.RenderOutput(tableWithColumnsDto), Color.Blue);

            webBrowser1.DocumentText = "<font face='Consolas'>" + _renderOutputtable.RenderOutput(tableWithColumnsDto) + "</b>";
            webBrowser1.Document.ExecCommand("SelectAll", false, null);
            webBrowser1.Document.ExecCommand("Copy", false, null);

            rtxtOutput.Paste();
        }
        private TreeNode[] GetColumnsForTablesInTreeview(TablesWithColumnsDto tablesWithColumns)
        {
            var columnsWithPrimaryOrForeignKey = tablesWithColumns.ColumnsWithKeys;

            return tablesWithColumns.Columns.Select(y =>
                                        {
                                            var columnNode = new TreeNode(y.name);
                                            //Set image for primary/foreign key
                                            var blnColumnExists = columnsWithPrimaryOrForeignKey.Any(x => x.COLUMN_NAME == y.name);
                                            if (blnColumnExists)
                                            {
                                                var keyType = columnsWithPrimaryOrForeignKey.Where(z => z.COLUMN_NAME == y.name).Select(k => k.KeyType).ToList();
                                                columnNode.ImageIndex = keyType.Contains("PRIMARY KEY") ? 5 : 6;
                                                columnNode.SelectedImageIndex = keyType.Contains("PRIMARY KEY") ? 5 : 6;
                                            }
                                            else
                                            {
                                                columnNode.ImageIndex = 4;
                                                columnNode.SelectedImageIndex = 4;
                                            }

                                            return columnNode;
                                        }).ToArray();

            //node.ImageIndex = 3;
            //node.SelectedImageIndex = 3;
            //node.Tag = tablesWithColumns;

            //return node;
        }