第八章:Developing Applications Using Business Connector
这一章的代码主要演示如何通过Business Connector与Axapta交互
在Dynamics Axapta的客户端安装目录中找到Microsoft.Dynamics.BusinessConnectorNet.dll这个文件,添加到VS.NET的工程中.
1.HelloWorldBC.cs

Inside Dynamics Axapta源代码赏析(四)class HelloWorldBC
    }
好久没用VS2005了,今天用了一下,智能提示忒爽了,Axapta编辑器也快点好起来吧......
搞不清楚四个参数都填null是怎么找到AOS的?本来想用Reflector反编译一下Microsoft.Dynamics.BusinessConnectorNet.dll,结果出来的是乱七八糟的东西,唉,忒不友好了......
2.AccessingDataBC.cs
遍历所有的料品,并打印料品Id和料品名称.
Inside Dynamics Axapta源代码赏析(四) // Instantiate a Dynamics AX record object for the 
Inside Dynamics Axapta源代码赏析(四)            
// record we want to work with
Inside Dynamics Axapta源代码赏析(四)
            AxaptaRecord axRecord = ax.CreateAxaptaRecord("InventTable");
Inside Dynamics Axapta源代码赏析(四)            
Inside Dynamics Axapta源代码赏析(四)            
// Execute a query against the record 
Inside Dynamics Axapta源代码赏析(四)
            axRecord.ExecuteStmt("select * from %1");
Inside Dynamics Axapta源代码赏析(四)
Inside Dynamics Axapta源代码赏析(四)            
// Loop through the returned records
Inside Dynamics Axapta源代码赏析(四)            
// Extract the data from two fields for each record
Inside Dynamics Axapta源代码赏析(四)
            while (axRecord.Found)
            }
3.InvokingBusinessLogicBC.cs
调用Axapta中的静态方法.
Inside Dynamics Axapta源代码赏析(四) // Invoke the CallStaticClassMethod managed class
Inside Dynamics Axapta源代码赏析(四)                
// Provide the X++ class name and method to execute
Inside Dynamics Axapta源代码赏析(四)                
// The return value is placed into returnValue
Inside Dynamics Axapta源代码赏析(四)
                returnValue = ax.CallStaticClassMethod("InventoryManager",
Inside Dynamics Axapta源代码赏析(四)                            
"updateInventoryQty");
Inside Dynamics Axapta源代码赏析(四)
Inside Dynamics Axapta源代码赏析(四)                
// Use the return value to take some action
Inside Dynamics Axapta源代码赏析(四)
                if((Boolean)returnValue)
Inside Dynamics Axapta源代码赏析(四)                    Console.WriteLine(
"Inventory quantity updated successfully");
Inside Dynamics Axapta源代码赏析(四)                
else
Inside Dynamics Axapta源代码赏析(四)                    Console.WriteLine(
"Inventory quantity update failed");

其中的类InventoryManager在工程InsideDynamicsAXChapter8中定义.

这些连接和简单的操作倒还可以,不过Axapta的接口和SDK写得确实不甘恭维......

相关文章:

  • 2021-10-14
  • 2022-02-22
  • 2022-12-23
  • 2021-05-22
  • 2021-10-24
  • 2021-11-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
相关资源
相似解决方案