Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Magento中的多个complexFilter';s api v2_C#_Web Services_Magento - Fatal编程技术网

C# Magento中的多个complexFilter';s api v2

C# Magento中的多个complexFilter';s api v2,c#,web-services,magento,C#,Web Services,Magento,目前,我在从c#接口使用新Magento的SOAPV2时遇到了一些困难 使用php,我可以做如下事情: $params["created_at"]["from"] = date("Y-m-d H:i:s",Functions::convert_time($dataDa)); $params["created_at"]["to"] = date("Y-m-d H:i:s",Functions::convert_time($dataA)); MageInterface::getSingleton()

目前,我在从c#接口使用新Magento的SOAPV2时遇到了一些困难

使用php,我可以做如下事情:

$params["created_at"]["from"] = date("Y-m-d H:i:s",Functions::convert_time($dataDa));
$params["created_at"]["to"] = date("Y-m-d H:i:s",Functions::convert_time($dataA));
MageInterface::getSingleton()->shipmentList($params); 
在这种模式下,我能够找到从$dataDa到$dataA创建的订单列表,没有任何问题。然而,对于c#,似乎只有最后一个选择器起作用

我的代码:

var cpf = new complexFilter[2];
cpf[0] = new complexFilter
                    {
                        key = "created_at",
                        value = new associativeEntity
                        {
                            key = "to",
                            value = uxDataA.DateTime.ToString("yy-MM-dd HH:mm:ss")
                        }
                    });
cpf[1] = new complexFilter
                    {
                        key = "created_at",
                        value = new associativeEntity
                        {
                            key = "from",
                            value = uxDataDa.DateTime.ToString("yy-MM-dd HH:mm:ss")
                        }
                    });
var filters = new filters();
filters.complex_filter = cpf;
var risultato = mage.salesOrderList(sessionKey, filters); 
在这种模式下,只考虑从条件中创建的(就像第二个复杂过滤器用相同的键覆盖前一个过滤器一样)。想法

提前谢谢

解决了,mage\sales\order\api\v2.php中有一个bug(或功能?)

请参阅此线程中的更多信息:

已解决,mage\sales\order\api\v2.php中存在错误(或功能?)

请参阅此线程中的更多信息:

这对我很有用:

private filters addFilter(filters filtresIn, string key, string op, string value)
    {
        filters filtres = filtresIn;
        if (filtres == null)
            filtres = new filters();

        complexFilter compfiltres = new complexFilter();
        compfiltres.key = key;
        associativeEntity ass = new associativeEntity();
        ass.key = op;
        ass.value = value;
        compfiltres.value = ass;

        List<complexFilter> tmpLst;
        if (filtres.complex_filter!=null)
            tmpLst = filtres.complex_filter.ToList();
        else tmpLst = new List<complexFilter>();

        tmpLst.Add(compfiltres);

        filtres.complex_filter = tmpLst.ToArray();

        return filtres;
    }
这对我很有用:

private filters addFilter(filters filtresIn, string key, string op, string value)
    {
        filters filtres = filtresIn;
        if (filtres == null)
            filtres = new filters();

        complexFilter compfiltres = new complexFilter();
        compfiltres.key = key;
        associativeEntity ass = new associativeEntity();
        ass.key = op;
        ass.value = value;
        compfiltres.value = ass;

        List<complexFilter> tmpLst;
        if (filtres.complex_filter!=null)
            tmpLst = filtres.complex_filter.ToList();
        else tmpLst = new List<complexFilter>();

        tmpLst.Add(compfiltres);

        filtres.complex_filter = tmpLst.ToArray();

        return filtres;
    }

由于我遇到了同样的问题,如果您能为我节省一些时间,并解释一下您的经历以及您是如何为您解决的,那将是非常棒的:)谢谢,我错过了您的回复。看看这次讨论:因为我遇到了同样的问题,如果你能为我节省一些时间,解释一下你的经历以及你是如何为你解决的,那将是非常好的:)谢谢,我错过了你的回复。看看这个讨论:addFilter方法是一个不错的特性,我将在axis生成的代码中使用:-)addFilter方法是一个不错的特性,我将在axis生成的代码中使用:-)