private void MapFiltered()
        {
            var mapper = new ApPmtDistnMapper((XPObjectSpace)ObjectSpace);

            var batchController = Frame.GetController <BatchDeleteListViewController>();

            if (batchController != null)
            {
                var criteria = batchController.ActiveFilterCriteria;
                var filtered = batchController.ActiveFilterEnabled;

                if (Object.ReferenceEquals(null, criteria) || !filtered)
                {
                    var message = new Xafology.ExpressApp.SystemModule.GenericMessageBox(
                        "Filter is empty. Do you wish to continue mapping the ENTIRE table?",
                        "Warning",
                        (sender, svp) => mapper.Process(criteria),
                        (sender, svp) => { return; });
                }
                else
                {
                    mapper.Process(criteria);
                }
            }
        }
        private void MapSelected()
        {
            var mapper = new ApPmtDistnMapper((XPObjectSpace)ObjectSpace);
            var objs   = View.SelectedObjects;

            mapper.Process(objs);
        }
Exemplo n.º 3
0
        public void MapCounterpartyExpr()
        {
            #region Arrange

            string vendorName = "Tech Mahindra Business Services Limited";

            var cp1 = ObjectSpace.CreateObject <Counterparty>();
            cp1.Name = vendorName;

            var cp2 = ObjectSpace.CreateObject <Counterparty>();
            cp2.Name = "AGGREGATE";

            var pmt = ObjectSpace.CreateObject <ApPmtDistn>();
            pmt.PaymentDate      = new DateTime(2017, 07, 15);
            pmt.Vendor           = ObjectSpace.CreateObject <ApVendor>();
            pmt.Vendor.Name      = vendorName;
            pmt.GlAccount        = "222010";
            pmt.PaymentAmountAud = 256000;
            pmt.PaymentAmountFx  = 256000;

            var map1 = ObjectSpace.CreateObject <ApPmtDistnMapping>();
            map1.CriteriaExpression = "GlAccount = '222010'";
            map1.CounterpartyExpr   = "Vendor.Name";

            var map2 = ObjectSpace.CreateObject <ApPmtDistnMapping>();
            map2.CriteriaExpression = "ELSE";
            map2.Counterparty       = cp2;

            var map3 = ObjectSpace.CreateObject <ApPmtDistnMapping>();
            map3.CriteriaExpression = "VendorPaymentAmountAud > 50000";
            map3.CounterpartyExpr   = "Vendor.Name";

            ObjectSpace.CommitChanges();

            #endregion

            #region Act

            var mapper = new ApPmtDistnMapper(ObjectSpace);
            mapper.Process(pmt);

            ObjectSpace.CommitChanges();

            #endregion

            #region Assert

            ObjectSpace.Refresh();
            pmt = ObjectSpace.FindObject <ApPmtDistn>(null);
            Assert.NotNull(pmt.Counterparty);
            Assert.AreEqual(vendorName, pmt.Counterparty.Name);

            #endregion
        }