Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryUI(Page);
        ScriptHelper.RegisterScriptFile(Page, "jquery/jquery-a-tools.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/BBCodeParser.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatMessageSend_files/ChatMessageSend.js");

        imgInformationDialog.ImageUrl = GetImageUrl("General/Labels/Information.png");

        RoomID = ChatUIHelper.GetRoomIdFromQuery(RoomID, GroupID);

        // Register startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatMessageSend_" + ClientID, BuildStartupScript(), true);

        // Set link to documentation and tooltip for canned responses
        lnkCannedRespHelp.NavigateUrl = DocumentationHelper.GetDocumentationTopicUrl(CANNED_RESPONSES_HELP_TOPIC);
        lnkCannedRespHelp.ToolTip     = ResHelper.GetString("chat.cannedresponses.helplabel");
    }
        /// <summary>
        /// Asserts the exported types with missing comments.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="excludeTypes">The exclude types.</param>
        public static void AssertExportedTypesWithMissingComments(
            Assembly assembly,
            List <Type>?excludeTypes = null)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            // Due to some build issue with GenerateDocumentationFile=true and xml-file location, this hack is made for now.
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                return;
            }

            var typesWithMissingCommentsGroups = DocumentationHelper.CollectExportedTypesWithMissingCommentsFromAssembly(
                assembly,
                excludeTypes)
                                                 .OrderBy(x => x.Type.FullName)
                                                 .GroupBy(x => x.Type.BeautifyName(true), StringComparer.Ordinal)
                                                 .ToArray();

            var testResults = new List <TestResult>
            {
                new TestResult($"Assembly: {assembly.GetName()}"),
            };

            testResults.AddRange(typesWithMissingCommentsGroups.Select(item => new TestResult(false, 1, $"Type: {item.Key}")));

            TestResultHelper.AssertOnTestResults(testResults);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        product = SKUInfoProvider.GetSKUInfo(ProductID);

        // Setup help
        object options = new
        {
            helpName = "lnkProductEditHelp",
            helpUrl  = DocumentationHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK)
        };

        ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options);

        EditedObject = product;

        if (product != null)
        {
            // Check site id
            CheckEditedObjectSiteID(product.SKUSiteID);

            // Load product currency
            productCurrency = CurrencyInfoProvider.GetMainCurrency(product.SKUSiteID);

            // Display product price
            headProductPriceInfo.Text = string.Format(GetString("com_sku_volume_discount.skupricelabel"), CurrencyInfoProvider.GetFormattedPrice(product.SKUPrice, productCurrency));
        }

        // Set unigrid properties
        SetUnigridProperties();

        // Initialize the master page elements
        InitializeMasterPage();
    }
Beispiel #4
0
        /// <summary>
        /// Asserts the exported types with missing comments.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="excludeTypes">The exclude types.</param>
        public static void AssertExportedTypesWithMissingComments(
            Assembly assembly,
            List <Type>?excludeTypes = null)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            var typesWithMissingCommentsGroups = DocumentationHelper.CollectExportedTypesWithMissingCommentsFromAssembly(
                assembly,
                excludeTypes)
                                                 .OrderBy(x => x.Type.FullName)
                                                 .GroupBy(x => x.Type.BeautifyName(true))
                                                 .ToArray();

            var testResults = new List <TestResult>
            {
                new TestResult($"Assembly: {assembly.GetName()}"),
            };

            testResults.AddRange(typesWithMissingCommentsGroups.Select(item => new TestResult(false, 1, $"Type: {item.Key}")));

            TestResultHelper.AssertOnTestResults(testResults);
        }
Beispiel #5
0
    public ReportingManager(IWebHostEnvironment webHostEnvironment)
    {
        this._webHostEnvironment = webHostEnvironment;

        var filePath = Path.Combine(webHostEnvironment.WebRootPath, "Source/TimeLog.TLP.WebAppCode.xml");

        _helper = new DocumentationHelper(filePath);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var documentationLink = DocumentationHelper.GetDocumentationTopicUrl(CONVERSIONS_LOGGING_LINK);

        tipConversionsListing.CollapsedStateIdentifier = SMART_TIP_IDENTIFIER;
        tipConversionsListing.Content        = string.Format(GetString("conversions.listingsmarttip"), documentationLink);
        tipConversionsListing.ExpandedHeader = GetString("conversions.listingsmarttip.header");
    }
