Options

How to update the Sales Line through web service

abhishekpareekabhishekpareek Member Posts: 150
edited 2010-12-31 in NAV Three Tier
I am stuck wth one issue.
Scenario:
I have to update the sales line through webservice for one field Qty. But the problem is how to select the record through web service when records are displayed on C# grid.
Now as you know I have Sales and Sales line displayed on the C# application. Now I want to update the qty field in Sales Line through c#. The problem is that I am not able to find out the key field in Sales Line through which I can update the Sales Line.

Regards,
Abhishek Pareek

Comments

  • Options
    dipakpatel2505dipakpatel2505 Member Posts: 169
    Hello Abhishek,

    Try following code.

    protected void txtQty_TextChanged(object sender, EventArgs e)
    {
    try
    {
    TextBox tb1 = ((TextBox)(sender));
    GridViewRow gv1 = ((GridViewRow)(tb1.NamingContainer));
    int rownumber = gv1.RowIndex;
    int lineno = Convert.ToInt32((GridView1.Rows[rownumber].FindControl("lblQty") as Label).Text);

    SalesLineSubform_pgobj = SalesLineSubform_serv.Read(GridView1.Rows[rownumber].colume[(Column no of DocumentNo)].Text, GridView1.Rows[rownumber].colume[(Column no of LineNo)]); //It will read all sales Lines

    //SalesLineSubform is webservice-Page 46

    SalesLineSubform_pgobj.Quantity = tb1.Text;

    SalesLineSubform_serv.Update(ref SalesLineSubform_pgobj);
    }
    catch (Exception ex)
    {
    }
    finally
    {
    //Again Read Sales Order
    //Again Read all Sales Lines & Fill grid.
    }
    }
  • Options
    abhishekpareekabhishekpareek Member Posts: 150
    Hi,

    Thanks for response!
    I am not getting two parameters for Read function. Only one parameter I have i.e ref SalesLine.
    In your example Read is taking two parameters. I am using Navision 2009 sp1.
    Let me explain complete scenario:

    I have two grids. On first grid I am populating all Sales Header Table records. On second grid, I am populating all corresponding records of sales line table for current record seletion on sales header table.
    Now here comes the problem: I want to update the Sales line qty in second grid. Now to do that I have to update the sales line for document no. and line no. But as you know that SalesLine webservice contains the key field only.
    It would be great if you can help me for updating the selected sales line record.

    Regards,
    Abhishek Pareek
  • Options
    dipakpatel2505dipakpatel2505 Member Posts: 169
    Hello Abhishek,
    you put all fields of primary key of Sales Line in Sales Order SubPage to get them as parameter to read sales line and againg republish Sales Order
    and Sales Order Subpage webservices then Update web reference in your web application.
    You will get second parameter.

    Let me know if you still facing the same problem.

    With Best Regards,
    Dipak patel
    Hi,

    Thanks for response!
    I am not getting two parameters for Read function. Only one parameter I have i.e ref SalesLine.
    In your example Read is taking two parameters. I am using Navision 2009 sp1.
    Let me explain complete scenario:

    I have two grids. On first grid I am populating all Sales Header Table records. On second grid, I am populating all corresponding records of sales line table for current record seletion on sales header table.
    Now here comes the problem: I want to update the Sales line qty in second grid. Now to do that I have to update the sales line for document no. and line no. But as you know that SalesLine webservice contains the key field only.
    It would be great if you can help me for updating the selected sales line record.

    Regards,
    Abhishek Pareek
  • Options
    abhishekpareekabhishekpareek Member Posts: 150
    edited 2011-07-19
    Please visit my link.
    I had developed a addon for Navision which is using c#

    Regards,
    Abhishek Pareek
  • Options
    dipakpatel2505dipakpatel2505 Member Posts: 169
    Hello Abhishek,
    I have gone through your add-on. It is excellent work and instruction are given very clearly.

    I am having following query:
    I want to create Contact Card->Interaction wizard as per given in Navision.For creating Contact Interaction,NAVISION has used Segment Line Table as Temporary and intermediate table.

    Do you have any idea about How can we use temporary table with Web services ?

    Any suggestion will be appriciated.

    With best Regards,
    Dipak patel


    Please visit my link.
    http://www.codeproject.com/KB/cs/Author ... sharp.aspx
    I had developed a addon for Navision which is using c#

    Regards,
    Abhishek Pareek
  • Options
    abhishekpareekabhishekpareek Member Posts: 150
    Hi,

    You can create a class in C# with the same structure as that of your temporary table and use that class to do intermittent calculations.

    Just a query for you: Are you creating whole module in Navision in C#?

    Regards,
    Abhishek Pareek
  • Options
    abhishekpareekabhishekpareek Member Posts: 150
    All issues are resolved and thus created a add-on in C# for Navision:

    Please visit my link.
    I had developed a addon for Navision which is using C# \:D/

    Regards,
    Abhishek Pareek
Sign In or Register to comment.