コード例 #1
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            varName ??= "RouteOptions";
            Console.WriteLine("Current route options generator" + ConvertUtil.SerializeObject(this));
            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.RouteOptions", space);
            _ = stringBuilder.AppendLine($"{{", space);
            _ = stringBuilder.AppendLine($"    IsEnable = {IsEnable.ToString().ToLower()},", space);
            if (Routes != null && Routes.Any())
            {
                _ = stringBuilder.AppendLine($"    Routes = new System.Collections.Generic.List<LetPortal.Portal.Entities.Shared.Route>", space);
                _ = stringBuilder.AppendLine($"    {{", space);
                foreach (var route in Routes)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Shared.Route", space);
                    _ = stringBuilder.AppendLine($"        {{", space);
                    _ = stringBuilder.AppendLine($"            RedirectUrl = \"{route.RedirectUrl}\",", space);
                    _ = stringBuilder.AppendLine($"            Condition = \"{route.Condition}\",", space);
                    _ = stringBuilder.AppendLine($"            IsSameDomain = {route.IsSameDomain.ToString().ToLower()},", space);
                    _ = stringBuilder.AppendLine($"         }},", space);
                }
                _ = stringBuilder.AppendLine($"    }},", space);
            }
            _ = stringBuilder.AppendLine($"}},", space);
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #2
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            varName ??= "DatasourceOptions";

            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.DatasourceOptions", space);
            _ = stringBuilder.AppendLine($"{{", space);
            switch (Type)
            {
            case DatasourceControlType.Database:
                var databaseType = "LetPortal.Portal.Entities.Shared.DatasourceControlType.Database";
                _ = stringBuilder.AppendLine($"    Type = {databaseType},", space);
                _ = stringBuilder.AppendLine(DatabaseOptions.GenerateCode("DatabaseOptions", space + 1).InsertingCode);
                break;

            case DatasourceControlType.StaticResource:
                var staticDatabaseType = "LetPortal.Portal.Entities.Shared.DatasourceControlType.StaticResource";
                _ = stringBuilder.AppendLine($"    Type = {staticDatabaseType},", space);
                _ = stringBuilder.AppendLine(DatasourceStaticOptions.GenerateCode("DatasourceStaticOptions", space + 1).InsertingCode);
                break;

            case DatasourceControlType.WebService:
                var httpType = "LetPortal.Portal.Entities.Shared.DatasourceControlType.WebService";
                _ = stringBuilder.AppendLine($"    Type = {httpType},", space);
                _ = stringBuilder.AppendLine(HttpServiceOptions.GenerateCode("HttpServiceOptions", space + 1).InsertingCode);
                break;
            }
            _ = stringBuilder.AppendLine($"}},", space);

            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #3
0
        public override CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            var stringBuilder = new StringBuilder();

            varName = varName != null ? varName : "EventHttpServiceOptions";
            _       = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Components.Controls.EventHttpServiceOptions", space);
            _       = stringBuilder.AppendLine($"{{", space);
            _       = stringBuilder.AppendLine($"    HttpServiceUrl = \"{HttpServiceUrl}\",", space);
            _       = stringBuilder.AppendLine($"    HttpMethod = \"{HttpMethod}\",", space);
            _       = stringBuilder.AppendLine($"    HttpSuccessCode = \"{HttpSuccessCode}\",", space);
            _       = stringBuilder.AppendLine($"    JsonBody = {StringUtil.ToLiteral(JsonBody)},", space);
            _       = stringBuilder.AppendLine($"    OutputProjection = \"{OutputProjection}\",", space);
            if (BoundData != null && BoundData.Length > 0)
            {
                _ = stringBuilder.AppendLine($"    BoundData = new string[]", space);
                _ = stringBuilder.AppendLine("     {", space);
                foreach (var bound in BoundData)
                {
                    _ = stringBuilder.AppendLine($"         \"{bound}\",", space);
                }
                _ = stringBuilder.AppendLine("     },", space);
            }
            _ = stringBuilder.AppendLine($"}},", space);

            codeResult.InsertingCode = stringBuilder.ToString();

            return(codeResult);
        }
コード例 #4
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var result        = new CodeGenerableResult();
            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.MapDataOptions", space);
            _ = stringBuilder.AppendLine($"{{", space);
            _ = stringBuilder.AppendLine($"    KeptAsStore = {KeptAsStore.ToString().ToLower()},", space);
            _ = stringBuilder.AppendLine($"    OutputMapping = \"{OutputMapping}\"", space);
            _ = stringBuilder.AppendLine($"}}", space);
            result.InsertingCode = stringBuilder.ToString();
            return(result);
        }
コード例 #5
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            varName ??= "DatasourceStaticOptions";
            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.DatasourceStaticOptions", space);
            _ = stringBuilder.AppendLine($"{{", space);
            _ = stringBuilder.AppendLine($"    JsonResource = {StringUtil.ToLiteral(JsonResource)}", space);
            _ = stringBuilder.AppendLine($"}},", space);
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #6
0
        public virtual CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            varName = varName != null ? varName : "DatabaseOptions";
            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.SharedDatabaseOptions", space);
            _ = stringBuilder.AppendLine($"{{", space);
            _ = stringBuilder.AppendLine($"    DatabaseConnectionId = \"{DatabaseConnectionId}\",", space);
            _ = stringBuilder.AppendLine($"    Query = {StringUtil.ToLiteral(Query)},", space);
            _ = stringBuilder.AppendLine($"}},", space);
            codeResult.InsertingCode = stringBuilder.ToString();

            return(codeResult);
        }
