/// <summary>Initalizes new SalesOrderHeader child object. Not added to collection.</summary> public static SalesOrderHeader NewSalesOrderHeaderChildren(Customer parent) { var newItem = new SalesOrderHeader(); newItem.NullCheckEnabled = false; newItem.SalesOrderID = ArrayUtil.NextNegativeId<SalesOrderHeaderEntity>(parent.SalesOrderHeaderChildren, (item) => (item.SalesOrderID)); newItem.SetParent(newItem.Table.FK_CustomerID, parent); return newItem; }
/// <summary>Initalizes new CustomerAddress child object. Not added to collection.</summary> public static CustomerAddress NewCustomerAddressChildren(Customer parent) { var newItem = new CustomerAddress(); newItem.NullCheckEnabled = false; newItem.AddressID = ArrayUtil.NextNegativeId<CustomerAddressEntity>(parent.CustomerAddressChildren, (item) => (item.AddressID)); newItem.SetParent(newItem.Table.FK_CustomerID, parent); return newItem; }
/// <summary>Po potrebi konvertira entity u business objekt.</summary> public static Customer ConvertEntityToBusinessObject(CustomerEntity entity) { Customer bizobj = entity as Customer; if (bizobj == null) bizobj = new Customer(entity); return bizobj; }
/// <summary>Kreira novi objekt i postavlja default vrijednosti.</summary> public static Customer NewCustomer(IActor creator) { var newObject = new Customer(-1) { NullCheckEnabled = false }; return newObject; }
/// <summary>Non-business object elemente kolekcije konvertira u business objekte.</summary> public static void ConvertEntitiesToBusinessObjects(IEntityCollection entities) { for (int i = 0; i < entities.Count; i++) { CustomerEntity entity = (CustomerEntity)entities[i]; bool isBizObject = (entity is IBusinessObject); if (!isBizObject) entities[i] = new Customer(entity); } }