csharp Epicor 10.1从代码调用BAQ

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp Epicor 10.1从代码调用BAQ相关的知识,希望对你有一定的参考价值。

	// Execute a BAQ by Calling the Business Object via WCF
	private void CallBAQUsingBO()
	{
		try
		{
			// Declare and Initialize Variables
			string BAQName = "DIEN-HASO";
			Ice.BO.QueryExecutionDataSet ds = new Ice.BO.QueryExecutionDataSet();
	
			// Add Parameter Rows
			// Definition: AddExecutionParameterRow(string ParameterID, string ParameterValue, string ValueType, bool IsEmpty, Guid SysRowID, string RowMod)
			// Possible ValueTypes: nvarchar, int, decimal, date, datetime, bit, uniqueidentifier, bigint
			// IsEmpty indicates if your passed value Is Empty because if it is, you can define in your params to use a default value if empty.
			// Typically you use string.IsNullOrEmpty(yourValueVariable) but if you are hard coding a value then you can simply set it to false
			ds.ExecutionParameter.AddExecutionParameterRow("QuoteNumber", "10003", "int", false, Guid.Empty, "A");
			ds.ExecutionParameter.AddExecutionParameterRow("FirstName", "Bill", "nvarchar", false, Guid.Empty, "A");
	
			// Use Business Object Directly
			Ice.Proxy.BO.DynamicQueryImpl dynamicQuery = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>((Ice.Core.Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicQuerySvcContract>.UriPath);
			System.Data.DataSet results = dynamicQuery.ExecuteByID(BAQName, ds);
	
			// Lets Loop through our results
			if (results.Tables["Results"].Rows.Count > 0)
			{
				foreach (DataRow item in results.Tables["Results"].Rows)
				{
					// In E9 you used TableName.Column in E10 it is TableName_Column
				    string val = item["QuoteHed_QuoteNum"].ToString();
				}
			}
		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}


	// Execute a BAQ by Calling the Client Adapter
	private void CallBAQUsingAdapter()
	{
		try
		{
			// Declare and create an instance of the Adapter.
			DynamicQueryAdapter adapterDynamicQuery = new DynamicQueryAdapter(this.oTrans);
			adapterDynamicQuery.BOConnect();

			// Declare and Initialize Variables
			string BAQName = "DIEN-HASO";
			Ice.BO.QueryExecutionDataSet ds = new Ice.BO.QueryExecutionDataSet();

			// Add Parameter Rows
			// Definition: AddExecutionParameterRow(string ParameterID, string ParameterValue, string ValueType, bool IsEmpty, Guid SysRowID, string RowMod)
			// Possible ValueTypes: nvarchar, int, decimal, date, datetime, bit, uniqueidentifier, bigint
			// IsEmpty indicates if your passed value Is Empty because if it is, you can define in your params to use a default value if empty.
			// Typically you use string.IsNullOrEmpty(yourValueVariable) but if you are hard coding a value then you can simply set it to false
			ds.ExecutionParameter.AddExecutionParameterRow("QuoteNumber", "10003", "int", false, Guid.Empty, "A");
			ds.ExecutionParameter.AddExecutionParameterRow("FirstName", "Bill", "nvarchar", false, Guid.Empty, "A");

			// Call Adapter method
			adapterDynamicQuery.ExecuteByID(BAQName, ds);

			// Lets Loop through our results
			if (adapterDynamicQuery.QueryResults.Tables["Results"].Rows.Count > 0)
			{
				foreach (DataRow item in adapterDynamicQuery.QueryResults.Tables["Results"].Rows)
				{
					// In E9 you used TableName.Column in E10 it is TableName_Column
				    string val = item["QuoteHed_QuoteNum"].ToString();
				}
			}

			// Cleanup Adapter Reference
			adapterDynamicQuery.Dispose();

		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}

以上是关于csharp Epicor 10.1从代码调用BAQ的主要内容,如果未能解决你的问题,请参考以下文章

csharp Epicor:从午夜到实际时间转换秒数

csharp Epicor标准练习片段

csharp Epicor UD Entry KeyField

csharp 的Epicor-WCF-j.cs

csharp 创建Epicor BO Instace WCF

csharp Epicor - 在订单输入中检查零件详细信息