join two Nav web services data in one repeater

天涯浪子 提交于 2019-12-11 04:18:42

问题


I am trying to join two nav web services data using Linq query. But how can I do it. my code is as below.Suppose I have customer detail and its Invoice web service. and I want this detailin one page.Please give me solution.

    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();

    }

回答1:


By research, I found solution just bind linq result to Datasource. It is as below code.

     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; }
    }


来源:https://stackoverflow.com/questions/39407688/join-two-nav-web-services-data-in-one-repeater

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!