예제 #1
0
        public void TestTrackableCollection_Move(bool track)
        {
            var acc  = new Accumulator("test");
            var a    = new Simple("a");
            var b    = new Simple("b");
            var c    = new Simple("c");
            var coll = new TrackableCollection <Simple>(acc, track)
            {
                a, b, c, b, c, b, b
            };

            coll.SafeMove(0, 3);
            Assert.AreEqual(2, coll.IndexOf(a));
            coll.SafeMove(3, 3);

            coll.SafeMove(1, 40); // should result in an Add

            coll.Clear();
            coll.Add(a);
            coll.SafeMove(0, 0);
            coll.SafeMove(0, 1);
            coll.Clear();
            coll.SafeMove(0, 0);

            if (track)
            {
                Assert.AreEqual(13, acc.Records.Count);
            }
            else
            {
                Assert.AreEqual(0, acc.Records.Count);
            }
        }
        public void Add(Accumulator scope, ScopeState state)
        {
            switch (state)
            {
            case ScopeState.Do:
                _redoables.Clear();
                _undoables.Push(scope);
                break;

            case ScopeState.Undo:
                _undoables.Push(scope);
                break;

            case ScopeState.Redo:
                _redoables.Push(scope);
                break;
            }
        }
예제 #3
0
 public virtual void Rebuild()
 {
     lock (SyncRoot)
         lock (coins)
         {
             coins.Clear();
             coins.Commit();
             current_height = 0;
         }
 }
예제 #4
0
        public void TestTrackableCollection_First_Empty()
        {
            var a    = new Simple("a");
            var b    = new Simple("b");
            var c    = new Simple("c");
            var coll = new TrackableCollection <Simple>()
            {
                a, b, c, b, c, b, b
            };

            coll.Clear();
            coll.First();
        }
예제 #5
0
        public void TestTrackableCollection_Last_Empty()
        {
            var a    = new Simple("a");
            var b    = new Simple("b");
            var c    = new Simple("c");
            var coll = new TrackableCollection <Simple>()
            {
                a, b, c, b, c, b, b
            };
            var last = coll.Last();

            Assert.AreEqual(b, last);
            coll.Clear();
            coll.Last();
        }
예제 #6
0
        public void TestTrackableCollection_Any()
        {
            var a    = new Simple("a");
            var b    = new Simple("b");
            var c    = new Simple("c");
            var coll = new TrackableCollection <Simple>()
            {
                a, b, c, b, c, b, b
            };

            Assert.IsTrue(coll.Any());
            Assert.IsFalse(coll.Any(i => i.Value == "d"));
            Assert.IsTrue(coll.Any(i => i.Value == "b"));
            coll.Clear();
            Assert.IsFalse(coll.Any());
            Assert.IsFalse(coll.Any(i => i.Value == "d"));
        }
예제 #7
0
        public void TestTrackableCollection_Clear(bool track)
        {
            var acc  = new Accumulator("test");
            var coll = new TrackableCollection <Simple>(acc, track)
            {
                new Simple("a"), new Simple("b"), new Simple("c")
            };

            Assert.AreEqual(3, coll.Count);
            coll.Clear();
            Assert.AreEqual(0, coll.Count);

            if (track)
            {
                Assert.AreEqual(4, acc.Records.Count);
            }
            else
            {
                Assert.AreEqual(0, acc.Records.Count);
            }
        }
예제 #8
0
        public void TestTrackableCollection_LastOrDefault(bool track)
        {
            var acc  = new Accumulator("test");
            var a    = new Simple("a");
            var b    = new Simple("b");
            var c    = new Simple("c");
            var coll = new TrackableCollection <Simple>(acc, track)
            {
                a, b, c, b, c, b, b
            };
            var last = coll.LastOrDefault();

            Assert.AreEqual(b, last);
            coll.Clear();
            last = coll.LastOrDefault();
            Assert.IsNull(last);

            var coll2 = new TrackableCollection <int>(acc, track)
            {
                -1, 1, 2
            };
            var f = coll2.LastOrDefault();

            Assert.AreEqual(2, f);
            coll2.Clear();
            f = coll2.LastOrDefault();
            Assert.AreEqual(default(int), f);

            if (track)
            {
                Assert.AreEqual(12, acc.Records.Count);
            }
            else
            {
                Assert.AreEqual(0, acc.Records.Count);
            }
        }
