I'm trying to troubleshoot some problems I'm having, so I wrote a very simple .NET Framework v4.7.2 C# console application to narrow down where the problem is. One issue I've found is immediately after loading any Vendor record, IsModified is always true. Why? Am I doing something wrong?
Here's the complete, very simple code I have:
_session = new PeachtreeSession();
_session.Begin(SageApplicationID); // SageApplicationId is a constant
var companyId = _session.LookupCompanyIdentifier(SageServer, "testcrm"); // SageServer is a constant
var authResult = _session.RequestAccess(companyId);
if (authResult != AuthorizationResult.Granted)
Console.WriteLine($"Failed to open company '{companyId.CompanyName}'. Sage gave authorization result '{authResult.ToString()}'.");
else
_sageDb = _session.Open(companyId);
var vendors = _sageDb.Factories.VendorFactory.List(); vendors.Load(); var vendor = vendors.SingleOrDefault(c => c.ID.Trim().Equals("Champaign", StringComparison.CurrentCultureIgnoreCase));
Console.WriteLine("IsModified: " + vendor.IsModified); // This is always true
As a side-note, if at this point I call vendor.Save(), the Vendor's name appears blank if I try to go to Tasks -> Purchases / Receive Inventory in Sage and use this vendor. I am still exploring that issue, so I haven't posted it yet here, but maybe it's related to something I'm doing wrong in this very short code?
Thanks.