25 Eylül 2007 Salı

findorcreate

server static InventBatch findOrCreate(InventBatchId _inventBatchId, ItemId _itemId, Real _agirlik = 0)
{
InventBatch inventBatch;
InventBatchId inventBatchId;
;
inventBatch = InventBatch::find(_inventBatchId,_itemId);

if (inventBatch) //inventbatch bulmussan kullaniya onu gonder
return inventBatch;
else
{
if(_inventBatchId) // InventBatchid bos degilse,aksi halde bos kayita izin verir
{
ttsBegin;

inventBatch.inventBatchId = _inventBatchId;
inventBatch.itemId = _itemId;
inventBatch.prodDate = systemdateget();
inventBatch.Agirlik = _agirlik;
inventBatch.insert();

ttsCommit;

return inventBatch;
}
else
return null;
}
}

Hiç yorum yok: