Пример #1
0
		/// <summary>Initalizes new SalesOrderHeader child object. Not added to collection.</summary>
		public static SalesOrderHeader NewSalesOrderHeaderChildren2(Address parent)
		{
			var newItem = new SalesOrderHeader();
			newItem.NullCheckEnabled = false;
			newItem.SalesOrderID = ArrayUtil.NextNegativeId<SalesOrderHeaderEntity>(parent.SalesOrderHeaderChildren2, (item) => (item.SalesOrderID));
			newItem.SetParent(newItem.Table.FK_ShipToAddressID, parent);

			return newItem;
		}
Пример #2
0
		/// <summary>Saves collection SalesOrderHeaderChildren2 to database.</summary>
		protected void DbSaveSalesOrderHeaderChildren2()
		{
			this.SalesOrderHeaderChildren2.SetParents(this.SalesOrderHeaderChildren2.Table.FK_ShipToAddressID, this, /*shared*/ true);

			DALHelper.GetDao<SalesOrderHeaderEntity>(_ConnectionProvider).SaveCollection(this.SalesOrderHeaderChildren2);

			foreach (int item in this.oldSalesOrderHeaderChildren2IDs)
			{
				if (!ArrayUtil.Exists<SalesOrderHeaderEntity>(this.SalesOrderHeaderChildren2, x=>(int)x.GetPrimaryKeyValue()[0] == item))
				{
					SalesOrderHeader bizItem = new SalesOrderHeader(item);
					bizItem.Delete(null);
					bizItem = null;
				}
			}

			SetOldSalesOrderHeaderChildren2IDs();
		}
Пример #3
0
		/// <summary>Initalizes new SalesOrderDetail child object. Not added to collection.</summary>
		public static SalesOrderDetail NewSalesOrderDetailChildren(SalesOrderHeader parent)
		{
			var newItem = new SalesOrderDetail();
			newItem.NullCheckEnabled = false;
			newItem.SalesOrderDetailID = ArrayUtil.NextNegativeId<SalesOrderDetailEntity>(parent.SalesOrderDetailChildren, (item) => (item.SalesOrderDetailID));
			newItem.SetParent(newItem.Table.FK_SalesOrderID, parent);

			return newItem;
		}
Пример #4
0
		/// <summary>Kreira novi objekt i postavlja default vrijednosti.</summary>
		public static SalesOrderHeader NewSalesOrderHeader(IActor creator)
		{
			var newObject = new SalesOrderHeader(-1)
			{
				NullCheckEnabled = false
			};

			return newObject;
		}
Пример #5
0
		/// <summary>Po potrebi konvertira entity u business objekt.</summary>
		public static SalesOrderHeader ConvertEntityToBusinessObject(SalesOrderHeaderEntity entity)
		{
			SalesOrderHeader bizobj = entity as SalesOrderHeader;
			if (bizobj == null)
				bizobj = new SalesOrderHeader(entity);

			return bizobj;
		}
Пример #6
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++)
			{
				SalesOrderHeaderEntity entity = (SalesOrderHeaderEntity)entities[i];
				bool isBizObject = (entity is IBusinessObject);
				if (!isBizObject)
					entities[i] = new SalesOrderHeader(entity);
			}
		}