Esempio n. 1
0
		/// <summary>Initalizes new Product child object. Not added to collection.</summary>
		public static Product NewProductChildren(ProductCategory parent)
		{
			var newItem = new Product();
			newItem.NullCheckEnabled = false;
			newItem.ProductID = ArrayUtil.NextNegativeId<ProductEntity>(parent.ProductChildren, (item) => (item.ProductID));
			newItem.SetParent(newItem.Table.FK_ProductCategoryID, parent);

			return newItem;
		}
Esempio n. 2
0
		/// <summary>Saves collection ProductChildren to database.</summary>
		protected void DbSaveProductChildren()
		{
			this.ProductChildren.SetParents(this.ProductChildren.Table.FK_ProductCategoryID, this, /*shared*/ true);

			DALHelper.GetDao<ProductEntity>(_ConnectionProvider).SaveCollection(this.ProductChildren);

			foreach (int item in this.oldProductChildrenIDs)
			{
				if (!ArrayUtil.Exists<ProductEntity>(this.ProductChildren, x=>(int)x.GetPrimaryKeyValue()[0] == item))
				{
					Product bizItem = new Product(item);
					bizItem.Delete(null);
					bizItem = null;
				}
			}

			SetOldProductChildrenIDs();
		}
Esempio n. 3
0
		/// <summary>Initalizes new SalesOrderDetail child object. Not added to collection.</summary>
		public static SalesOrderDetail NewSalesOrderDetailChildren(Product parent)
		{
			var newItem = new SalesOrderDetail();
			newItem.NullCheckEnabled = false;
			newItem.SalesOrderDetailID = ArrayUtil.NextNegativeId<SalesOrderDetailEntity>(parent.SalesOrderDetailChildren, (item) => (item.SalesOrderDetailID));
			newItem.SetParent(newItem.Table.FK_ProductID, parent);

			return newItem;
		}
Esempio n. 4
0
		/// <summary>Kreira novi objekt i postavlja default vrijednosti.</summary>
		public static Product NewProduct(IActor creator)
		{
			var newObject = new Product(-1)
			{
				NullCheckEnabled = false
			};

			return newObject;
		}
Esempio n. 5
0
		/// <summary>Po potrebi konvertira entity u business objekt.</summary>
		public static Product ConvertEntityToBusinessObject(ProductEntity entity)
		{
			Product bizobj = entity as Product;
			if (bizobj == null)
				bizobj = new Product(entity);

			return bizobj;
		}
Esempio n. 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++)
			{
				ProductEntity entity = (ProductEntity)entities[i];
				bool isBizObject = (entity is IBusinessObject);
				if (!isBizObject)
					entities[i] = new Product(entity);
			}
		}