Beispiel #7
0
        public string Serialize(Contract contract, string template, List <Contract> contracts)
        {
            string contractName = contract.ContractName;

            var contractNode = NodeHelper.GetContractNode(contract);

            string documentation = contractNode.Documentation;
            string contractTitle = DocumentationHelper.Get(documentation, "title");
            string notice        = DocumentationHelper.GetNotice(documentation);
            var    anchors       = contracts.Select(item => $"- [{item.ContractName}]({item.ContractName}.md)").ToList();


            var dependencies    = NodeHelper.GetBaseContracts(contract) ?? new List <Node>();
            var implementations = NodeHelper.GetImplementations(contract, contracts) ?? new List <Contract>();

            var dependencyList     = dependencies.Select(dependency => $"[{dependency.BaseName.Name}]({dependency.BaseName.Name}.md)").ToList();
            var implementationList = implementations.Select(implementation => $"[{implementation.ContractName}]({implementation.ContractName}.md)").ToList();


            string title = $"{contract.ContractName}.sol";

            if (!string.IsNullOrWhiteSpace(contractTitle))
            {
                title = $"{Regex.Replace(contractTitle, @"\r\n?|\n", " ")} ({contract.ContractName}.sol)";
            }


            string contractInheritancePath = string.Empty;
            string contractImplementations = string.Empty;

            if (dependencyList.Any())
            {
                contractInheritancePath = $"**{string.Format(I18N.Extends, string.Join(", ", dependencyList))}**";
            }

            if (implementationList.Any())
            {
                contractImplementations = string.Join("", "**", string.Format(I18N.DerivedContracts, string.Join(", ", implementationList)), "**.");
            }

            template = template.Replace("{{ContractName}}", contractName);
            template = template.Replace("{{ContractTitle}}", title);
            template = template.Replace("{{ContractDescription}}", notice);
            template = template.Replace("{{ContractInheritancePath}}", contractInheritancePath);
            template = template.Replace("{{ContractImplementations}}", contractImplementations);


            template = template.Replace("{{AllContractsAnchor}}", string.Join(Environment.NewLine, anchors));
            template = template.Replace("{{ABI}}", JsonConvert.SerializeObject(contract.Abi, Formatting.Indented));

            var builder = new ConstructorBuilder(contract);

            return(builder.Build(template));
        }
