protected void _AddCommandLineItemCommandToExecute(UnderBankingItem lineItem) { if (lineItem == null) return; var li = new ReCollectionCommand(); li.Amount = lineItem.Amount; li.CommandCreatedDateTime = DateTime.Now; li.CommandGeneratedByCostCentreApplicationId = CostCentreApplicationId; li.CommandGeneratedByCostCentreId = CostCentreId; li.CommandId = Guid.NewGuid(); li.DocumentId =lineItem.Id; li.Description = lineItem.Description; li.DocumentRecipientCostCentreId = RecepientCostCentreId; li.FromCostCentreId = lineItem.FromCostCentreId; li.PDCommandId = Id; _AddCommand(li); }
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(); } } }
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); }
public void AddLineItem(UnderBankingItem item) { _AddCommandLineItemCommandToExecute(item); }
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); }
private UnderBankingItem Map(tblRecollection s) { if (s == null) return null; var reco = new UnderBankingItem(s.Id) { FromCostCentreId = s.CostCentreId, Description = s.Description, Amount = s.Amount, _DateCreated = s.IM_DateCreated, _DateLastUpdated = s.IM_DateLastUpdated, TotalReceivedAmount = s.tblRecollectionItem.Sum(o=>o.Amount), }; return reco; }