2. November 2009 08:48
smmBusRelTable = smmBusRelTable::findByPartyId(_ct.PartyId, false);
// Geschäftsbeziehung anlegen, wenn für den Kunden noch keine vorhanden ist
if (smmBusRelTable.RecId == 0)
{
        smmBusRelTable.clear();
        smmBusRelTable.PartyId            = _ct.PartyId;
        smmBusRelTable.BusRelAccount = NumberSeq::newGetNum(SmmParameters::numRefBusRelAccount()).num();
        smmBusRelTable.BusRelTypeId   = smmBusRelTypeGroup::getCustomerType();
        smmBusRelTable.Imported         = true;
        smmBusRelTable.insert();
}
2. November 2009 16:20
2. November 2009 16:45
akuehn hat geschrieben:Hi,
hatten wir das Thema nicht erst?
[Gelöst] Wie am besten Kundendaten importieren
Dachte das Problem wäre schon gelöst?
4. November 2009 16:05
smmBusRelTable.init();smmBusRelTable = smmBusRelTable::findByPartyId(_ct.PartyId, false);smmBusRelTable::findCust()10. November 2009 18:58
private void updateSmmBusRelTable(Common _common)
{
    smmBusRelTable  smmBusRelTable;
    smmBusRelTypeId busRelTypeId;
    CustTable       custTable;
    VendTable       vendTable;
    DirPartyId      dirPartyId;
    DirParty        dirParty;
    ;
    
    // Geschäftsbeziehung anlegen, die Aktualisierung der Daten wird intern von Dynamics AX übernommen
    switch (_common.TableId)
    {
        case CustTable.TableId:
            custTable       = _common;
            dirPartyId      = custTable.PartyId;
            busRelTypeId    = smmBusRelTypeGroup::getCustomerType();
            smmBusRelTable  = smmBusRelTable::findCust(custTable.AccountNum);
            break;
            
        case vendTable.TableId:
            vendTable       = _common;
            dirPartyId      = vendTable.PartyId;
            busRelTypeId    = smmBusRelTypeGroup::getVendorType();
            smmBusRelTable  = smmBusRelTable::findVend(vendTable.AccountNum);
            break;
            
        default:
            throw Error("Unbekannter Tabellentyp: " + tableid2name(_common.TableId));
    }
    
    if (!smmBusRelTable)
    {
        dirParty = DirParty::constructFromPartyId(dirPartyId);
        
        smmBusRelTable.initFromDirParty(dirParty);
        smmBusRelTable.BusRelAccount = NumberSeq::newGetNum(smmParameters::numRefBusRelAccount()).num();
        smmBusRelTable.BusRelTypeId  = busRelTypeId;
        smmBusRelTable.Imported      = true;
        smmBusRelTable.insert();
    }
}