Beispiel #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Setup help
        object options = new
        {
            helpName = "lnkProductEditHelp",
            helpUrl  = DocumentationHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK)
        };

        ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options);

        // Check UI personalization for product / product option separately
        if (OptionCategoryID > 0)
        {
            // Check elements in product options categories subtree
            CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "ProductOptions.Options.TaxClasses");
        }
        else
        {
            CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Products.TaxClasses");
        }

        if (ProductID > 0)
        {
            sku          = SKUInfoProvider.GetSKUInfo(ProductID);
            EditedObject = sku;

            if (sku != null)
            {
                // Check products site id
                CheckEditedObjectSiteID(sku.SKUSiteID);

                taxForm.ProductID = ProductID;
                taxForm.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;

                if (sku.IsProductOption)
                {
                    var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(sku.SKUOptionCategoryID);
                    if (categoryInfo != null)
                    {
                        CreateBreadcrumbs(sku);

                        if (categoryInfo.CategoryType != OptionCategoryTypeEnum.Products)
                        {
                            ShowError(GetString("com.taxesNotSupportedForOptionType"));
                            taxForm.Visible = false;
                        }
                    }
                }
            }
        }
    }
        /// <summary>
        /// Asserts the exported type with missing comments.
        /// </summary>
        /// <param name="type">The type.</param>
        public static void AssertExportedTypeWithMissingComments(Type type)
        {
            var typeComments = DocumentationHelper.CollectExportedTypeWithCommentsFromType(type);

            var testResults = new List <TestResult>();

            if (typeComments != null && !typeComments.HasComments)
            {
                testResults.Add(new TestResult(true, 0, $"Type: {typeComments.Type.BeautifyTypeName(true)}"));
            }

            TestResultHelper.AssertOnTestResults(testResults);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Product != null)
        {
            CheckEditedObjectSiteID(Product.SKUSiteID);
        }

        if (!RequestHelper.IsPostBack())
        {
            // Show confirmation message after generation of variants on generation page was successful
            if (QueryHelper.GetBoolean("saved", false))
            {
                ShowConfirmation(GetString("com.variants.generated"));
            }
        }

        // Setup help
        object options = new
        {
            helpName = "lnkProductEditHelp",
            helpUrl  = DocumentationHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK)
        };

        ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options);

        // Setup asynchronous control
        SetupControl();

        // Init action selection
        InitBulkActionDropdownLists();

        string warningMessage = VariantsCanBeGenerated();

        if (string.IsNullOrEmpty(warningMessage))
        {
            string url = "~/CMSModules/Ecommerce/Pages/Tools/Products/Variant_New.aspx";
            url = URLHelper.AddParameterToUrl(url, "ProductID", ProductID.ToString());
            url = URLHelper.AddParameterToUrl(url, "dialog", QueryHelper.GetString("dialog", "0"));

            // Allow user to generate variants
            CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction
            {
                Text        = GetString("com.products.newvariant"),
                RedirectUrl = ResolveUrl(url)
            });
        }
        else
        {
            ShowWarning(warningMessage);
        }
    }
Beispiel #11
0
        public string Build(string template)
        {
            var    node          = NodeHelper.GetConstructorNode(this.Contract);
            string documentation = node.Documentation;
            string description   = DocumentationHelper.GetNotice(documentation);

            var parameters = new List <string>();

            var argBuilder = new StringBuilder();
            var code       = new StringBuilder();

            var arguments = node.Modifiers?.FirstOrDefault()?.Arguments;


            code.Append("```js");
            code.Append(Environment.NewLine);
            code.Append("constructor(");

            if (arguments == null)
            {
                return(Clean(template));
            }

            foreach (var argument in arguments)
            {
                string argumentName          = argument.Name;
                string dataType              = argument.TypeDescriptions.TypeString.Replace("contract ", "");
                string argumentDocumentation = DocumentationHelper.Get(documentation, "param " + argumentName);

                parameters.Add(dataType + " " + argumentName);

                argBuilder.Append($"| {argumentName} | {dataType} | {Regex.Replace(argumentDocumentation, @"\r\n?|\n", " ")} | {Environment.NewLine}");
            }

            code.Append(string.Join(", ", parameters));

            code.Append(") ");

            code.Append(node.Visibility.ToString().ToLower());
            code.Append(Environment.NewLine);
            code.Append("```");

            template = template.Replace("{{ConstructorHeading}}", $"## {I18N.Constructor}");
            template = template.Replace("{{ConstructorDescription}}", description);
            template = template.Replace("{{ConstructorCode}}", code.ToString());
            template = template.Replace("{{ConstructorArguments}}", argBuilder.ToString());
            template = template.Replace("{{ConstructorArgumentsHeading}}", $"**{I18N.Arguments}**");
            template = template.Replace("{{TableHeader}}", TemplateHelper.TableHeader);

            return(template);
        }
    /// <summary>
    /// Page load event handling.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        InitializeVersion();

        ScriptHelper.RegisterModule(Page, "CMS/ContextHelp", new
        {
            wrapperId             = ClientID,
            toolbarId             = pnlToolbar.ClientID,
            helpTopicsMenuItemId  = helpTopics.ClientID,
            searchMenuItemId      = search.ClientID,
            searchUrlPattern      = DocumentationHelper.GetDocumentationSearchUrlPattern(),
            descriptionMenuItemId = description.ClientID
        });
    }