コード例 #7
0
ファイル: Page.cs プロジェクト: weedkiller/let.portal
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"    Builder = new LetPortal.Portal.Entities.Pages.PageBuilder");
            _ = stringBuilder.AppendLine($"    {{");
            if (Sections != null && Sections.Any())
            {
                _ = stringBuilder.AppendLine($"        Sections = new System.Collections.Generic.List<LetPortal.Portal.Entities.Pages.PageSection>");
                _ = stringBuilder.AppendLine($"        {{");
                foreach (var section in Sections)
                {
                    _ = stringBuilder.AppendLine($"            new LetPortal.Portal.Entities.Pages.PageSection");
                    _ = stringBuilder.AppendLine($"            {{");
                    _ = stringBuilder.AppendLine($"                Id = \"{section.Id}\",");
                    _ = stringBuilder.AppendLine($"                ComponentId = \"{section.ComponentId}\",");
                    _ = stringBuilder.AppendLine($"                Name = \"{section.Name}\",");
                    _ = stringBuilder.AppendLine($"                DisplayName = \"{section.DisplayName}\",");
                    var constructionType = "LetPortal.Portal.Entities.Pages.SectionContructionType." + Enum.GetName(typeof(SectionContructionType), section.ConstructionType);
                    _ = stringBuilder.AppendLine($"                ConstructionType = {constructionType},");
                    _ = stringBuilder.AppendLine($"                Hidden = \"{section.Hidden}\",");
                    if (section.SectionDatasource != null)
                    {
                        _ = stringBuilder.AppendLine($"                SectionDatasource = new LetPortal.Portal.Entities.Pages.SectionDatasource");
                        _ = stringBuilder.AppendLine($"                {{");
                        _ = stringBuilder.AppendLine($"                    DatasourceBindName = \"{section.SectionDatasource.DatasourceBindName}\",");
                        _ = stringBuilder.AppendLine($"                    DataStoreName = \"{section.SectionDatasource.DataStoreName}\"");
                        _ = stringBuilder.AppendLine($"                }},");
                    }
                    if (section != Sections.Last())
                    {
                        _ = stringBuilder.AppendLine($"            }},");
                    }
                    else
                    {
                        _ = stringBuilder.AppendLine($"            }}");
                    }
                }
                _ = stringBuilder.AppendLine($"        }}");
            }
            _ = stringBuilder.AppendLine($"    }},");

            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #8
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"new LetPortal.Portal.Entities.Components.Controls.PageControlEvent", space);
            _ = stringBuilder.AppendLine("{", space);
            _ = stringBuilder.AppendLine($"    EventName = \"{EventName}\",", space);
            var eventActionType = "LetPortal.Portal.Entities.Components.Controls.EventActionType." + Enum.GetName(typeof(EventActionType), EventActionType);

            _ = stringBuilder.AppendLine($"    EventActionType = {eventActionType},", space);
            _ = stringBuilder.AppendLine(EventHttpServiceOptions.GenerateCode().InsertingCode, space);
            _ = stringBuilder.AppendLine(EventDatabaseOptions.GenerateCode().InsertingCode, space);
            _ = stringBuilder.AppendLine(TriggerEventOptions.GenerateCode().InsertingCode, space);
            _ = stringBuilder.AppendLine("}", space);
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #9
0
        public virtual CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            var stringBuilder = new StringBuilder();

            varName = varName != null ? varName : "HttpServiceOptions";
            _       = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.HttpServiceOptions", space);
            _       = stringBuilder.AppendLine($"{{", space);
            _       = stringBuilder.AppendLine($"    HttpServiceUrl = \"{HttpServiceUrl}\",", space);
            _       = stringBuilder.AppendLine($"    HttpMethod = \"{HttpMethod}\",", space);
            _       = stringBuilder.AppendLine($"    HttpSuccessCode = \"{HttpSuccessCode}\",", space);
            _       = stringBuilder.AppendLine($"    JsonBody = {StringUtil.ToLiteral(JsonBody)},", space);
            _       = stringBuilder.AppendLine($"    OutputProjection = \"{OutputProjection}\",", space);
            _       = stringBuilder.AppendLine($"}},", space);

            codeResult.InsertingCode = stringBuilder.ToString();

            return(codeResult);
        }
コード例 #10
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult
            {
                DeletingCode = $"versionContext.DeleteData<LetPortal.Portal.Entities.Databases.DatabaseConnection>(\"{Id}\");"
            };

            var stringBuilder = new StringBuilder();

            varName ??= Name.Replace("-", "", System.StringComparison.OrdinalIgnoreCase) + "Connection";
            _ = stringBuilder.AppendLine($"var {varName} = new LetPortal.Portal.Entities.Databases.DatabaseConnection");
            _ = stringBuilder.AppendLine($"{{");
            _ = stringBuilder.AppendLine($"    Id = \"{Id}\",");
            _ = stringBuilder.AppendLine($"    Name = \"{Name}\",");
            _ = stringBuilder.AppendLine($"    DisplayName = \"{DisplayName}\",");
            _ = stringBuilder.AppendLine($"    ConnectionString = \"{ConnectionString}\",");
            _ = stringBuilder.AppendLine($"    DatabaseConnectionType = \"{DatabaseConnectionType}\",");
            _ = stringBuilder.AppendLine($"    DataSource = \"{DataSource}\",");
            _ = stringBuilder.AppendLine($"}};");
            _ = stringBuilder.AppendLine($"versionContext.InsertData({varName});");
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #11
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            Console.WriteLine("Current button options " + ConvertUtil.SerializeObject(this));
            var codeResult = new CodeGenerableResult();

            varName ??= "ButtonOptions";
            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.ButtonOptions", space);
            _ = stringBuilder.AppendLine($"{{", space);
            if (ActionCommandOptions != null)
            {
                _ = stringBuilder.AppendLine(ActionCommandOptions.GenerateCode(space: 4).InsertingCode);
            }
            if (RouteOptions != null)
            {
                Console.WriteLine("Current route options " + ConvertUtil.SerializeObject(RouteOptions));
                _ = stringBuilder.AppendLine(RouteOptions.GenerateCode("RouteOptions", space: 4).InsertingCode);
            }
            _ = stringBuilder.AppendLine($"}},", space);
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #12
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            var stringBuilder = new StringBuilder();

            varName = varName != null ? varName : "TriggerEventOptions";
            _       = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Components.Controls.TriggerEventOptions", space);
            _       = stringBuilder.AppendLine($"{{", space);
            if (EventsList != null && EventsList.Length > 0)
            {
                _ = stringBuilder.AppendLine($"    EventsList = new string[]", space);
                _ = stringBuilder.AppendLine("     {", space);
                foreach (var eventList in EventsList)
                {
                    _ = stringBuilder.AppendLine($"         \"{eventList}\",", space);
                }
                _ = stringBuilder.AppendLine("     },", space);
            }
            _ = stringBuilder.AppendLine($"}}", space);
            codeResult.InsertingCode = stringBuilder.ToString();

            return(codeResult);
        }
