Esempio n. 1
0
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        CheckModifyPermissions(true);

        switch (e.CommandName)
        {
        case ComponentEvents.SAVE:
            if (!editElem.UIFormControl.SaveData(null))
            {
                ShowError(GetString("translationservice.savesubmissionfailed"));
            }
            break;

        case "resubmit":
            string errResubmit = TranslationServiceHelper.ResubmitSubmission(SubmissionInfo);
            if (string.IsNullOrEmpty(errResubmit))
            {
                ShowInformation(GetString("translationservice.translationresubmitted"));
            }
            else
            {
                ShowError(errResubmit);
            }
            editElem.UIFormControl.ReloadData();
            break;

        case "update":
            if (editElem.UIFormControl.SaveData(null))
            {
                string errUpdate = TranslationServiceHelper.ResubmitSubmission(SubmissionInfo);
                if (string.IsNullOrEmpty(errUpdate))
                {
                    ShowInformation(GetString("translationservice.translationupdatedandresubmitted"));
                }
                else
                {
                    ShowError(errUpdate);
                }
            }
            editElem.UIFormControl.ReloadData();
            break;

        case "cancel":
            string errCancel = TranslationServiceHelper.CancelSubmission(SubmissionInfo);
            if (string.IsNullOrEmpty(errCancel))
            {
                ShowInformation(GetString("translationservice.submissioncanceled"));
            }
            else
            {
                ShowError(errCancel);
            }
            editElem.UIFormControl.ReloadData();
            break;
        }
    }
Esempio n. 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);
            }
        }
    }
Esempio n. 3
0
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // There is already a running thread
        if (IsRunningThread())
        {
            return;
        }

        CheckModifyPermissions(true);

        switch (e.CommandName)
        {
        case ComponentEvents.SAVE:
            if (!editElem.UIFormControl.SaveData(null))
            {
                ShowError(GetString("translationservice.savesubmissionfailed"));
            }
            break;

        case RESUBMIT_ACTION:
            ProcessActionAsync(e.CommandName);
            break;

        case "updateandresubmit":
            if (!editElem.UIFormControl.SaveData(null))
            {
                ShowError(GetString("translationservice.savesubmissionfailed"));
            }
            else
            {
                ProcessActionAsync("resubmit");
            }
            break;

        case "cancel":
            string errCancel = TranslationServiceHelper.CancelSubmission(SubmissionInfo);
            if (string.IsNullOrEmpty(errCancel))
            {
                ShowConfirmation(GetString("translationservice.submissioncanceled"));
            }
            else
            {
                ShowError(errCancel);
            }
            editElem.UIFormControl.ReloadData();
            break;

        case PROCESS_ACTION:
            ProcessActionAsync(e.CommandName);
            break;
        }
    }
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        // There is already a running thread
        if (IsRunningThread())
        {
            return;
        }

        string err  = null;
        string info = null;

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

        // Get submission
        var submissionInfo = TranslationSubmissionInfoProvider.GetTranslationSubmissionInfo(ValidationHelper.GetInteger(actionArgument, 0));

        if (submissionInfo == null)
        {
            return;
        }

        switch (actionName.ToLowerInvariant())
        {
        case "downloadzip":
            TranslationServiceHelper.DownloadXLIFFinZIP(submissionInfo, Page.Response);
            break;

        case RESUBMIT_ACTION:
            ProcessActionAsync(actionName, submissionInfo);
            break;

        case PROCESS_ACTION:
            ProcessActionAsync(actionName, submissionInfo);
            break;

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

        case "delete":
            var serviceInfo = TranslationServiceInfoProvider.GetTranslationServiceInfo(submissionInfo.SubmissionServiceID);
            if (serviceInfo.TranslationServiceSupportsCancel)
            {
                err = TranslationServiceHelper.CancelSubmission(submissionInfo);
            }

            if (String.IsNullOrEmpty(err))
            {
                submissionInfo.Delete();
            }
            info = GetString("translationservice.submissiondeleted");
            break;
        }

        if (!string.IsNullOrEmpty(err))
        {
            ShowError(err);
        }
        else if (!string.IsNullOrEmpty(info))
        {
            ShowConfirmation(info);
        }
    }