Beispiel #13
0
        /// <summary>Analyzes a <see cref="SyntaxNode" />.</summary>
        /// <param name="context">The context for the syntax node analysis.</param>
        /// <param name="identifiers">Diagnostics will be reported for all provided identifiers, if the syntax node does not has a documentation header.</param>
        private void Analyze(SyntaxNodeAnalysisContext context, IEnumerable <SyntaxToken> identifiers)
        {
            Diagnostic diagnostic;

            if (!DocumentationHelper.HasDocumentationHeader(context.Node))
            {
                foreach (SyntaxToken identifier in identifiers)
                {
                    diagnostic = this.CreateDiagnostic(identifier.GetLocation(), identifier);

                    context.ReportDiagnostic(diagnostic);
                }
            }
        }
Beispiel #14
0
    private object PreparePromotingCampaignsSmartTip()
    {
        var documentationLink = DocumentationHelper.GetDocumentationTopicUrl(HELP_TOPIC_TRACKING_CAMPAIGNS_LINK);
        var smartTipContent   = String.Format(GetString("campaigns.promotionsmarttip"), documentationLink);

        return(new
        {
            Identifier = SMART_TIP_PROMOTION_IDENTIFIER,
            Content = smartTipContent,
            ExpandedHeader = GetString("campaigns.promotionsmarttip.header"),
            CollapsedHeader = GetString("campaigns.promotionsmarttip.header"),
            IsCollapsed = mSmartTipManager.IsSmartTipDismissed(SMART_TIP_PROMOTION_IDENTIFIER)
        });
    }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Setup help
        object options = new
        {
            helpName = "lnkProductEditHelp",
            helpUrl  = DocumentationHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK)
        };

        ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options);

        if (ProductID > 0)
        {
            sku = SKUInfoProvider.GetSKUInfo(ProductID);

            EditedObject = sku;

            if (sku != null)
            {
                // Check site ID
                CheckEditedObjectSiteID(sku.SKUSiteID);

                ucOptions.ProductID = ProductID;

                // Add new category button in HeaderAction
                CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction
                {
                    Text          = GetString("com.productoptions.general.select"),
                    OnClientClick = ucOptions.GetAddCategoryJavaScript(),
                    Enabled       = ECommerceContext.IsUserAuthorizedToModifySKU(sku.IsGlobal)
                });

                // New button is active in editing of global product only if global option categories are allowed and user has GlobalModifyPermission permission
                bool enabledButton = (sku.IsGlobal) ? ECommerceSettings.AllowGlobalProductOptions(CurrentSiteName) && ECommerceContext.IsUserAuthorizedToModifyOptionCategory(true)
                    : ECommerceContext.IsUserAuthorizedToModifyOptionCategory(false);

                // Create new enabled/disabled category button in HeaderAction
                var dialogUrl = UrlResolver.ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_New.aspx?ProductID=" + sku.SKUID + "&dialog=1");
                dialogUrl = ApplicationUrlHelper.AppendDialogHash(dialogUrl);

                CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction
                {
                    Text          = GetString("com.productoptions.new"),
                    Enabled       = enabledButton,
                    ButtonStyle   = ButtonStyle.Default,
                    OnClientClick = "modalDialog('" + dialogUrl + "','NewOptionCategoryDialog', 1000, 800);"
                });
            }
        }
    }