コード例 #13
0
ファイル: DynamicList.cs プロジェクト: weedkiller/let.portal
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult
            {
                DeletingCode = $"versionContext.DeleteData<LetPortal.Portal.Entities.SectionParts.DynamicList>(\"{Id}\");"
            };

            var stringBuilder = new StringBuilder();

            varName ??= Name.Replace("-", "", StringComparison.OrdinalIgnoreCase) + "List";
            _ = stringBuilder.AppendLine($"var {varName} = new LetPortal.Portal.Entities.SectionParts.DynamicList");
            _ = stringBuilder.AppendLine("{");
            _ = stringBuilder.AppendLine($"    Id = \"{Id}\",");
            _ = stringBuilder.AppendLine($"    Name = \"{Name}\",");
            _ = stringBuilder.AppendLine($"    AppId = \"{AppId}\",");
            _ = stringBuilder.AppendLine($"    DisplayName = \"{DisplayName}\",");
            _ = stringBuilder.AppendLine($"    Options = new System.Collections.Generic.List<LetPortal.Portal.Entities.Pages.ShellOption>");
            _ = stringBuilder.AppendLine($"    {{");
            foreach (var option in Options)
            {
                _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Pages.ShellOption");
                _ = stringBuilder.AppendLine($"        {{");
                _ = stringBuilder.AppendLine($"            Key = \"{option.Key}\",");
                _ = stringBuilder.AppendLine($"            Value = \"{option.Value}\",");
                _ = stringBuilder.AppendLine($"            Description = \"{option.Description}\"");
                if (option != Options.Last())
                {
                    _ = stringBuilder.AppendLine($"        }},");
                }
                else
                {
                    _ = stringBuilder.AppendLine($"        }}");
                }
            }
            _ = stringBuilder.AppendLine($"    }},");
            _ = stringBuilder.AppendLine($"    ListDatasource = new LetPortal.Portal.Entities.SectionParts.DynamicListDatasource");
            _ = stringBuilder.AppendLine($"    {{");
            if (ListDatasource.SourceType == DynamicListSourceType.Database)
            {
                _ = stringBuilder.AppendLine(ListDatasource.DatabaseConnectionOptions.GenerateCode("DatabaseConnectionOptions", 2).InsertingCode);
                _ = stringBuilder.AppendLine($"        SourceType = LetPortal.Portal.Entities.SectionParts.DynamicListSourceType.Database");
            }
            else
            {
                // TODO: implement for web service datasource
            }
            _ = stringBuilder.AppendLine($"    }},");

            if (ColumnsList != null && ColumnsList.ColumnDefs != null && ColumnsList.ColumnDefs.Any())
            {
                _ = stringBuilder.AppendLine($"    ColumnsList = new LetPortal.Portal.Entities.SectionParts.ColumnsList");
                _ = stringBuilder.AppendLine($"    {{");
                _ = stringBuilder.AppendLine($"        ColumnDefs = new System.Collections.Generic.List<LetPortal.Portal.Entities.SectionParts.ColumnDef>");
                _ = stringBuilder.AppendLine($"        {{");
                foreach (var colDef in ColumnsList.ColumnDefs)
                {
                    _ = stringBuilder.AppendLine($"            new LetPortal.Portal.Entities.SectionParts.ColumnDef");
                    _ = stringBuilder.AppendLine($"            {{");
                    _ = stringBuilder.AppendLine($"                Name = \"{colDef.Name}\",");
                    _ = stringBuilder.AppendLine($"                DisplayName = \"{colDef.DisplayName}\",");
                    _ = stringBuilder.AppendLine($"                IsHidden = {colDef.IsHidden.ToString().ToLower()},");
                    _ = stringBuilder.AppendLine($"                DisplayFormat = \"{colDef.DisplayFormat}\",");
                    _ = stringBuilder.AppendLine($"                AllowSort = {colDef.AllowSort.ToString().ToLower()},");
                    _ = stringBuilder.AppendLine($"                HtmlFunction = \"{colDef.HtmlFunction}\",");
                    _ = stringBuilder.AppendLine($"                DisplayFormatAsHtml = {colDef.DisplayFormatAsHtml.ToString().ToLower()},");
                    _ = stringBuilder.AppendLine($"                Order = {colDef.Order},");
                    if (colDef.SearchOptions != null)
                    {
                        _ = stringBuilder.AppendLine($"                SearchOptions = new LetPortal.Portal.Entities.SectionParts.SearchOptions");
                        _ = stringBuilder.AppendLine($"                {{");
                        _ = stringBuilder.AppendLine($"                    AllowInAdvancedMode = {colDef.SearchOptions.AllowInAdvancedMode.ToString().ToLower()},");
                        _ = stringBuilder.AppendLine($"                    AllowTextSearch = {colDef.SearchOptions.AllowInAdvancedMode.ToString().ToLower()},");
                        var fieldValueTypeStr = "LetPortal.Portal.Entities.SectionParts.FieldValueType." + Enum.GetName(typeof(FieldValueType), colDef.SearchOptions.FieldValueType);
                        _ = stringBuilder.AppendLine($"                    FieldValueType = {fieldValueTypeStr}");
                        _ = stringBuilder.AppendLine($"                }},");
                    }

                    if (colDef.DatasourceOptions != null)
                    {
                        _ = stringBuilder.AppendLine($"                DatasourceOptions = new LetPortal.Portal.Entities.Shared.DynamicListDatasourceOptions");
                        _ = stringBuilder.AppendLine($"                {{");
                        var typeStr = "LetPortal.Portal.Entities.Shared.DatasourceControlType." + Enum.GetName(typeof(DatasourceControlType), colDef.DatasourceOptions.Type);
                        _ = stringBuilder.AppendLine($"                    Type = {typeStr},");
                        _ = stringBuilder.AppendLine($"                    TriggeredEvents = \"{colDef.DatasourceOptions.TriggeredEvents}\",");
                        _ = stringBuilder.AppendLine($"                    OutputMapProjection = \"{colDef.DatasourceOptions.OutputMapProjection}\",");
                        switch (colDef.DatasourceOptions.Type)
                        {
                        case DatasourceControlType.StaticResource:
                            _ = stringBuilder.AppendLine($"                   DatasourceStaticOptions = new LetPortal.Portal.Entities.Shared.DatasourceStaticOptions");
                            _ = stringBuilder.AppendLine($"                   {{");
                            _ = stringBuilder.AppendLine($"                        JsonResource = {StringUtil.ToLiteral(colDef.DatasourceOptions.DatasourceStaticOptions.JsonResource)}");
                            _ = stringBuilder.AppendLine($"                   }},");
                            break;

                        case DatasourceControlType.Database:
                            _ = stringBuilder.AppendLine(colDef.DatasourceOptions.DatabaseOptions.GenerateCode("DatabaseOptions", space: 4).InsertingCode);
                            break;

                        case DatasourceControlType.WebService:
                            // TODO: We will implement this later
                            break;
                        }
                        _ = stringBuilder.AppendLine($"                }},");
                    }

                    if (colDef != ColumnsList.ColumnDefs.Last())
                    {
                        _ = stringBuilder.AppendLine($"            }},");
                    }
                    else
                    {
                        _ = stringBuilder.AppendLine($"            }}");
                    }
                }
                _ = stringBuilder.AppendLine($"        }}");
                _ = stringBuilder.AppendLine($"    }},");
            }

            if (CommandsList != null && CommandsList.CommandButtonsInList.Any())
            {
                _ = stringBuilder.AppendLine($"    CommandsList = new LetPortal.Portal.Entities.SectionParts.CommandsList");
                _ = stringBuilder.AppendLine($"    {{");
                _ = stringBuilder.AppendLine($"        CommandButtonsInList = new System.Collections.Generic.List<LetPortal.Portal.Entities.SectionParts.CommandButtonInList>");
                _ = stringBuilder.AppendLine($"        {{");
                foreach (var command in CommandsList.CommandButtonsInList)
                {
                    _ = stringBuilder.AppendLine($"            new LetPortal.Portal.Entities.SectionParts.CommandButtonInList");
                    _ = stringBuilder.AppendLine($"            {{");
                    _ = stringBuilder.AppendLine($"                Name = \"{command.Name}\",");
                    _ = stringBuilder.AppendLine($"                DisplayName = \"{command.DisplayName}\",");
                    _ = stringBuilder.AppendLine($"                Color = \"{command.Color}\",");
                    _ = stringBuilder.AppendLine($"                Icon = \"{command.Icon}\",");
                    _ = stringBuilder.AppendLine($"                AllowRefreshList = {command.AllowRefreshList.ToString().ToLower()},");
                    var commandPosition = "LetPortal.Portal.Entities.SectionParts.CommandPositionType." + Enum.GetName(typeof(CommandPositionType), command.CommandPositionType);
                    _ = stringBuilder.AppendLine($"                CommandPositionType = {commandPosition},");
                    _ = stringBuilder.AppendLine($"                Order = {command.Order},");
                    _ = stringBuilder.AppendLine(command.ActionCommandOptions.GenerateCode(space: 4).InsertingCode);
                    if (command != CommandsList.CommandButtonsInList.Last())
                    {
                        _ = stringBuilder.AppendLine($"            }},");
                    }
                    else
                    {
                        _ = stringBuilder.AppendLine($"            }}");
                    }
                }
                _ = stringBuilder.AppendLine($"        }}");
                _ = stringBuilder.AppendLine($"    }},");
            }
            _ = stringBuilder.AppendLine("};");

            _ = stringBuilder.AppendLine($"versionContext.InsertData({varName});");
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #14
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult
            {
                DeletingCode = $"versionContext.DeleteData<LetPortal.Portal.Entities.Apps.App>(\"{Id}\");"
            };
            var stringBuilder = new StringBuilder();

            varName = varName != null ? varName: Name.Replace("-", "", StringComparison.OrdinalIgnoreCase) + "App";
            _       = stringBuilder.AppendLine($"var {varName} = new LetPortal.Portal.Entities.Apps.App");
            _       = stringBuilder.AppendLine("{");
            _       = stringBuilder.AppendLine($"    Id = \"{Id}\",");
            _       = stringBuilder.AppendLine($"    Name = \"{Name}\",");
            _       = stringBuilder.AppendLine($"    Logo = \"{Logo}\",");
            _       = stringBuilder.AppendLine($"    Author = \"{Author}\",");
            _       = stringBuilder.AppendLine($"    DefaultUrl = \"{DefaultUrl}\",");
            _       = stringBuilder.AppendLine($"    CurrentVersionNumber = \"{CurrentVersionNumber}\",");
            _       = stringBuilder.AppendLine($"    DisplayName = \"{DisplayName}\",");
            _       = stringBuilder.AppendLine($"    CreatedDate = DateTime.Now,");
            _       = stringBuilder.AppendLine($"    ModifiedDate = DateTime.Now,");
            if (Menus != null && Menus.Any())
            {
                _ = stringBuilder.AppendLine($"    Menus = new List<LetPortal.Portal.Entities.Menus.Menu>");
                _ = stringBuilder.AppendLine("    {");
                foreach (var menu in Menus)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Menus.Menu");
                    _ = stringBuilder.AppendLine("        {");
                    _ = stringBuilder.AppendLine($"            Id = \"{menu.Id}\",");
                    _ = stringBuilder.AppendLine($"            DisplayName = \"{menu.DisplayName}\",");
                    _ = stringBuilder.AppendLine($"            Icon = \"{menu.Icon}\",");
                    _ = stringBuilder.AppendLine($"            Url = \"{menu.Url}\",");
                    _ = stringBuilder.AppendLine($"            MenuPath = \"{menu.MenuPath}\",");
                    _ = stringBuilder.AppendLine($"            Order = {menu.Order},");
                    if (menu.SubMenus != null && menu.SubMenus.Any())
                    {
                        _ = stringBuilder.AppendLine($"            SubMenus = new List<LetPortal.Portal.Entities.Menus.Menu>");
                        _ = stringBuilder.AppendLine("            {");
                        foreach (var subMenu in menu.SubMenus)
                        {
                            _ = stringBuilder.AppendLine($"            new LetPortal.Portal.Entities.Menus.Menu");
                            _ = stringBuilder.AppendLine("            {");
                            _ = stringBuilder.AppendLine($"                Id = \"{subMenu.Id}\",");
                            _ = stringBuilder.AppendLine($"                DisplayName = \"{subMenu.DisplayName}\",");
                            _ = stringBuilder.AppendLine($"                Icon = \"{subMenu.Icon}\",");
                            _ = stringBuilder.AppendLine($"                Url = \"{subMenu.Url}\",");
                            _ = stringBuilder.AppendLine($"                MenuPath = \"{subMenu.MenuPath}\",");
                            _ = stringBuilder.AppendLine($"                Order = {subMenu.Order},");
                            _ = stringBuilder.AppendLine("             },");
                        }
                        _ = stringBuilder.AppendLine("            }");
                    }
                    _ = stringBuilder.AppendLine("        },");
                }
                _ = stringBuilder.AppendLine("    },");
            }

            if (MenuProfiles != null && MenuProfiles.Any())
            {
                _ = stringBuilder.AppendLine($"    MenuProfiles = new List<LetPortal.Portal.Entities.Apps.MenuProfile>");
                _ = stringBuilder.AppendLine("    {");
                foreach (var menuProfile in MenuProfiles)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Apps.MenuProfile");
                    _ = stringBuilder.AppendLine("        {");
                    _ = stringBuilder.AppendLine($"            Role = \"{menuProfile.Role}\",");
                    _ = stringBuilder.AppendLine($"            MenuIds = new List<string>");
                    _ = stringBuilder.AppendLine("            {");
                    foreach (var menuId in menuProfile.MenuIds)
                    {
                        _ = stringBuilder.AppendLine($"                 \"{menuId}\",");
                    }
                    _ = stringBuilder.AppendLine("            }");
                    _ = stringBuilder.AppendLine("        },");
                }
                _ = stringBuilder.AppendLine("    }");
            }
            _ = stringBuilder.AppendLine("};");
            _ = stringBuilder.AppendLine($"versionContext.InsertData({varName});");
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #15
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult()
            {
                DeletingCode = $"versionContext.DeleteData<LetPortal.Portal.Entities.Components.Controls.CompositeControl>(\"{Id}\");"
            };
            var stringBuilder = new StringBuilder();

            varName ??= Name.Replace("-", "", System.StringComparison.OrdinalIgnoreCase) + "Standard";

            _ = stringBuilder.AppendLine($"var {varName} = new LetPortal.Portal.Entities.Components.Controls.CompositeControl");
            _ = stringBuilder.AppendLine($"{{");
            _ = stringBuilder.AppendLine($"    Id = \"{Id}\",");
            _ = stringBuilder.AppendLine($"    Name = \"{Name}\",");
            _ = stringBuilder.AppendLine($"    DisplayName = \"{DisplayName}\",");
            _ = stringBuilder.AppendLine($"    AppId = \"{AppId}\",");
            if (Controls != null && Controls.Any())
            {
                _ = stringBuilder.AppendLine($"    Controls = new List<LetPortal.Portal.Entities.SectionParts.Controls.PageControl>");
                _ = stringBuilder.AppendLine($"    {{");
                foreach (var control in Controls)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.SectionParts.Controls.PageControl");
                    _ = stringBuilder.AppendLine($"        {{");
                    _ = stringBuilder.AppendLine($"            Name = \"{control.Name}\",");
                    var controlType = "LetPortal.Portal.Entities.SectionParts.Controls.ControlType." + Enum.GetName(typeof(ControlType), control.Type);
                    _ = stringBuilder.AppendLine($"            Type = {controlType},");
                    _ = stringBuilder.AppendLine($"            Order = {control.Order},");
                    _ = stringBuilder.AppendLine($"            CompositeControlId = \"{control.CompositeControlId}\",");
                    // Control Options
                    _ = stringBuilder.AppendLine($"            Options = new List<LetPortal.Portal.Entities.Pages.ShellOption>");
                    _ = stringBuilder.AppendLine($"            {{");
                    foreach (var option in control.Options)
                    {
                        _ = stringBuilder.AppendLine($"                new LetPortal.Portal.Entities.Pages.ShellOption");
                        _ = stringBuilder.AppendLine($"                {{");
                        _ = stringBuilder.AppendLine($"                    Key = \"{option.Key}\",");
                        _ = stringBuilder.AppendLine($"                    Value = \"{option.Value}\",");
                        _ = stringBuilder.AppendLine($"                    Description = \"{option.Description}\",");
                        _ = stringBuilder.AppendLine($"                }},");
                    }
                    _ = stringBuilder.AppendLine($"            }},");

                    // Control Datasource
                    if (control.DatasourceOptions != null && (control.Type == ControlType.Select || control.Type == ControlType.Radio || control.Type == ControlType.AutoComplete))
                    {
                        _ = stringBuilder.AppendLine(control.DatasourceOptions.GenerateCode().InsertingCode, 4);
                    }
                    // Control Validators
                    _ = stringBuilder.AppendLine($"            Validators = new List<LetPortal.Portal.Entities.SectionParts.Controls.PageControlValidator>");
                    _ = stringBuilder.AppendLine($"            {{");
                    foreach (var validator in control.Validators)
                    {
                        _ = stringBuilder.AppendLine($"                new LetPortal.Portal.Entities.SectionParts.Controls.PageControlValidator");
                        _ = stringBuilder.AppendLine($"                {{");
                        var validatorType = "LetPortal.Portal.Entities.SectionParts.Controls.ValidatorType." + Enum.GetName(typeof(ValidatorType), validator.ValidatorType);
                        _ = stringBuilder.AppendLine($"                    ValidatorType = {validatorType},");
                        _ = stringBuilder.AppendLine($"                    IsActive = {validator.IsActive.ToString().ToLower()},");
                        _ = stringBuilder.AppendLine($"                    ValidatorMessage = \"{validator.ValidatorMessage}\",");
                        _ = stringBuilder.AppendLine($"                    ValidatorOption = \"{validator.ValidatorOption}\",");
                        _ = stringBuilder.AppendLine($"                }},");
                    }
                    _ = stringBuilder.AppendLine($"            }},");

                    // Control Async Validators
                    if (control.AsyncValidators != null && control.AsyncValidators.Any())
                    {
                        _ = stringBuilder.AppendLine($"            AsyncValidators = new List<LetPortal.Portal.Entities.Components.Controls.PageControlAsyncValidator>");
                        _ = stringBuilder.AppendLine($"            {{");
                        foreach (var validator in control.AsyncValidators)
                        {
                            _ = stringBuilder.AppendLine($"                new LetPortal.Portal.Entities.Components.Controls.PageControlAsyncValidator");
                            _ = stringBuilder.AppendLine($"                {{");
                            _ = stringBuilder.AppendLine($"                    ValidatorName = \"{validator.ValidatorName}\",");
                            _ = stringBuilder.AppendLine($"                    IsActive = {validator.IsActive.ToString().ToLower()},");
                            _ = stringBuilder.AppendLine($"                    ValidatorMessage = \"{validator.ValidatorMessage}\",");
                            _ = stringBuilder.AppendLine($"                    AsyncValidatorOptions = new LetPortal.Portal.Entities.Components.Controls.ControlAsyncValidatorOptions");
                            _ = stringBuilder.AppendLine($"                    {{");
                            _ = stringBuilder.AppendLine($"                        EvaluatedExpression = \"{validator.AsyncValidatorOptions.EvaluatedExpression}\",");
                            if (validator.AsyncValidatorOptions.ValidatorType == Components.Controls.AsyncValidatorType.DatabaseValidator)
                            {
                                _ = stringBuilder.AppendLine(validator.AsyncValidatorOptions.DatabaseOptions.GenerateCode(space: 6).InsertingCode);
                                _ = stringBuilder.AppendLine($"                        ValidatorType = LetPortal.Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator,");
                            }
                            else if (validator.AsyncValidatorOptions.ValidatorType == Components.Controls.AsyncValidatorType.HttpValidator)
                            {
                                _ = stringBuilder.AppendLine(validator.AsyncValidatorOptions.HttpServiceOptions.GenerateCode(space: 6).InsertingCode);
                                _ = stringBuilder.AppendLine($"                        ValidatorType = LetPortal.Portal.Entities.Components.Controls.AsyncValidatorType.HttpValidator,");
                            }
                            _ = stringBuilder.AppendLine($"                    }}");
                            _ = stringBuilder.AppendLine($"                }},");
                        }
                        _ = stringBuilder.AppendLine($"            }},");
                    }

                    // Control Event
                    if (control.PageControlEvents != null && control.PageControlEvents.Any())
                    {
                        _ = stringBuilder.AppendLine($"            PageControlEvents = new List<LetPortal.Portal.Entities.Components.Controls.PageControlEvent>");
                        _ = stringBuilder.AppendLine($"            {{");
                        foreach (var controlEvent in control.PageControlEvents)
                        {
                            _ = stringBuilder.AppendLine(controlEvent.GenerateCode().InsertingCode, 3);
                        }
                        _ = stringBuilder.AppendLine($"            }},");
                    }
                    if (control != Controls.Last())
                    {
                        _ = stringBuilder.AppendLine($"        }},");
                    }
                    else
                    {
                        _ = stringBuilder.AppendLine($"        }}");
                    }
                }

                _ = stringBuilder.AppendLine($"    }},");
            }
            _ = stringBuilder.AppendLine($"}};");
            _ = stringBuilder.AppendLine($"versionContext.InsertData({varName});");
            codeResult.InsertingCode = stringBuilder.ToString();

            return(codeResult);
        }
