• Decrease Text SizeIncrease Text Size

Setup Custom Data Transfer CpScripting File

Posted Date: 5/15/2023
    Printer Friendly Version   Email A Friend   Add This   Increase Text Size   Decrease Text Size
This is an example of how to set up a custom Data Transfer CpScripting File
You would need to create a CustomDataTransferCpScripting.cs file
This file needs to be in the Master /Root/App_Code/Custom directory.


using System;
using System.Collections.Specialized;


namespace Centralpoint.Master
{
    namespace Custom.my_Custom_Custom_DataTransfer
    {
    }

    public partial class DataTransferCpScripting
    {
        /// <summary>
        /// This method executes custom scripts or override existing scripts.
        /// </summary>
        /// <param name="key">The lowered value of the key property of the script.</param>
        /// <param name="collection">A collection of script properties and their values.</param>
        /// <param name="result">The result returned from the script.</param>
        /// <param name="found">Whether the script (key) was found and is returning a result.</param>
        partial void ExecuteCustom(string key, NameValueCollection collection, ref string result, ref bool found)
        {
            switch (key)
            {
                case "my_helloworld":
                    result = this.my_HelloWorld(collection);
                    break;
                default:
                    return;
            }
            found = true;
        }

        public string my_HelloWorld(NameValueCollection collection)
        {
            string text = collection["Text"];
            if (String.IsNullOrEmpty(text)) text = "Hello World.";
            return text;
        }
    }
}




Keywords: Data Transfer, Data Transfer CpScripting



Related Taxonomy
  - How Do I?

Comments:

Be the first to leave a comment.
Please Login to post comments.