Beispiel #16
0
        public void OpenDocumentationForScene()
        {
            if (Application.isEditor)
            {
                var sceneName = SceneManager.GetActiveScene().name;

                if (sceneName.EndsWith("_cloud") || sceneName.EndsWith("_offline"))
                {
                    sceneName = sceneName.Replace("_cloud", "");
                    sceneName = sceneName.Replace("_offline", "");
                }

                DocumentationHelper.OpenDocumentationInBrowser(string.Format("scene_{0}.html", sceneName));
            }
        }
    /// <summary>
    /// Page_Load event handler.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get original value
        oldClassName   = DocumentType.ClassName;
        oldInheritedID = DocumentType.ClassInheritsFromClassID;
        oldResourceID  = DocumentType.ClassResourceID;

        var link = String.Format("<a target=\"_blank\" href=\"{0}\">{1}</a>", DocumentationHelper.GetDocumentationTopicUrl("routing_overview"), GetString("general.ourdocumentation"));

        tipUrlPattern.Content = string.Format(GetString("documenttype.urlpattern.smarttip.content"), link);
        tipUrlPattern.Visible = DocumentType.ClassHasURL;

        // Bind events
        editElem.OnAfterSave += editElem_OnAfterSave;
    }
        public async Task <IActionResult> ExportEManifest(Guid hblid)
        {
            var accessToken     = Request.Headers["Authorization"].ToString();
            var responseFromApi = await HttpServiceExtension.GetApi(aPis.HostStaging + Urls.Documentation.HouseBillDetailUrl + hblid, accessToken);

            var dataObject = responseFromApi.Content.ReadAsAsync <CsTransactionDetailModel>();
            var stream     = new DocumentationHelper().CreateEManifestExcelFile(dataObject.Result);

            if (stream == null)
            {
                return(null);
            }
            FileContentResult fileContent = new FileHelper().ExportExcel(stream, "E-Manifest.xlsx");

            return(fileContent);
        }
Beispiel #19
0
        public string Serialize(Contract contract, string template, List <Contract> contracts)
        {
            var functionNodes = NodeHelper.GetFunctions(contract).Where(x => !x.IsConstructor.HasValue || !x.IsConstructor.Value).ToList();

            if (!functionNodes.Any())
            {
                return(Clean(template));
            }

            var definitionList = new List <string>();
            var functionList   = functionNodes.Select(node => $"- [{node.Name}](#{node.Name.ToLower()})").ToList();


            template = template.Replace("{{FunctionTitle}}", $"## {I18N.Functions}");

            foreach (var node in functionNodes)
            {
                string functionTemplate = TemplateHelper.Function;
                string documentation    = node.Documentation;
                string description      = DocumentationHelper.GetNotice(documentation);
                var    codeBuilder      = new FunctionCodeBuilder(node);
                var    superBuilder     = new SuperBuilder(node, contracts);
                var    referenceBuilder = new FunctionReferenceBuilder(node, contracts);

                functionTemplate = functionTemplate.Replace("{{FunctionName}}", node.Name);
                functionTemplate = functionTemplate.Replace("{{FQFunctionName}}", $"{contract.ContractName}.{node.Name}");
                functionTemplate = functionTemplate.Replace("{{FunctionNameHeading}}", $"### {node.Name}");
                functionTemplate = functionTemplate.Replace("{{Super}}", superBuilder.Build());
                functionTemplate = functionTemplate.Replace("{{References}}", referenceBuilder.Build());
                functionTemplate = functionTemplate.Replace("{{FunctionDescription}}", description);
                functionTemplate = functionTemplate.Replace("{{FunctionCode}}", codeBuilder.Build());

                var parameters      = node.Parameters.Parameters.ToList();
                var argumentBuilder = new ArgumentBuilder(node.Documentation, parameters);

                functionTemplate = functionTemplate.Replace("{{TableHeader}}", parameters.Any() ? TemplateHelper.TableHeader : string.Empty);
                functionTemplate = functionTemplate.Replace("{{FunctionArgumentsHeading}}", parameters.Any() ? $"**{I18N.Arguments}**" : string.Empty);
                functionTemplate = functionTemplate.Replace("{{FunctionArguments}}", argumentBuilder.Build());

                definitionList.Add(functionTemplate);
            }

            template = template.Replace("{{FunctionList}}", string.Join(Environment.NewLine, functionList));
            template = template.Replace("{{AllFunctions}}", string.Join(Environment.NewLine, definitionList));

            return(template);
        }
    /// <summary>
    /// Check whether all macros in macro rule are optimized.
    /// Shows warning when not.
    /// </summary>
    private void CheckMacros()
    {
        var macroCondition = RuleHelper.GetMacroConditionFromRule(Rule);

        if (string.IsNullOrEmpty(macroCondition))
        {
            return;
        }

        var macroTree = CachedMacroRuleTrees.GetParsedTree(macroCondition);

        if ((macroTree == null) || !MacroRuleTreeAnalyzer.CanTreeBeTranslated(macroTree))
        {
            var text = string.Format(ResHelper.GetString("om.macros.macro.slow"), DocumentationHelper.GetDocumentationTopicUrl("om_macro_performance"));
            ShowWarning(text);
        }
    }
