将列表或数组从Arden MLM传递到C#

时间:2015-12-09 15:16:00

标签: c# arrays list arden-syntax

我很难在Arden MLM中找到关于列表和数组的文档。

我试图将使用ObjectsPlus的4位数字列表传递给C#DLL,该DLL可以将该列表作为参数并执行该功能的设计。

这是我在Arden MLM中所拥有的,但不起作用,因为我得到.net错误"对象引用没有设置为对象的实例"

这是传销:

list_id_object       := OBJECT [id_list_holder];
id_list              := new list_id_object with "1154", "1155", "1158"; 

try
    send_alert_start := new net_object 'Webservices';
    result := call send_alert_start.'pageToMultipleIds' with
        ((sender_name as string) as 'String'),
        ((sender_message as string) as 'String'),
        ((list_id_object as list) as 'List<Int32>');
endtry;
catch Exception ex
    error_occured := true;
    error_message := "Error message here\n" || ex.Message || "\n\n";
endcatch;

以下是接收该列表的C#方法:

public string testMethod(string sender_name, string sender_message, List<Int32> IdToPage)
    {
        try
            {
                testMethod2(sender_name, sender_message, IdToPage);
                return "Success";
            }
            catch(WebException e)
            {
                return e.ToString();
            }
    }

2 个答案:

答案 0 :(得分:3)

这是为Allscripts SCM编写的,但它应该显示如何构建List。不幸的是,您必须创建一个标准的Arden列表,然后遍历它并将每个项目添加到List。

std_include_libs := mlm'std_include_libs';
include std_include_libs;

id_list := 1154, 1155, 1158;

try; 
    using "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
    using namespace "System.Collections.Generic";
    idList := new net_object 'List<Int32>';
    for i in id_list do
        void := call idList.'Add' with i as 'Int32';
    enddo;

    send_alert_start := new net_object 'Webservices';
    result := call send_alert_start.'pageToMultipleIds' with    ((sender_name as string) as 'String'),
                                                                ((sender_message as string) as 'String'),
                                                                idList;
endtry;
catch Exception ex;
    error_occurred := true;
    error_message := "Error message here\n" || ex.Message || "\n\n";
endcatch;

答案 1 :(得分:0)

请参阅下面的更改。

((list_id_object as list) as 'List<Int32>');

更改为

((list_id as list) as 'List<Int32>');

list_id_object       := OBJECT [id_list_holder];
id_list              := new list_id_object with "1154", "1155", "1158"; 

try
    send_alert_start := new net_object 'Webservices';
    result := call send_alert_start.'pageToMultipleIds' with
        ((sender_name as string) as 'String'),
        ((sender_message as string) as 'String'),
        ((list_id as list) as 'List<Int32>');
endtry;
catch Exception ex
    error_occured := true;
    error_message := "Error message here\n" || ex.Message || "\n\n";
endcatch;