using System;
using System.Data.Linq;
using System.Linq;
using System.Collections.Generic;
/*
This Data Transfer Object created Automatically by DTOGenerator.
You can download DTOGenerator and get support in the project site: http://dtogenerator.codeplex.com
DTOGenerator developed by Shahar Gvirtz (http://weblogs.asp.net/shahar)
*/
namespace DTO
{
public class ProductDTO
{
public static ProductDTO GetDTOFromDALObject(ConsoleApplication3.Product src, bool GetChilds)
{
ProductDTO obj = new ProductDTO();
obj.Discontinued = src.Discontinued;
obj.ProductID = src.ProductID;
obj.ProductName = src.ProductName;
obj.QuantityPerUnit = src.QuantityPerUnit;
obj.ReorderLevel = src.ReorderLevel;
obj.UnitPrice = src.UnitPrice;
obj.UnitsInStock = src.UnitsInStock;
obj.UnitsOnOrder = src.UnitsOnOrder;
if(src.Category != null && GetChilds)
obj.Category = CategoryDTO.GetDTOFromDALObject(src.Category,false);
if(src.Order_Details != null && GetChilds) {
List<Order_DetailDTO> Order_DetailDTOlst = new List<Order_DetailDTO>();
src.Order_Details.ToList().ForEach(p=>Order_DetailDTOlst.Add(Order_DetailDTO.GetDTOFromDALObject(p,false)));
obj.Order_Details = Order_DetailDTOlst;
}
if(src.Supplier != null && GetChilds)
obj.Supplier = SupplierDTO.GetDTOFromDALObject(src.Supplier,false);
return obj;
}
public ConsoleApplication3.Product GetDALObject(bool IncludeChilds)
{
ConsoleApplication3.Product obj = new ConsoleApplication3.Product();
obj.Discontinued = Discontinued;
obj.ProductID = ProductID;
obj.ProductName = ProductName;
obj.QuantityPerUnit = QuantityPerUnit;
obj.ReorderLevel = ReorderLevel;
obj.UnitPrice = UnitPrice;
obj.UnitsInStock = UnitsInStock;
obj.UnitsOnOrder = UnitsOnOrder;
if(Category != null && IncludeChilds)
obj.Category = Category.GetDALObject(false);
if(Order_Details != null && IncludeChilds) {
System.Data.Objects.DataClasses.EntityCollection<ConsoleApplication3.Order_Detail> Order_Detailsgetdallst = new System.Data.Objects.DataClasses.EntityCollection<ConsoleApplication3.Order_Detail>();
Order_Details.ForEach(p=>Order_Detailsgetdallst.Add(p.GetDALObject(false)));
obj.Order_Details = Order_Detailsgetdallst; }
if(Supplier != null && IncludeChilds)
obj.Supplier = Supplier.GetDALObject(false);
return obj;
}
public Boolean Discontinued { get; set; }
public Int32 ProductID { get; set; }
public String ProductName { get; set; }
public String QuantityPerUnit { get; set; }
public Int16? ReorderLevel { get; set; }
public Decimal? UnitPrice { get; set; }
public Int16? UnitsInStock { get; set; }
public Int16? UnitsOnOrder { get; set; }
public DTO.CategoryDTO Category { get; set; }
public List<DTO.Order_DetailDTO> Order_Details { get; set; }
public DTO.SupplierDTO Supplier { get; set; }
}
}