Beispiel #21
0
        /// <summary>Calculates the position, the caret should be set to, after the
        /// code fix was applied.</summary>
        /// <param name="changedSolution">The changed solution (code fix applied).</param>
        /// <param name="originalDocument">The original document (code fix not applied).</param>
        /// <param name="diagnostic">The diagnosted code fix.</param>
        /// <param name="cancellationToken">A cancellation token to cancel the calculation.</param>
        /// <returns>The position , the caret should be set to, after the code fix
        /// was applied. Null if the caret should not be moved.</returns>
        private static async Task <NavigationTarget> CalculateNavigationTarget(Solution changedSolution, Document originalDocument, Diagnostic diagnostic, CancellationToken cancellationToken)
        {
            MemberDeclarationSyntax originalDeclaration;
            MemberDeclarationSyntax changedDeclaration;
            SyntaxNode       originalSyntaxRoot;
            SyntaxNode       changedSyntaxRoot;
            Document         changedDocument;
            int              targetPosition;
            NavigationTarget result = null;

            // Get syntax root of the original document
            originalSyntaxRoot = await originalDocument.GetSyntaxRootAsync(cancellationToken)
                                 .ConfigureAwait(false);

            // Get the original declaration that was diagnosted
            originalDeclaration = originalSyntaxRoot.FindToken(diagnostic.Location.SourceSpan.Start)
                                  .Parent
                                  .AncestorsAndSelf()
                                  .OfType <MemberDeclarationSyntax>()
                                  .First();

            // Get the changed document
            changedDocument = changedSolution.GetDocument(originalDocument.Id);

            // Get syntax root of the changed document
            changedSyntaxRoot = await changedDocument.GetSyntaxRootAsync(cancellationToken)
                                .ConfigureAwait(false);

            // Find declaration in changed document
            changedDeclaration = changedSyntaxRoot.DescendantNodes()
                                 .OfType <MemberDeclarationSyntax>()
                                 .FirstOrDefault(newNode => SyntaxFactory.AreEquivalent(newNode, originalDeclaration));

            // Get the target position in the the XML documentation header of the
            // changed declaration inside the changed document
            targetPosition = DocumentationHelper.GetPositionOfFirstEmptyDocumentationTag(changedDeclaration);

            // targetPosition is less than zero if no empty documentation tag was found.
            if (targetPosition > 0)
            {
                result = new NavigationTarget(changedDocument.Id, targetPosition);
            }

            return(result);
        }