コード例 #16
0
ファイル: Page.cs プロジェクト: weedkiller/let.portal
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult
            {
                DeletingCode = $"versionContext.DeleteData<LetPortal.Portal.Entities.Pages.Page>(\"{Id}\");"
            };
            var stringBuilder = new StringBuilder();

            varName ??= Name.Replace("-", "", System.StringComparison.OrdinalIgnoreCase) + "Page";
            _ = stringBuilder.AppendLine($"var {varName} = new LetPortal.Portal.Entities.Pages.Page");
            _ = stringBuilder.AppendLine($"{{");
            _ = stringBuilder.AppendLine($"    Id = \"{Id}\",");
            _ = stringBuilder.AppendLine($"    Name = \"{Name}\",");
            _ = stringBuilder.AppendLine($"    DisplayName = \"{DisplayName}\",");
            _ = stringBuilder.AppendLine($"    AppId = \"{AppId}\",");
            _ = stringBuilder.AppendLine($"    UrlPath = \"{UrlPath}\",");
            if (ShellOptions != null && ShellOptions.Any())
            {
                _ = stringBuilder.AppendLine($"    ShellOptions = new System.Collections.Generic.List<LetPortal.Portal.Entities.Pages.ShellOption>");
                _ = stringBuilder.AppendLine($"    {{");
                foreach (var option in ShellOptions)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Pages.ShellOption");
                    _ = stringBuilder.AppendLine($"        {{");
                    _ = stringBuilder.AppendLine($"            Key = \"{option.Key}\",");
                    _ = stringBuilder.AppendLine($"            Value = \"{option.Value}\",");
                    _ = stringBuilder.AppendLine($"            Description = \"{option.Description}\"");
                    _ = stringBuilder.AppendLine($"        }},");
                }
                _ = stringBuilder.AppendLine($"    }},");
            }
            if (Claims != null && Claims.Any())
            {
                _ = stringBuilder.AppendLine($"    Claims = new System.Collections.Generic.List<LetPortal.Core.Security.PortalClaim>");
                _ = stringBuilder.AppendLine($"    {{");
                foreach (var claim in Claims)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Core.Security.PortalClaim");
                    _ = stringBuilder.AppendLine($"        {{");
                    _ = stringBuilder.AppendLine($"            Name = \"{claim.Name}\",");
                    _ = stringBuilder.AppendLine($"            DisplayName = \"{claim.DisplayName}\",");
                    var claimType = "LetPortal.Core.Security.ClaimValueType." + Enum.GetName(typeof(ClaimValueType), claim.ClaimValueType);
                    _ = stringBuilder.AppendLine($"            ClaimValueType = {claimType}");
                    _ = stringBuilder.AppendLine($"        }},");
                }
                _ = stringBuilder.AppendLine($"    }},");
            }
            if (Builder != null)
            {
                _ = stringBuilder.AppendLine(Builder.GenerateCode().InsertingCode);
            }

            if (PageDatasources != null && PageDatasources.Any())
            {
                _ = stringBuilder.AppendLine($"    PageDatasources = new System.Collections.Generic.List<LetPortal.Portal.Entities.Pages.PageDatasource>");
                _ = stringBuilder.AppendLine($"    {{");
                foreach (var pageDatasource in PageDatasources)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Pages.PageDatasource");
                    _ = stringBuilder.AppendLine($"        {{");
                    _ = stringBuilder.AppendLine($"           Id = \"{pageDatasource.Id}\",");
                    _ = stringBuilder.AppendLine($"           Name = \"{pageDatasource.Name}\",");
                    _ = stringBuilder.AppendLine($"           TriggerCondition = \"{pageDatasource.TriggerCondition}\",");
                    _ = stringBuilder.AppendLine($"           IsActive = {pageDatasource.IsActive.ToString().ToLower()},");
                    _ = stringBuilder.AppendLine(pageDatasource.Options.GenerateCode("Options", space = 2).InsertingCode);
                    _ = stringBuilder.AppendLine($"        }},");
                }
                _ = stringBuilder.AppendLine($"    }},");
            }

            if (Commands != null && Commands.Any())
            {
                _ = stringBuilder.AppendLine($"    Commands = new System.Collections.Generic.List<LetPortal.Portal.Entities.Pages.PageButton>");
                _ = stringBuilder.AppendLine($"    {{");
                foreach (var command in Commands)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Pages.PageButton");
                    _ = stringBuilder.AppendLine($"        {{");
                    _ = stringBuilder.AppendLine($"            Id = \"{command.Id}\",");
                    _ = stringBuilder.AppendLine($"            Name = \"{command.Name}\",");
                    _ = stringBuilder.AppendLine($"            Icon = \"{command.Icon}\",");
                    _ = stringBuilder.AppendLine($"            Color = \"{command.Color}\",");
                    _ = stringBuilder.AppendLine($"            AllowHidden = \"{command.AllowHidden}\",");
                    _ = stringBuilder.AppendLine($"            PlaceSectionId = \"{command.PlaceSectionId}\",");
                    _ = stringBuilder.AppendLine($"            IsRequiredValidation = {command.IsRequiredValidation.ToString().ToLower()},");
                    _ = stringBuilder.AppendLine(command.ButtonOptions.GenerateCode(space: 3).InsertingCode);
                    _ = stringBuilder.AppendLine($"        }},");
                }
                _ = stringBuilder.AppendLine($"    }},");
            }
            _ = stringBuilder.AppendLine($"}};");
            _ = stringBuilder.AppendLine($"versionContext.InsertData({varName});");
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #17
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult
            {
                DeletingCode = $"versionContext.DeleteData<LetPortal.Portal.Entities.Components.Chart>(\"{Id}\");"
            };

            varName ??= Name.Replace("-", "", System.StringComparison.OrdinalIgnoreCase) + "Chart";
            var stringBuilder = new StringBuilder();

            _ = stringBuilder.AppendLine($"var {varName} = new LetPortal.Portal.Entities.Components.Chart");
            _ = stringBuilder.AppendLine($"{{");
            _ = stringBuilder.AppendLine($"    Id = \"{Id}\",");
            _ = stringBuilder.AppendLine($"    Name = \"{Name}\",");
            _ = stringBuilder.AppendLine($"    AppId = \"{AppId}\",");
            _ = stringBuilder.AppendLine($"    DisplayName = \"{DisplayName}\",");
            var layoutType = "LetPortal.Portal.Entities.SectionParts.PageSectionLayoutType." + Enum.GetName(typeof(PageSectionLayoutType), LayoutType);

            _ = stringBuilder.AppendLine($"    LayoutType = {layoutType},");
            _ = stringBuilder.AppendLine(DatabaseOptions.GenerateCode(space: 1).InsertingCode);
            _ = stringBuilder.AppendLine($"    TimeSpan = {TimeSpan},");
            if (Definitions != null)
            {
                _ = stringBuilder.AppendLine($"    Definitions = new LetPortal.Portal.Entities.Components.ChartDefinitions");
                _ = stringBuilder.AppendLine($"    {{");
                _ = stringBuilder.AppendLine($"        ChartTitle = \"{Definitions.ChartTitle}\",");
                var chartType = "ChartType." + Enum.GetName(typeof(ChartType), Definitions.ChartType);
                _ = stringBuilder.AppendLine($"        ChartType = {chartType},");
                _ = stringBuilder.AppendLine($"        MappingProjection = \"{Definitions.MappingProjection}\",");
                _ = stringBuilder.AppendLine($"    }},");
            }

            if (Options != null && Options.Any())
            {
                _ = stringBuilder.AppendLine($"    Options = new System.Collections.Generic.List<LetPortal.Portal.Entities.Pages.ShellOption>");
                _ = stringBuilder.AppendLine($"    {{");
                foreach (var option in Options)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Pages.ShellOption");
                    _ = stringBuilder.AppendLine($"        {{");
                    _ = stringBuilder.AppendLine($"            Key = \"{option.Key}\",");
                    _ = stringBuilder.AppendLine($"            Value = \"{option.Value}\",");
                    _ = stringBuilder.AppendLine($"            Description = \"{option.Description}\"");
                    if (option != Options.Last())
                    {
                        _ = stringBuilder.AppendLine($"        }},");
                    }
                    else
                    {
                        _ = stringBuilder.AppendLine($"        }}");
                    }
                }
                _ = stringBuilder.AppendLine($"    }},");
            }
            if (ChartFilters != null && ChartFilters.Any())
            {
                _ = stringBuilder.AppendLine($"    ChartFilters = new System.Collections.Generic.List<LetPortal.Portal.Entities.Components.ChartFilter>");
                _ = stringBuilder.AppendLine($"    {{");
                foreach (var filter in ChartFilters)
                {
                    _ = stringBuilder.AppendLine($"        new LetPortal.Portal.Entities.Components.ChartFilter");
                    _ = stringBuilder.AppendLine($"        {{");
                    _ = stringBuilder.AppendLine($"            Name = \"{filter.Name}\",");
                    _ = stringBuilder.AppendLine($"            DisplayName = \"{filter.DisplayName}\",");
                    _ = stringBuilder.AppendLine($"            IsMultiple = {filter.IsMultiple.ToString().ToLower()},");
                    var chartFilterType = "LetPortal.Portal.Entities.Components.FilterType." + Enum.GetName(typeof(FilterType), filter.Type);
                    _ = stringBuilder.AppendLine($"            Type = {chartFilterType}");

                    if (filter != ChartFilters.Last())
                    {
                        _ = stringBuilder.AppendLine($"        }},");
                    }
                    else
                    {
                        _ = stringBuilder.AppendLine($"        }}");
                    }
                }
                _ = stringBuilder.AppendLine($"    }}");
            }
            _ = stringBuilder.AppendLine($"}};");
            _ = stringBuilder.AppendLine($"versionContext.InsertData({varName});");
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }
コード例 #18
0
        public CodeGenerableResult GenerateCode(string varName = null, int space = 0)
        {
            var codeResult = new CodeGenerableResult();

            var stringBuilder = new StringBuilder();

            varName = varName != null ? varName : "ActionCommandOptions";
            _       = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.ActionCommandOptions", space);
            _       = stringBuilder.AppendLine($"{{", space);
            var actionType = "LetPortal.Portal.Entities.Shared.ActionType." + Enum.GetName(typeof(ActionType), ActionType);

            _ = stringBuilder.AppendLine($"    ActionType = {actionType},", space);
            _ = stringBuilder.AppendLine($"    IsEnable = {IsEnable.ToString().ToLower()},", space);
            if (IsEnable)
            {
                //if(MapDataOptions != null)
                //{
                //    _ = stringBuilder.AppendLine(MapDataOptions.GenerateCode("MapDataOptions", space + 4).InsertingCode, space);
                //}
                if (ConfirmationOptions != null)
                {
                    _ = stringBuilder.AppendLine($"    ConfirmationOptions = new LetPortal.Portal.Entities.Shared.ConfirmationOptions", space);
                    _ = stringBuilder.AppendLine($"    {{", space);
                    _ = stringBuilder.AppendLine($"        IsEnable = {ConfirmationOptions.IsEnable.ToString().ToLower()},", space);
                    _ = stringBuilder.AppendLine($"        ConfirmationText = \"{ConfirmationOptions.ConfirmationText}\",", space);
                    _ = stringBuilder.AppendLine($"    }},", space);
                }
                if (NotificationOptions != null)
                {
                    _ = stringBuilder.AppendLine($"    NotificationOptions = new LetPortal.Portal.Entities.Shared.NotificationOptions", space);
                    _ = stringBuilder.AppendLine($"    {{", space);
                    _ = stringBuilder.AppendLine($"        CompleteMessage = \"{NotificationOptions.CompleteMessage}\",", space);
                    _ = stringBuilder.AppendLine($"        FailedMessage = \"{NotificationOptions.FailedMessage}\",", space);
                    _ = stringBuilder.AppendLine($"    }},", space);
                }
                switch (ActionType)
                {
                case ActionType.Redirect:
                    _ = stringBuilder.AppendLine($"    RedirectOptions = new LetPortal.Portal.Entities.Shared.RedirectOptions", space);
                    _ = stringBuilder.AppendLine($"    {{", space);
                    _ = stringBuilder.AppendLine($"        IsSameDomain = {RedirectOptions.IsSameDomain.ToString().ToLower()},", space);
                    _ = stringBuilder.AppendLine($"        RedirectUrl = \"{RedirectOptions.RedirectUrl}\"", space);
                    _ = stringBuilder.AppendLine($"    }},", space);
                    break;

                case ActionType.ExecuteDatabase:
                    _ = stringBuilder.AppendLine($"    DbExecutionChains = new LetPortal.Portal.Entities.Shared.DatabaseExecutionChains", space);
                    _ = stringBuilder.AppendLine($"    {{", space);
                    _ = stringBuilder.AppendLine($"        Steps = new List<LetPortal.Portal.Entities.Shared.DatabaseExecutionStep>", space);
                    _ = stringBuilder.AppendLine($"        {{", space);
                    foreach (var step in DbExecutionChains.Steps)
                    {
                        _ = stringBuilder.AppendLine($"            new LetPortal.Portal.Entities.Shared.DatabaseExecutionStep", space);
                        _ = stringBuilder.AppendLine($"            {{", space);
                        _ = stringBuilder.AppendLine($"                DatabaseConnectionId = \"{step.DatabaseConnectionId}\",", space);
                        _ = stringBuilder.AppendLine($"                ExecuteCommand = {StringUtil.ToLiteral(step.ExecuteCommand)},", space);
                        _ = stringBuilder.AppendLine($"                DataLoopKey = \"{step.DataLoopKey}\",", space);
                        if (step != DbExecutionChains.Steps.Last())
                        {
                            _ = stringBuilder.AppendLine($"            }},", space);
                        }
                        else
                        {
                            _ = stringBuilder.AppendLine($"            }}", space);
                        }
                    }
                    _ = stringBuilder.AppendLine($"       }}", space);
                    _ = stringBuilder.AppendLine($"    }},", space);
                    break;

                case ActionType.CallHttpService:
                    _ = stringBuilder.AppendLine(HttpServiceOptions.GenerateCode(space: space + 1).InsertingCode);
                    break;

                case ActionType.CallWorkflow:
                    // TODO: We will implement this later
                    break;
                }
            }
            _ = stringBuilder.AppendLine($"}},", space);
            codeResult.InsertingCode = stringBuilder.ToString();
            return(codeResult);
        }