Exemplo n.º 1
0
 private void MergeSpendType(SpendType originalSpendType, SpendTypeRequest SpendType)
 {
     originalSpendType.Consortium  = this.ConsortiumRepository.GetById(SpendType.ConsortiumId);
     originalSpendType.Description = SpendType.Description;
     originalSpendType.Required    = SpendType.Required;
     originalSpendType.Item        = this.SpendItemRepository.GetById(SpendType.SpendItemId);
 }
Exemplo n.º 2
0
 private void Refresh()
 {
     _spendType = _context.spendType;
     _amount    = _spendType == SpendType.TransferToBankCard ? _context.realAmount + _context.serviceAmount : _context.amount;
     if (_spendType == SpendType.ToSelfAssets)
     {
         _payway = AssetsManager.Instance.curUseBankCard != null ? PaywayType.BankCard : PaywayType.None;
     }
     else if (_spendType == SpendType.CanUseAnt && AssetsManager.Instance.curPayway == PaywayType.Ant && AssetsManager.Instance.assetsData.antPay > _amount)
     {
         _payway = PaywayType.Ant;
     }
     else
     {
         _payway = AssetsManager.Instance.SetCurPaywayByMoney(_amount);
     }
     _serviceItem.SetActive(_spendType == SpendType.TransferToBankCard);
     _orderItem.SetActive(_spendType == SpendType.TransferToBankCard);
     if (_spendType == SpendType.TransferToBankCard)
     {
         _orderText.text   = _context.realAmount.ToString("0.00");
         _serviceText.text = _context.serviceAmount.ToString("0.00");
     }
     _amountText.text = _amount.ToString("0.00");
     _infoText.text   = _spendType == SpendType.ToSelfAssets ? ContentHelper.Read(ContentHelper.RechargeText) : ContentHelper.Read(ContentHelper.TransferText);
     _signObj.transform.localPosition = new Vector3(-_amountText.preferredWidth / 2, _signObj.transform.localPosition.y, _signObj.transform.localPosition.z);
     _canPayFlag = _payway != PaywayType.None;
     _useItem.SetActive(_canPayFlag);
     _okTextObj.SetActive(_canPayFlag);
     _canNotPayObj.SetActive(!_canPayFlag);
     _selectTextObj.SetActive(!_canPayFlag);
     _paywayStr        = Utils.FormatPaywayStr(_payway, AssetsManager.Instance.curUseCardId);
     _useItemText.text = _paywayStr;
 }
Exemplo n.º 3
0
        public SpendType CreateSpendType(SpendTypeRequest SpendType)
        {
            var entity = new SpendType();

            this.MergeSpendType(entity, SpendType);
            this.SpendTypeRepository.Insert(entity);


            if (SpendType.ForAll)
            {
                var consortiums = this.ConsortiumRepository.GetAll().Where(x => x.Id != SpendType.ConsortiumId)
                                  .Select(x => x.Id)
                                  .ToList();

                consortiums.ForEach(x =>
                {
                    var nentity = new SpendType();
                    this.MergeSpendType(nentity, SpendType);
                    nentity.Consortium = this.ConsortiumRepository.GetById(x);
                    this.SpendTypeRepository.Insert(nentity);
                });
            }

            return(entity);
        }
Exemplo n.º 4
0
        private void GetByID(Guid id)
        {
            // Act
            SpendType spendType = repo.GetById(id);

            // Assert
            Assert.IsNotNull(spendType.Description, "GetByID returned null.");
            Assert.AreEqual(id, spendType.Id);
            Assert.AreEqual(DESCRIPTION, spendType.Description);
            Assert.AreEqual(LONG_DESCRIPTION, spendType.LongDescription);
        }
Exemplo n.º 5
0
        private void CreateTransactionTypeRows()
        {
            var paymentTypeId = paymentTypeRepository.Add(PAYMENTTYPE_TOADD);
            var fundTypeId    = fundTypeRepository.Add(FUNDTYPE_TOADD);
            var budgetTypeId  = budgetTypeRepository.Add(BUDGETTYPE_TOADD);
            var spendTypeId   = spendTypeRepository.Add(SPENDTYPE_TOADD);

            PAYMENTTYPE = paymentTypeRepository.GetById(paymentTypeId);
            BUDGETTYPE  = budgetTypeRepository.GetById(budgetTypeId);
            FUNDTYPE    = fundTypeRepository.GetById(fundTypeId);
            SPENDTYPE   = spendTypeRepository.GetById(spendTypeId);
        }
Exemplo n.º 6
0
        private void Delete(Guid id)
        {
            // Arrange
            SpendType spendType = repo.GetById(id);

            // Act
            repo.Remove(spendType);
            spendType = repo.GetById(id);

            // Assert
            Assert.IsNull(spendType, "Record is not deleted.");
        }
Exemplo n.º 7
0
 public void Setup()
 {
     payment = Payment.Create(
         (TransactionDescription)"Council Tax",
         DateTime.Parse("03/06/2018"),
         PaymentType.Create("DDR", "Direct Debit").Value,
         210.00,
         BudgetType.Create("CTAX", "Council Tax"),
         SpendType.Create("Revenue", "Revenue"),
         (Note)string.Empty, "",
         FundType.Create("Revenue", "Revenue"));
 }
Exemplo n.º 8
0
 private void InitialiseParameters()
 {
     DATERECIEVED      = new DateTime(2018, 8, 7);
     DESCRIPTION       = (TransactionDescription)"Builder and Sons";
     AMOUNT            = 520.00;
     PAYMENTTYPE_TOADD = PaymentType.Create("CHQ", "Cheque").Value;
     BUDGETTYPE_TOADD  = BudgetType.Create("Building", "Building Maintenance");
     FUNDTYPE_TOADD    = FundType.Create("Building", "Building Fund");
     SPENDTYPE_TOADD   = SpendType.Create("Capital", "Capital");
     NOTE         = (Note)string.Empty;
     BANKCLEARED  = false;
     CHEQUENUMBER = "000123";
 }
Exemplo n.º 9
0
        private Guid Create()
        {
            //Arrange
            SpendType spendType = SpendType.Create(DESCRIPTION, LONG_DESCRIPTION);

            //Act
            spendType.Id = repo.Add(spendType);

            //Assert
            Assert.AreNotEqual(0, spendType.Id, "Creating new record does not return id");

            return(spendType.Id);
        }
Exemplo n.º 10
0
        private void Update(Guid id)
        {
            // Arrange
            SpendType spendType = repo.GetById(id);

            spendType.LongDescription = "Test Change";

            // Act
            repo.Update(spendType);

            SpendType updatedSpendType = repo.GetById(id);

            // Assert
            Assert.AreEqual("Test Change", updatedSpendType.LongDescription, "Record is not updated.");
        }
Exemplo n.º 11
0
 public SpendType UpdateSpendType(SpendType originalSpend, SpendTypeRequest Spend)
 {
     this.MergeSpendType(originalSpend, Spend);
     SpendTypeRepository.Update(originalSpend);
     return(originalSpend);
 }
Exemplo n.º 12
0
 public Expenditure(DateTime dateTime, Decimal amount, SpendType spendType)
 {
     this.dateTime  = dateTime;
     this.amount    = amount;
     this.spendType = spendType;
 }
Exemplo n.º 13
0
 public SelectPayWayContext(double amount, SpendType spendType) : base(UIType.SelectPayWay)
 {
     this.amount    = amount;
     this.spendType = spendType;
 }