コード例 #1
0
 public void SubmitChanges(ReCollection document)
 {
     int sequence = 0;
     var envelope = new CommandEnvelope();
     envelope.Id = Guid.NewGuid();
     envelope.EnvelopeGeneratedTick = DateTime.Now.Ticks;
     envelope.GeneratedByCostCentreId = document.CostCentreId;
     envelope.RecipientCostCentreId = document.RecepientCostCentreId;
     envelope.DocumentTypeId = (int)DocumentType.RecollectionNote;
     envelope.GeneratedByCostCentreApplicationId = document.CostCentreApplicationId;
     envelope.ParentDocumentId = document.Id;
     envelope.DocumentId = document.Id;
     List<DocumentCommand> commandsToExecute = document.GetRecollectionCommandsToExecute();
     var lineItemCommands = commandsToExecute.OfType<ReCollectionCommand>();
     foreach (var _item in lineItemCommands)
     {
         
             envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, _item));
     }
     _commandEnvelopeRouter.RouteCommandEnvelope(envelope);
 }
コード例 #2
0
        private void ConfirmCollection(UnderBankingCollectionItemViewModel item)
        {
            using (var container = NestedContainer)
            {
                if (item != null)
                {
                    var wf = Using<IReCollectionWFManager>(container);
                    var config = Using<IConfigService>(container).Load();
                    ReCollection doc = new ReCollection(item.Id);
                    doc.CostCentreId = config.CostCentreId;
                    doc.CostCentreApplicationId = config.CostCentreApplicationId;
                    doc.RecepientCostCentreId = config.CostCentreId;
                    doc.Id = Id;
                    UnderBankingItem sItem = new UnderBankingItem(item.Id);
                    sItem.FromCostCentreId = config.CostCentreId;
                    doc.ConfirmLineItem(sItem);
                    wf.SubmitChanges(doc);
                    MessageBox.Show("Received Underbanking Saved successfully");
                    Load();

                }
            }
        }
コード例 #3
0
        private void Save()
        {
            try
            {


                decimal allocatedamount = LineItems.Sum(s => s.Amount);
                if (allocatedamount != TotalUnderbankingAmout)
                {
                    MessageBox.Show("Please make sure the whole amount is allocated");
                    return;
                }
                using (var container = NestedContainer)
                {
                    var wf = Using<IReCollectionWFManager>(container);
                    var config = Using<IConfigService>(container).Load();
                    ReCollection doc = new ReCollection(Guid.NewGuid());
                    doc.CostCentreId = Salesman.Id;
                    doc.CostCentreApplicationId = config.CostCentreApplicationId;
                    doc.RecepientCostCentreId = config.CostCentreId;
                    foreach (var i in LineItems)
                    {
                        UnderBankingItem item = new UnderBankingItem(Guid.NewGuid());
                        item.Amount = i.Amount;
                        item.Description = i.Description;
                        item.FromCostCentreId = i.CostCentre.Id;
                        doc.AddLineItem(item);
                    }
                    wf.SubmitChanges(doc);
                    MessageBox.Show("Under banking Saved successfully");
                }
            }catch(Exception ex)
            {
                MessageBox.Show("ERROR "+ex.Message);
                return;
            }

            Status = true;
            RequestClose(this, EventArgs.Empty);
        }
コード例 #4
0
ファイル: DataViewer.xaml.cs プロジェクト: asanyaga/BuildTest
 private static void TestReCollectionCommand()
 {
     var wf = ObjectFactory.GetInstance<IReCollectionWFManager>();
     var cost = ObjectFactory.GetInstance<ICostCentreRepository>().GetAll().First();
     var config = ObjectFactory.GetInstance<IConfigService>().Load();
     ReCollection doc = new ReCollection(Guid.NewGuid() );
     doc.CostCentreId = cost.Id;
     doc.CostCentreApplicationId = config.CostCentreApplicationId;
     UnderBankingItem item= new UnderBankingItem(Guid.NewGuid());
     item.Amount = 200;
     item.FromCostCentreId = cost.Id;
     doc.AddLineItem(item);
     wf.SubmitChanges(doc);
 }