Esempio n. 1
0
 public static Demand AsDemand(IDemandOrProvider demandOrProvider)
 {
     if (demandOrProvider.GetType() == typeof(ProductionOrderBom))
     {
         return((ProductionOrderBom)demandOrProvider);
     }
     else if (demandOrProvider.GetType() == typeof(StockExchangeDemand))
     {
         return((StockExchangeDemand)demandOrProvider);
     }
     else if (demandOrProvider.GetType() == typeof(CustomerOrderPart))
     {
         return((CustomerOrderPart)demandOrProvider);
     }
     else
     {
         throw new MrpRunException("Unknown type implementing Demand");
     }
 }
 public static Provider AsProvider(IDemandOrProvider demandOrProvider)
 {
     if (demandOrProvider.GetType() == typeof(ProductionOrder))
     {
         return((ProductionOrder)demandOrProvider);
     }
     else if (demandOrProvider.GetType() == typeof(PurchaseOrderPart))
     {
         return((PurchaseOrderPart)demandOrProvider);
     }
     else if (demandOrProvider.GetType() == typeof(StockExchangeProvider))
     {
         return((StockExchangeProvider)demandOrProvider);
     }
     else
     {
         throw new MrpRunException("Unknown type implementing Provider");
     }
 }