예제 #9
0
        public void Initialize()
        {
            _isPresentAmountCanEdit = true;
            using (var businessPartnerService = SvcClientManager.GetSvcClient<BusinessPartnerServiceClient>(SvcType.BusinessPartnerSvc))
            {
                List<BusinessPartner> list = businessPartnerService.GetInternalCustomersByUser(CurrentUser.Id);
                if (list.Count > 0)
                {
                    _idList = list.Select(c => c.Id).ToList();
                }

                _applicants = businessPartnerService.GetInternalCustomersByUser(CurrentUser.Id);
                _applicants.Insert(0, new BusinessPartner ());
            }

            _deliveries = new TrackableCollection<Delivery>();
            _showCommercialInvoiceLines = new TrackableCollection<CommercialInvoice>();
            BindCboList();

            if (ObjectId > 0)
            {
                LoadAttachments();
                using (
                    var letterOfCreditService =
                        SvcClientManager.GetSvcClient<LetterOfCreditServiceClient>(SvcType.LetterOfCreditSvc))
                {
                    const string strInfo = "it.Id = @p1 ";
                    var parameters = new List<object> {ObjectId};
                    LetterOfCredit letterOfCredit =
                        letterOfCreditService.Select(strInfo, parameters,
                                                     new List<string>
                                                         {
                                                             "Quota",
                                                             "Quota.Currency",
                                                             "BusinessPartner",
                                                             "BusinessPartner1",
                                                             "Currency",
                                                             "Deliveries",
                                                              "LCCIRels.CommercialInvoice"
                                                         }).FirstOrDefault();
                    if (letterOfCredit != null)
                    {
                        _amount = letterOfCredit.IssueAmount;
                        _lcNo = letterOfCredit.LCNo;
                        _lcType = letterOfCredit.LCType;
                        _lcStatusId = letterOfCredit.LCStatus;
                        _applicantId = letterOfCredit.ApplicantId;
                        _beneficiaryId = letterOfCredit.BeneficiaryId;
                        _beneficiaryName = letterOfCredit.BusinessPartner1.ShortName;
                        _currencyName = letterOfCredit.Currency.Name;
                        _currencyId = letterOfCredit.CurrencyId;
                        _lcDays = letterOfCredit.LCDays;
                        _promptBasisId = letterOfCredit.PromptBasis;
                        _advisingBankId = letterOfCredit.AdvisingBankId;
                        _issueBankId = letterOfCredit.IssueBankId;
                        _issueDate = letterOfCredit.IssueDate;
                        _issueQuantity = letterOfCredit.IssueQuantity;
                        _acceptanceExpiryDate = letterOfCredit.AcceptanceExpiryDate;
                        _lcExpiryDate = letterOfCredit.LCExpiryDate;
                        _latestShippmentDate = letterOfCredit.LatestShippmentDate;
                        _actualAcceptanceDate = letterOfCredit.ActualAcceptanceDate;
                        _presentAmount = letterOfCredit.PresentAmount;
                        _presentDate = letterOfCredit.PresentDate;
                        _comment = letterOfCredit.Comment;
                        _iborType = letterOfCredit.IBORType;
                        _financeStatus = letterOfCredit.FinancialStatus ? 1 : 0;
                        _iborValue = letterOfCredit.IBORValue;
                        _float = letterOfCredit.Float;
                        _interest = letterOfCredit.Interest;
                        _quotaNo = letterOfCredit.Quota == null ? "" : letterOfCredit.Quota.QuotaNo;
                        _selectedQuotaId = letterOfCredit.QuotaId;
                        _deliveries = letterOfCredit.Deliveries;
                        _paymentRequestId = letterOfCredit.PaymentRequestId;
                        if (letterOfCredit.Quota != null)
                        {
                            _IsLCFinished = letterOfCredit.Quota.IsFundflowFinished ?? true;
                        }
                        FilterDeleted(letterOfCredit.LCCIRels);

                        if (letterOfCredit.LCCIRels != null && letterOfCredit.LCCIRels.Count > 0)
                        {
                            _isPresentAmountCanEdit = false;
                            _showCommercialInvoiceLines.Clear();
                            foreach (var rel in letterOfCredit.LCCIRels)
                            {
                                _showCommercialInvoiceLines.Add(rel.CommercialInvoice);
                            }
                        }
                    }
                }
            }
            else
            {
                LCStatusId = (int)DBEntity.EnumEntity.LCStatus.Issued;
            }

            PropertyChanged += LetterOfCreditDetailVMPropertyChanged;
        }
 /// <summary>
 /// Clears all undo's and redo's
 /// </summary>
 public void Reset()
 {
     _undoables.Clear();
     _redoables.Clear();
 }