Beispiel #22
0
        public string Build()
        {
            var builder = new StringBuilder();

            foreach (var parameter in this.Parameters)
            {
                builder.Append("| ");
                builder.Append(parameter.Name);
                builder.Append(" | ");
                builder.Append(parameter.TypeDescriptions.TypeString.Replace("contract ", ""));
                builder.Append(" | ");
                string doc = DocumentationHelper.Get(this.Documentation, "param " + parameter.Name);
                builder.Append(doc);
                builder.Append(" | ");
                builder.Append(Environment.NewLine);
            }

            return(builder.ToString());
        }
        public async Task <IActionResult> ExportHAWBAirExport(string hblid, string officeId)
        {
            var responseFromApi = await HttpServiceExtension.GetApi(aPis.HostStaging + Urls.Documentation.NeutralHawbExportUrl + "?housebillId=" + hblid + "&officeId=" + officeId);

            var dataObject = responseFromApi.Content.ReadAsAsync <AirwayBillExportResult>();

            if (dataObject.Result == null)
            {
                return(new FileHelper().ExportExcel(new MemoryStream(), ""));
            }

            var stream = new DocumentationHelper().GenerateHAWBAirExportExcel(dataObject.Result);

            if (stream == null)
            {
                return(new FileHelper().ExportExcel(new MemoryStream(), ""));
            }
            FileContentResult fileContent = new FileHelper().ExportExcel(stream, "Air Export - NEUTRAL HAWB.xlsx");

            return(fileContent);
        }
        public async Task <IActionResult> ExportTCSAirExport(string jobId)
        {
            var responseFromApi = await HttpServiceExtension.GetApi(aPis.HostStaging + Urls.Documentation.AirwayBillExportUrl + jobId);

            var dataObject = responseFromApi.Content.ReadAsAsync <AirwayBillExportResult>();

            if (dataObject.Result == null)
            {
                return(new FileHelper().ExportExcel(new MemoryStream(), ""));
            }

            var stream = new DocumentationHelper().GenerateTCSAirExportExcel(dataObject.Result);

            if (stream == null)
            {
                return(new FileHelper().ExportExcel(new MemoryStream(), ""));
            }
            FileContentResult fileContent = new FileHelper().ExportExcel(stream, "Air Export - Phiếu Cân TCS.xlsx");

            return(fileContent);
        }
        public async Task <IActionResult> ExportShipmentOverview(GeneralReportCriteria criteria)
        {
            var responseFromApi = await HttpServiceExtension.GetDataFromApi(criteria, aPis.HostStaging + Urls.Documentation.GetDataShipmentOverviewUrl);

            var dataObjects = responseFromApi.Content.ReadAsAsync <List <ExportShipmentOverview> >();

            if (dataObjects.Result == null)
            {
                return(new FileHelper().ExportExcel(new MemoryStream(), ""));
            }

            var stream = new DocumentationHelper().GenerateShipmentOverviewExcel(dataObjects.Result, criteria, null);

            if (stream == null)
            {
                return(new FileHelper().ExportExcel(new MemoryStream(), ""));
            }
            FileContentResult fileContent = new FileHelper().ExportExcel(stream, "Shipment Overview.xlsx");

            return(fileContent);
        }
    /// <summary>
    /// Handles external data bound.
    /// Renders link to help page and enables/disables grid editing buttons.
    /// </summary>
    private object Control_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        case "helptopiclink":
        {
            string linkUrl = (string)parameter;
            linkUrl = DocumentationHelper.GetDocumentationTopicUrl(linkUrl);

            return(String.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", linkUrl, HTMLHelper.HTMLEncode(linkUrl)));
        }

        case "delete_modify":
        case "move_modify":
            CMSGridActionButton button = (CMSGridActionButton)sender;
            button.Enabled = EditingEnabled;
            break;
        }

        return(parameter);
    }
Beispiel #27
0
        public string Serialize(Contract contract, string template, List <Contract> contracts)
        {
            var modifierNodes = NodeHelper.GetModifiers(contract).ToList();

            if (!modifierNodes.Any())
            {
                return(Clean(template));
            }

            var definitionList = new List <string>();
            var modifierList   = modifierNodes.Select(node => $"- [{node.Name}](#{node.Name.ToLower()})").ToList();


            template = template.Replace("{{ModifierTitle}}", $"## {I18N.Modifiers}");

            foreach (var node in modifierNodes)
            {
                string modifierTemplate = TemplateHelper.Modifier;
                string documentation    = node.Documentation;
                string description      = DocumentationHelper.GetNotice(documentation);

                var argumentBuilder = new ArgumentBuilder(documentation, node.Parameters.Parameters);
                var codeBuilder     = new ModifierCodeBuilder(node);

                modifierTemplate = modifierTemplate.Replace("{{ModifierArgumentsHeading}}", $"**{I18N.Arguments}**");
                modifierTemplate = modifierTemplate.Replace("{{TableHeader}}", TemplateHelper.TableHeader);
                modifierTemplate = modifierTemplate.Replace("{{ModifierNameHeading}}", $"### {node.Name}");
                modifierTemplate = modifierTemplate.Replace("{{ModifierDescription}}", description);
                modifierTemplate = modifierTemplate.Replace("{{ModifierCode}}", codeBuilder.Build());
                modifierTemplate = modifierTemplate.Replace("{{ModifierArguments}}", argumentBuilder.Build());

                definitionList.Add(modifierTemplate);
            }

            template = template.Replace("{{ModifierList}}", string.Join(Environment.NewLine, modifierList));
            template = template.Replace("{{AllModifiers}}", string.Join(Environment.NewLine, definitionList));

            return(template);
        }
