/// <summary>
    /// Processes action
    /// </summary>
    /// <param name="parameters">Parameter</param>
    private void ProcessAction(Tuple <string, TranslationSubmissionInfo> parameters)
    {
        if (parameters == null || parameters.Item1 == null)
        {
            return;
        }

        var commandName    = parameters.Item1.ToLowerInvariant();
        var submissionInfo = parameters.Item2;
        var error          = String.Empty;

        switch (commandName)
        {
        case RESUBMIT_ACTION:
            error = TranslationServiceHelper.ResubmitSubmission(submissionInfo);
            break;

        case PROCESS_ACTION:
            error = TranslationServiceHelper.ProcessSubmission(submissionInfo);
            break;
        }

        // Set result of the action
        ctlAsync.Parameter = GetParameter(commandName, error, submissionInfo);
    }
예제 #2
0
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        string err  = null;
        string info = null;

        // Check modify permission for all actions except for download ZIP
        if (!actionName.EqualsCSafe("downloadzip", true))
        {
            if (!modifyAllowed)
            {
                RedirectToAccessDenied("CMS.TranslationServices", "Modify");
            }
        }

        TranslationSubmissionInfo submissionInfo = TranslationSubmissionInfoProvider.GetTranslationSubmissionInfo(ValidationHelper.GetInteger(actionArgument, 0));

        if (submissionInfo != null)
        {
            switch (actionName.ToLowerCSafe())
            {
            case "downloadzip":
                TranslationServiceHelper.DownloadXLIFFinZIP(submissionInfo, Page.Response);
                break;

            case "resubmit":
                err  = TranslationServiceHelper.ResubmitSubmission(submissionInfo);
                info = GetString("translationservice.translationresubmitted");
                break;

            case "process":
                err  = TranslationServiceHelper.ProcessSubmission(submissionInfo);
                info = GetString("translationservice.translationsimported");
                break;

            case "cancel":
                err  = TranslationServiceHelper.CancelSubmission(submissionInfo);
                info = GetString("translationservice.submissioncanceled");
                break;

            case "delete":
                TranslationServiceHelper.CancelSubmission(submissionInfo);
                submissionInfo.Delete();
                info = GetString("translationservice.submissiondeleted");
                break;
            }
            if (!string.IsNullOrEmpty(err))
            {
                ShowError(err);
            }
            else if (!string.IsNullOrEmpty(info))
            {
                ShowConfirmation(info);
            }
        }
    }
예제 #3
0
    protected void btnImportTranslations_Click(object sender, EventArgs e)
    {
        string err = TranslationServiceHelper.ProcessSubmission(SubmissionInfo);

        if (string.IsNullOrEmpty(err))
        {
            ShowInformation(GetString("translationservice.translationsimported"));
        }
        else
        {
            ShowError(err);
        }
        editElem.UIFormControl.ReloadData();
    }