示例#1
0
        public static CashOnVault CreateCOV(int curId,decimal amount, int closedBy, DateTime date, bool isActive)
        {
            var activeCov = GetActiveVault(curId);
            if (activeCov != null)
                activeCov.IsActive = false;

            CashOnVault cov = new CashOnVault();
            cov.CurrencyId = curId;
            cov.Amount = amount;
            cov.ClosedByPartyRoleId = closedBy;
            cov.TransitionDateTime = date;
            cov.IsActive = isActive;

            Context.CashOnVaults.AddObject(cov);
            return cov;
        }
示例#2
0
 public COVHistoryModel(CashOnVault vault)
 {
     this.Amount = vault.Amount;
     this.ClosedBy = Person.GetPersonFullName(vault.ClosedByPartyRoleId);
     this.DateClosed = vault.TransitionDateTime;
     this.Id = vault.Id;
 }
        protected void btnSaveToCashOnVault_DirectClick(object sender, DirectEventArgs e)
        {
            var currencyId = int.Parse(cmbCurrency.SelectedItem.Value);
            var phCurrencyId = Currency.GetCurrencyBySymbol("PHP").Id;
            var currentCashOnVault = ObjectContext.CashOnVaults.SingleOrDefault(entity => entity.IsActive == true && entity.CurrencyId == currencyId);
            if(currentCashOnVault != null)
                currentCashOnVault.IsActive = false;

            CashOnVault newCashOnVault = new CashOnVault();
            if (currencyId == phCurrencyId)
                newCashOnVault.Amount = decimal.Parse(txtTotalCashSummary.Text);
            else
                newCashOnVault.Amount = decimal.Parse(txtTotalCash.Text);
            newCashOnVault.TransitionDateTime = DateTime.Now;
            newCashOnVault.IsActive = true;
            newCashOnVault.CurrencyId = currencyId;
            newCashOnVault.ClosedByPartyRoleId = UserAccount.GetAssociatedEmployee(this.LoginInfo.UserId).PartyRoleId;
            //newCashOnVault.ProcessedByPartyRoleId = UserAccount.GetAssociatedEmployee(this.LoginInfo.UserId).PartyRoleId;

            ObjectContext.CashOnVaults.AddObject(newCashOnVault);
            ObjectContext.SaveChanges();

            btnSaveToCashOnVault.Disabled = true;
        }