Beispiel #28
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Setup help
        object options = new
        {
            helpName = "lnkProductEditHelp",
            helpUrl  = DocumentationHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK)
        };

        ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options);

        if (IsProductOption)
        {
            // Check UI personalization for product option
            CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "ProductOptions.Options.General");
        }
        else
        {
            // Check UI personalization for product
            CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Products.General");
        }
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        iconHelp.Attributes["class"] = IconName + " " + IconCssClass;
        iconHelp.Attributes["title"] = Tooltip;

        if (!String.IsNullOrEmpty(TopicName))
        {
            lnkHelp.NavigateUrl = DocumentationHelper.GetDocumentationTopicUrl(TopicName);
        }

        // Render help name script
        if (!String.IsNullOrEmpty(HelpName))
        {
            object options = new
            {
                helpName   = HelpName,
                helpLinkId = lnkHelp.ClientID,
                helpHidden = String.IsNullOrEmpty(TopicName)
            };
            ScriptHelper.RegisterModule(this, "CMS/DialogContextHelp", options);
        }
    }
    /// <summary>
    /// Tests SharePoint connection using configuration currently filled in the form.
    /// </summary>
    private void TestConnection()
    {
        try
        {
            ISharePointSiteService siteService = SharePointServices.GetService <ISharePointSiteService>(GetConnectionData());

            siteService.GetSiteUrl();

            DisplayConnectionStatus(GetString("sharepoint.testconnection.success"));
        }
        catch (SharePointServiceFactoryNotSupportedException)
        {
            // No service factory for given SharePoint version
            DisplayConnectionStatus(GetString("sharepoint.versionnotsupported"), false);
        }
        catch (SharePointServiceNotSupportedException)
        {
            // No ISiteService implementation for SharePoint version
            DisplayConnectionStatus(GetString("sharepoint.testconnectionnotsupported"), false);
        }
        catch (SharePointConnectionNotSupportedException)
        {
            // The ISiteService implementation rejected connection data
            DisplayConnectionStatus(GetString("sharepoint.invalidconfiguration"), false);
        }
        catch (SharePointCCSDKException ex)
        {
            var message = string.Format(GetString("sharepoint.ccsdk.idcrl.msoidclilerror"), DocumentationHelper.GetDocumentationTopicUrl("sharepoint_online_connecting"));
            DisplayConnectionStatus(message, false, true);
            EventLogProvider.LogException("SharePoint", "TESTCONNECTION", ex);
        }
        catch (WebException ex)
        {
            if (ex.Status == WebExceptionStatus.ProtocolError)
            {
                // Connection established, but response indicates error condition
                if (ex.Message.Contains("401"))
                {
                    // Unauthorized.
                    DisplayConnectionStatus(GetString("sharepoint.protocolerror.unauthorized"), false);
                }
                else if (ex.Message.Contains("404"))
                {
                    // SharePoint instance not found on given URL
                    DisplayConnectionStatus(GetString("sharepoint.protocolerror.notfound"), false);
                }
                else
                {
                    // Some other protocol error
                    DisplayConnectionStatus(GetString("sharepoint.protocolerror"), false);
                }
            }
            else if (ex.Status == WebExceptionStatus.NameResolutionFailure)
            {
                // Given site URL does not have a resolution
                DisplayConnectionStatus(GetString("sharepoint.nameresolutionfailure"), false);
            }
            else
            {
                DisplayConnectionStatus(GetString("sharepoint.unknownerror"), false);
                EventLogProvider.LogException("SharePoint", "TESTCONNECTION", ex);
            }
        }
        catch (Exception ex)
        {
            DisplayConnectionStatus(GetString("sharepoint.unknownerror"), false);
            EventLogProvider.LogException("SharePoint", "TESTCONNECTION", ex);
        }
    }