Пример #1
0
		/// <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;
		}
Пример #2
0
		/// <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;
		}
Пример #3
0
		/// <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;
		}
Пример #4
0
		/// <summary>Kreira novi objekt i postavlja default vrijednosti.</summary>
		public static Customer NewCustomer(IActor creator)
		{
			var newObject = new Customer(-1)
			{
				NullCheckEnabled = false
			};

			return newObject;
		}
Пример #5
0
		/// <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);
			}
		}