public void SubmitChanges(CommodityReceptionNote document)
        {
            int sequence = 0;
            var envelope = new CommandEnvelope();
            envelope.Initialize(document);
            
            List<DocumentCommand> commandsToExecute = document.GetDocumentCommandsToExecute();

            CreateCommand createCommand = commandsToExecute.OfType<CreateCommand>().FirstOrDefault();
            if (createCommand != null)
                envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, createCommand));
               // _commandRouter.RouteDocumentCommand(createCommand);
            List<AfterCreateCommand> lineItemCommands = commandsToExecute.OfType<AfterCreateCommand>().ToList();
            foreach (var item in lineItemCommands)
            {
                envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, item));

                //_commandRouter.RouteDocumentCommand(item);
            }
            List<StoredCommodityReceptionLineItemCommand> stored = commandsToExecute.OfType<StoredCommodityReceptionLineItemCommand>().ToList();
            foreach (var item in stored)
            {
                envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, item));

                //_commandRouter.RouteDocumentCommand(item);
            }
            ConfirmCommodityReceptionCommand confirmCommand = commandsToExecute.OfType<ConfirmCommodityReceptionCommand>().FirstOrDefault();
            if (confirmCommand != null)
                //_commandRouter.RouteDocumentCommand(confirmCommand);
                envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, confirmCommand));
            _commandEnvelopeRouter.RouteCommandEnvelope(envelope);


        }
        private SourcingDocument Map(tblSourcingDocument tbldoc)
        {
            SourcingDocument doc = null;
            doc = new CommodityReceptionNote(tbldoc.Id);
            doc.DisableAddCommands();
            CommodityReceptionNote receptionNote = doc as CommodityReceptionNote;
            receptionNote._SetLineItems(tbldoc.tblSourcingLineItem.Select(MapCommodityReceptionLineItem).ToList());
            doc = receptionNote;
            _Map(tbldoc, doc);
            doc.EnableAddCommands();
            return doc;

        }
Exemplo n.º 3
0
        private void ViewSelectedItem(CommodityReceptionNote document)
        {
            const string uri = "/views/CommodityReception/DocumentDetails.xaml";
            string thisUrl = "/views/CommodityReception/StoreCommodity.xaml";
            Messenger.Default.Send<DocumentDetailMessage>(new DocumentDetailMessage { Id = document.Id, DocumentType = DocumentType.CommodityReceptionNote, MessageSourceUrl = thisUrl });

            NavigateCommand.Execute(uri);

            //Go=>todo:we need to close this window,view details,..then on back=return here...?
            this.RequestClose(this, EventArgs.Empty);
        }