public void GenerateDefaultTransformation(DefaultTransformationTypeEnum transformCode)
    {
        if (String.IsNullOrEmpty(ClassName))
        {
            ClassName = DataClassInfoProvider.GetClassName(ClassID);
        }

        // Gets Xml schema of the document type
        DataClassInfo dci     = DataClassInfoProvider.GetDataClassInfo(ClassName);
        string        formDef = string.Empty;

        if (dci != null)
        {
            formDef = dci.ClassFormDefinition;
        }

        // Gets transformation type
        TransformationTypeEnum transformType = TransformationInfoProvider.GetTransformationTypeEnum(drpType.SelectedValue);

        // Writes the result to the text box
        if (transformType == TransformationTypeEnum.Html)
        {
            txtCode.Visible         = false;
            tbWysiwyg.Visible       = true;
            tbWysiwyg.ResolvedValue = TransformationInfoProvider.GenerateTransformationCode(formDef, transformType, ClassName, transformCode);
        }
        else
        {
            tbWysiwyg.Visible = false;
            txtCode.Visible   = true;
            txtCode.Text      = TransformationInfoProvider.GenerateTransformationCode(formDef, transformType, ClassName, transformCode);
        }
    }
    private void GenerateDefaultTransformation(DefaultTransformationTypeEnum transformCode)
    {
        if (String.IsNullOrEmpty(ClassName))
        {
            ClassName = DataClassInfoProvider.GetClassName(ClassID);
        }

        var code = TransformationInfoProvider.GenerateTransformationCode(ClassName, TransformationType, transformCode);

        // Writes the result to the text box
        if (TransformationType == TransformationTypeEnum.Html)
        {
            txtCode.Visible         = false;
            tbWysiwyg.Visible       = true;
            tbWysiwyg.ResolvedValue = code;
        }
        else
        {
            tbWysiwyg.Visible = false;
            txtCode.Visible   = true;
            txtCode.Text      = code;
        }
    }
Пример #3
0
    /// <summary>
    /// Generates transformation code depending on the transformation type (Xslt, Ascx).
    /// </summary>
    private void DefaultTransformation()
    {
        if (String.IsNullOrEmpty(mClassName) && UseClassSelector)
        {
            mClassName = DataClassInfoProvider.GetClassName(filter.ClassId);
        }

        // Gets Xml schema of the document type
        DataClassInfo dci     = DataClassInfoProvider.GetDataClass(mClassName);
        string        formDef = string.Empty;

        if (dci != null)
        {
            formDef = dci.ClassFormDefinition;
        }

        // Gets transformation type
        TransformationTypeEnum transformType = TransformationInfoProvider.GetTransformationTypeEnum(drpType.SelectedValue);

        DefaultTransformationTypeEnum transformCode = DefaultTransformationTypeEnum.Default;

        if (transformType == TransformationTypeEnum.Ascx)
        {
            switch (drpTransformationCode.SelectedValue)
            {
            // Atom transformation code
            case "Atom":
                transformCode = DefaultTransformationTypeEnum.Atom;
                break;

            // RSS transformation code
            case "RSS":
                transformCode = DefaultTransformationTypeEnum.RSS;
                break;

            // XML transformation code
            case "XML":
                transformCode = DefaultTransformationTypeEnum.XML;
                break;

            // Default ASCX transformation code
            default:
                transformCode = DefaultTransformationTypeEnum.Default;
                break;
            }
        }

        // Writes the result to the text box
        if (transformType == TransformationTypeEnum.Html)
        {
            txtCode.Visible         = false;
            tbWysiwyg.Visible       = true;
            tbWysiwyg.ResolvedValue = TransformationInfoProvider.GenerateTransformationCode(formDef, transformType, mClassName, transformCode);
        }
        else
        {
            tbWysiwyg.Visible = false;
            txtCode.Visible   = true;
            txtCode.Text      = TransformationInfoProvider.GenerateTransformationCode(formDef, transformType, mClassName, transformCode);
        }
    }