public override ComplaintDecision CreateNew() { ComplaintDocumentLine parent = (ComplaintDocumentLine)this.Parent; //create new object and attach it to the element ComplaintDecision line = new ComplaintDecision(parent); line.Order = this.Children.Count + 1; //add object to the collection this.Children.Add(line); return(line); }
private void RealizeDecisions(ComplaintDocument document) { var decisionsToRealize = from line in document.Lines.Children from decision in line.ComplaintDecisions.Children where decision.IsMarkedForRealization() select decision; this.CheckForNecessaryShifts(document, decisionsToRealize); List <WarehouseDocument> generatedWhDocs = new List <WarehouseDocument>(); List <ComplaintDecision> realizedDecisions = new List <ComplaintDecision>(); foreach (var decision in decisionsToRealize) { if (decision.DecisionType == DecisionType.Disposal) { this.AddPositionToWarehouseDocument(document, decision.WarehouseId.Value, generatedWhDocs, decision.ReplacementItemId, decision.Quantity, decision.ReplacementUnitId, WarehouseDirection.Outcome); } else if (decision.DecisionType == DecisionType.ReturnToSupplier) { this.AddPositionToWarehouseDocument(document, decision.WarehouseId.Value, generatedWhDocs, decision.ReplacementItemId, decision.Quantity, decision.ReplacementUnitId, WarehouseDirection.Outcome); ComplaintDocumentLine line = (ComplaintDocumentLine)decision.Parent; this.AddPositionToWarehouseDocument(document, ProcessManager.Instance.GetComplaintWarehouse(document), generatedWhDocs, line.ItemId, decision.Quantity, line.UnitId, WarehouseDirection.Income); } realizedDecisions.Add(decision); } foreach (var decision in realizedDecisions) { decision.RealizeOption = RealizationStage.Realized; } this.ValuateInternalIncomes(generatedWhDocs); }
public ComplaintDecisions(ComplaintDocumentLine parent) : base(parent, "complaintDecision") { }