Пример #1
0
 public ProductEntity(Product Product, params object[] args) : base(Product)
 {
     foreach (object arg in args)
     {
         if (arg is Category Category)
         {
             CategoryEntity = new CategoryEntity(Category);
         }
         if (arg is Manufacturer Manufacturer)
         {
             ManufacturerEntity = new ManufacturerEntity(Manufacturer);
         }
         if (arg is ICollection <Discount> Discounts)
         {
             DiscountEntities = Discounts.Select(model => new DiscountEntity(model)).ToList();
         }
         if (arg is ICollection <Inventory> Inventories)
         {
             InventoryEntities = Inventories.Select(model => new InventoryEntity(model, model.WareHouse)).ToList();
         }
         if (arg is ICollection <IssueNoteLine> IssueNoteLines)
         {
             IssueNoteLineEntities = IssueNoteLines.Select(model => new IssueNoteLineEntity(model, model.IssueNote)).ToList();
         }
         if (arg is ICollection <Pack> Packs)
         {
             PackEntities = Packs.Select(model => new PackEntity(model)).ToList();
         }
         if (arg is ICollection <ProductPicture> ProductPictures)
         {
             ProductPictureEntities = ProductPictures.Select(model => new ProductPictureEntity(model)).ToList();
         }
         if (arg is ICollection <ProductValue> ProductValues)
         {
             ProductValueEntities = ProductValues.Select(model => new ProductValueEntity(model, model.Attribute, model.Language)).ToList();
         }
         if (arg is ICollection <ReceiptNoteLine> ReceiptNoteLines)
         {
             ReceiptNoteLineEntities = ReceiptNoteLines.Select(model => new ReceiptNoteLineEntity(model, model.ReceiptNote)).ToList();
         }
     }
 }
 public ReceiptNoteEntity(ReceiptNote ReceiptNote, params object[] args) : base(ReceiptNote)
 {
     foreach (object arg in args)
     {
         if (arg is Employee Employee)
         {
             EmployeeEntity = new EmployeeEntity(Employee);
         }
         if (arg is Supplier Supplier)
         {
             SupplierEntity = new SupplierEntity(Supplier);
         }
         if (arg is WareHouse WareHouse)
         {
             WareHouseEntity = new WareHouseEntity(WareHouse);
         }
         if (arg is ICollection <ReceiptNoteLine> ReceiptNoteLines)
         {
             ReceiptNoteLineEntities = ReceiptNoteLines.Select(model => new ReceiptNoteLineEntity(model, model.Product)).ToList();
         }
     }
 }