internal Content(Entities entities, BatchMaterialXml[] xml, xml.erp.BatchStatus batchStatus, ProgressChangedEventHandler progressChanged) : base(GetBatchStatus(batchStatus)) { foreach (BatchMaterialXml item in xml) { Entities.ProductDescription _product = entities.GetProductType(item.Material, item.Stor__Loc, item.IsFinishedGood); Material _newMaterial = new Material(entities, _product, item.Batch, item.Material, item.Stor__Loc, item.Material_description, item.Unit, item.Quantity, item.Quantity_calculated, item.material_group); _newMaterial.GetListOfIPRAccounts(entities); progressChanged(this, new ProgressChangedEventArgs(1, String.Format("SKU={0}", _newMaterial.SKU))); Add(_newMaterial); } if (Product == null) { throw new InputDataValidationException("Unrecognized finished good", "Product", "Wrong Batch XML message", true); } }
private static BatchStatus GetBatchStatus(xml.erp.BatchStatus batchStatus) { BatchStatus _status = default(BatchStatus); switch (batchStatus) { case xml.erp.BatchStatus.Final: _status = BatchStatus.Final; break; case xml.erp.BatchStatus.Intermediate: _status = BatchStatus.Intermediate; break; case xml.erp.BatchStatus.Progress: _status = BatchStatus.Progress; break; } return(_status); }