22. Februar 2012 13:28
public static List<Mandant> GetMandantList()
{
Axapta ax;
AxaptaRecord axRecord;
List<Mandant> mandantList = new List<Mandant>();
string selectStatement = string.Empty;
using (ax = new Axapta())
{
try
{
ax.Logon(null, null, null, null);
axRecord = ax.CreateAxaptaRecord("DirPartyTable");
selectStatement = "select crossCompany Name, NameAlias, RecId from %1 order by Name";
axRecord.ExecuteStmt(selectStatement);
while (axRecord.Found)
{
mandantList.Add(new Mandant((string)axRecord.get_Field("Name"),
axRecord.get_Field("RecId").ToString(),
(string)axRecord.get_Field("NameAlias")));
axRecord.Next();
}
}
catch (Exception)
{
throw;
}
}
return mandantList;
}
selectStatement = "select Name, NameAlias, RecId from %1 join custTable where custTable.dataAreaId == " + _dataAreaId + " && %1.RecId == custTable.Party";
selectStatement = string.Format("select Name, NameAlias, RecId from %1 join {0} " +
"where {1}.dataAreaId == {2} " +
"&& %1.RecId == {3}.Party", axCustTable, axCustTable, _dataAreaId, axCustTable);
public static DirPartyTable GetCustomerByParty(DataAreaId _dataAreaId)
{
CustTable custTable;
DirPartyTable dirPartyTable;
select Name, NameAlias, RecId from dirPartyTable
join custTable
where custTable.dataAreaId == _dataAreaId
&& dirPartyTable.RecId == custTable.Party;
return dirPartyTable;
}
myAxaptaBuffer = (AxaptaBuffer)ax.CallStaticClassMethod("VSC_HelperClass", "GetCustomerByParty", _dataAreaId);
23. Februar 2012 10:22
public static server Microsoft.Dynamics.Framework.BusinessConnector.Adapter.IAxRecord GetCustomerByParty(DataAreaId _dataAreaId)
{
CustTable custTable;
DirPartyTable dirPartyTable;
select crossCompany Name, NameAlias, RecId from dirPartyTable
join custTable
where custTable.dataAreaId == _dataAreaId
&& dirPartyTable.RecId == custTable.Party;
return dirPartyTable;
}
public static List<Mandant> GetCustomerList(string _dataAreaId)
{
Axapta ax;
AxaptaRecord axRecord;
List<Mandant> customerList = new List<Mandant>();
using (ax = new Axapta())
{
int counter = 0;
try
{
ax.Logon(null, null, null, null);
axRecord = (AxaptaRecord)ax.CallStaticClassMethod("VSC_HelperClass", "GetCustomerByParty", _dataAreaId);
while (axRecord.Found)
{
customerList.Add(new Mandant((string)axRecord.get_Field("Name"),
axRecord.get_Field("RecId").ToString(),
(string)axRecord.get_Field("NameAlias")));
axRecord.Next();
counter++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
return customerList;
}