在一个中继器中连接两个Nav web服务数据

本文关键字:Nav 两个 web 服务 数据 一个 中继器 连接 | 更新日期: 2023-09-27 18:06:15

我正在尝试使用Linq查询加入两个导航web服务数据。但是我怎么能做到呢?我的代码如下。假设我有客户详细信息及其Invoice web服务。我想把这些细节写在一页纸上。请给我一个解决办法。

    public void bindEmpCustInvoice(string strCusCode)
    {
        List<Customer_Card_Filter> cardFilter = new List<Customer_Card_Filter>();
        Customer_Card_Filter cardField = new Customer_Card_Filter();
        cardFilter.Add(cardField);
        Customer_Card[] cardList = cls.wsCustomerCard.ReadMultiple(cardFilter.ToArray(), null, 3);
        RptEmpCustInvoise.DataSource = cardList;
        RptEmpCustInvoise.DataBind();
        decimal decValue = 0.00m;
        List<Customer_Statistics_Bill_to_Customer_Filter> cFilter = new List<Customer_Statistics_Bill_to_Customer_Filter>();
        Customer_Statistics_Bill_to_Customer_Filter cField = new Customer_Statistics_Bill_to_Customer_Filter();
        cFilter.Add(cField);
        Customer_Statistics_Bill_to_Customer[] billList = cls.wsCustBillService.ReadMultiple(decValue, decValue, decValue, decValue, cFilter.ToArray(), null, 3);
        RptEmpCustInvoise.DataSource = billList;
        RptEmpCustInvoise.DataBind();
        var q = (from cd in cardList
                 join bd in billList on cd.No equals bd.No
                 orderby cd.No
                 select new
                     {
                         cd.No,
                         cd.Name,
                         cd.Contact,
                         cd.Phone_No,
                         cd.City,
                         bd.Balance_LCY,
                         bd.Outstanding_Orders_LCY,
                         bd.Shipped_Not_Invoiced_LCY,
                         bd.Outstanding_Invoices_LCY,
                         bd.Outstanding_Serv_Orders_LCY,
                         bd.Serv_Shipped_Not_Invoiced_LCY,
                         bd.Outstanding_Serv_Invoices_LCY
                     }).ToArray();
    }

在一个中继器中连接两个Nav web服务数据

通过研究,我找到了将linq结果绑定到数据源的解决方案。代码如下:

     public void bindEmpCustInvoice(string strCusCode)
    {
        try
        {
            Customer_Card[] cardList = cls.wsCustomerCard.ReadMultiple(null, null, 999999); Customer_Ledger_Entries[] billList = cls.wsCustInvoice.ReadMultiple(null,null,99999);
            var q = (from cd in cardList
                     join bd in billList on cd.No equals bd.Customer_No
                     orderby cd.No
                     select new
                         {
                             cd.No,
                             cd.Name,
                             cd.Contact,
                             cd.Phone_No,
                             cd.City,
                             bd.Amount });
            RptEmpCustInvoise.DataSource = q.ToList();
            RptEmpCustInvoise.DataBind();
        }
        catch { throw; }
    }