on 08-17-2018 8:16 AM
Hi Leon,
You can use FatherCard and FatherType properties to manipulate the consolidation partner.
Below is an example of how to update them:
// Get the company by SSO
Company diComp = app.SboApplication.Company.GetDICompany();
BusinessPartners bp = diComp.GetBusinessObject(BoObjectTypes.oBusinessPartners); // Get the metadata object
try
{
if (!bp.GetByKey(cardCode)) // Get your BP whom we need to set the parent to
{
throw new Exception($"Can't get BP by CardCode {cardCode}");
}
bp.FatherCard = parentCardCode; // Set new consolidation partner
bp.FatherType = BoFatherCardTypes.cPayments_sum; // Set type Payment/Delivery
int res = bp.Update(); // Try to update
if (res != 0)
{
throw new Exception($"Can't update BP: {diComp.GetLastErrorDescription()}");
}
}
finally
{
// Don't forget to release your DI API metadata objects to prevent memory leak
Marshal.ReleaseComObject(bp);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.