Hi,
I have sage 50 accounting, the data are on a local server (within same network). We have no issue with the performance when using Sage 50 but when using the SDK it's really [:@]tooooooooooooo[:@] slow
Listing companies takes 45 seconds!
Finding Check details takes 2 minutes!
There is no issue with the network because we also have SQL Server on the same server and performance is excellent and as I mentioned no issue with the performance when using Sage 50 accounting directly.
How can I fix this please?
here is the code for Listing the company for example:
private void LoadCompanyList(string serverName)
{
if (frmMain.Session != null)
{
try
{
// Use the PeachtreeSession class to get list of companies opened
// from the default Sage 50 datapath in INI file.
if (string.IsNullOrEmpty(serverName))
{
m_companyIdList = frmMain.Session.CompanyList();
}
else
{
m_companyIdList = frmMain.Session.CompanyList(serverName);
}
if (m_companyIdList != null)
{
// clear list view
companyListView.Items.Clear();
// display detail info for each company in list view
// column 0: Company Name
// column 1: Company Path
// column 2: Date last modified
foreach (CompanyIdentifier company in m_companyIdList)
{
ListViewItem companyItem = new ListViewItem(company.CompanyName);
// companyItem.SubItems.Add(company.Path);
// companyItem.SubItems.Add(new DirectoryInfo(company.Path).LastWriteTime.ToShortDateString());
companyItem.SubItems.Add(new DirectoryInfo(company.Path).LastWriteTime.ToLongDateString());
companyListView.Items.Add(companyItem);
}
// Properties.Settings.Default.server_name = serverName;
// Properties.Settings.Default.Save();
// Properties.Settings.Default.Reload();
}
}
catch (Sage.Peachtree.API.Exceptions.ConfigurationException ex)
{
DisplayError("There was an error loading company list.", ex);
}
}
}
and this is the code to find check details:
VendorList vendorList = frmMain.Company.Factories.VendorFactory.List();
vendorList.Load();
PaymentList paymentlist = frmMain.Company.Factories.PaymentFactory.List();
paymentlist.Load();
IEnumerable<CashFlowTransaction> filteredPayments = from payment in paymentlist
join vendor in vendorList on payment.VendorReference equals vendor.Key
where payment.ReferenceNumber == CheckNumberForm.txtCheck.Text.Trim()
select new CashFlowTransaction
{
TransactionType = "Payment",
Number = payment.ReferenceNumber,
ID = vendor.ID,
Name = vendor.Name,
Date = payment.Date,
Amount = payment.Amount
};
Thanks,
Jassim