Пример #1
0
 public CashAsset GetCashAssetDomainModelWithoutAccount(CashAssetViewModel cashAssetViewModel)
 {
     var cashAsset = new CashAsset();
     cashAsset.Id = cashAssetViewModel.Id;
     cashAsset.Name = cashAssetViewModel.Name.Trim();
     cashAsset.Amount = cashAssetViewModel.Amount;
     cashAsset.Unit = cashAssetViewModel.Unit;
     cashAsset.Cost = cashAssetViewModel.Cost;
     cashAsset.Currency = cashAssetViewModel.Currency;
     cashAsset.inCash = cashAssetViewModel.inCash;
     return cashAsset;
 }
Пример #2
0
 public void UpdateCashAsset(CashAsset cashAsset)
 {
     var targetAsset = GetCashAsset(cashAsset.Id);
     targetAsset.Name = cashAsset.Name;
     targetAsset.Amount = cashAsset.Amount;
     targetAsset.Unit = cashAsset.Unit;
     targetAsset.Cost = cashAsset.Cost;
     targetAsset.Currency = cashAsset.Currency;
     targetAsset.inCash = cashAsset.inCash;
     targetAsset.Account = cashAsset.Account;
     context.SaveChanges();
 }
Пример #3
0
 public CashAssetViewModel GetCashAssetViewModel(CashAsset cashAsset)
 {
     var cashAssetViewModel = new CashAssetViewModel();
     cashAssetViewModel.Id = cashAsset.Id;
     cashAssetViewModel.Name = cashAsset.Name;
     cashAssetViewModel.Amount = cashAsset.Amount;
     cashAssetViewModel.Unit = cashAsset.Unit;
     cashAssetViewModel.Cost = cashAsset.Cost;
     cashAssetViewModel.Currency = cashAsset.Currency;
     cashAssetViewModel.inCash = cashAsset.inCash;
     cashAssetViewModel.BankId = (cashAsset.Account == null) ? 0 : cashAsset.Account.Bank.Id;
     cashAssetViewModel.NumberAccount = (cashAsset.Account == null) ? 0 : cashAsset.Account.Number;
     cashAssetViewModel.Status = (cashAsset.inCash) ? "В кассе" : "Банк - " + cashAsset.Account.Bank.ToString() +  ", номер счета - " + cashAsset.Account.Number;
     return cashAssetViewModel;
 }
Пример #4
0
 internal void FriendCashAssetRemoveCashAsset(CashAsset cashAsset)
 {
     assets.Remove(cashAsset);
 }
Пример #5
0
 internal void FriendCashAssetAddCashAsset(CashAsset cashAsset)
 {
     assets.Add(cashAsset);
 }
Пример #6
0
 public void RemoveCashAsset(CashAsset cashAsset)
 {
     cashAsset.RemoveBankAccount();
 }
Пример #7
0
 public void AddCashAsset(CashAsset cashAsset)
 {
     cashAsset.SetBankAccount(this);
 }
Пример #8
0
        public void InitializeStorage()
        {
            Bank firstFakeBank = new Bank("ПервыйФэйкБанк");
            BankAccount firstFakeAccount = new BankAccount(firstFakeBank);
            BankAccount secondFakeAccount = new BankAccount(firstFakeBank);
            Bank secondFakeBank = new Bank("ВторойФэйкБанк");
            BankAccount thirdFakeAccount = new BankAccount(secondFakeBank);
            Bank thirdFakeBank = new Bank("ТретийФэйкБанк");
            BankAccount fourthFakeAccount = new BankAccount(thirdFakeBank);
            BankAccount fifthFakeAccount = new BankAccount(thirdFakeBank);
            BankAccount sixthFakeAccount = new BankAccount(thirdFakeBank);
            BankAccount seventhFakeAccount = new BankAccount(thirdFakeBank);

            Banks.Add(firstFakeBank);
            Banks.Add(secondFakeBank);
            Banks.Add(thirdFakeBank);

            CashAsset firstCashAsset = new CashAsset { Name = "Денежные средства", Cost = 103400, Currency = "рубль" };
            CashAsset secondCashAsset = new CashAsset { Name = "Обогащенный уран", Amount = 130, Unit = "тонна", Cost = 15000, Currency = "евро" };
            CashAsset thirdCashAsset = new CashAsset { Name = "Красные мороженки", Amount = 6575, Unit = "штука", Cost = 150, Currency = "рубль" };
            CashAsset fourthCashAsset = new CashAsset { Name = "Денежные средства", Cost = 100400, Currency = "доллар" };
            CashAsset fifthCashAsset = new CashAsset { Name = "Хрюши", Amount = 57234, Unit = "штука", Cost = 345, Currency = "рубль" };
            CashAsset sixthCashAsset = new CashAsset { Name = "Пиратский алкоголь", Amount = 48345, Unit = "литр", Cost = 456367, Currency = "евро" };
            CashAsset seventhCashAsset = new CashAsset { Name = "Денежные средства", Cost = 10101, Currency = "юань" };
            CashAsset eightCashAsset = new CashAsset { Name = "Денежные средства", Cost = 1000, Currency = "рубль" };
            CashAsset ninthCashAsset = new CashAsset { Name = "Хлам", Amount = 3467, Unit = "килограмм", Cost = 1000, Currency = "евро" };
            CashAsset tenthCashAsset = new CashAsset { Name = "Влажные салфетки", Amount = 5678, Unit = "штука", Cost = 1000, Currency = "юань" };

            CashAssets.Add(firstCashAsset);
            CashAssets.Add(secondCashAsset);
            CashAssets.Add(thirdCashAsset);
            CashAssets.Add(fourthCashAsset);
            CashAssets.Add(fifthCashAsset);
            CashAssets.Add(sixthCashAsset);
            CashAssets.Add(seventhCashAsset);
            CashAssets.Add(eightCashAsset);
            CashAssets.Add(ninthCashAsset);
            CashAssets.Add(tenthCashAsset);

            firstCashAsset.SetBankAccount(firstFakeAccount);
            seventhCashAsset.SetBankAccount(secondFakeAccount);
            eightCashAsset.SetBankAccount(secondFakeAccount);
            tenthCashAsset.SetBankAccount(thirdFakeAccount);
            sixthCashAsset.SetBankAccount(thirdFakeAccount);
            ninthCashAsset.SetBankAccount(secondFakeAccount);
            tenthCashAsset.SetBankAccount(seventhFakeAccount);

            NonmonetaryAsset firstNonmonetaryAsset = new NonmonetaryAsset { Name = "Торговое здание", StartBalanceValue = 30000, ResidualBalanceValue = 5000, EstimatedValue = 10000000, Currency = "рубль", Description = "Здание по адресу улица 101010, дом 10100" };
            NonmonetaryAsset secondNonmonetaryAsset = new NonmonetaryAsset { Name = "Катышки", Amount = 345, Unit = "килограмм", StartBalanceValue = 300, ResidualBalanceValue = 50, EstimatedValue = 1000, Currency = "евро", Description = "Обычные катышки с одежды" };
            NonmonetaryAsset thirdNonmonetaryAsset = new NonmonetaryAsset { Name = "Гвозди", Amount = 111, Unit = "Тонна",  StartBalanceValue = 780, ResidualBalanceValue = 123, EstimatedValue = 10345, Currency = "рубль", Description = "Гвозди гвозди гвозди" };
            NonmonetaryAsset fourthNonmonetaryAsset = new NonmonetaryAsset { Name = "Воздух", StartBalanceValue = 30000, ResidualBalanceValue = 5000, EstimatedValue = 10000000, Currency = "рубль", Description = "Чистый воздух" };
            NonmonetaryAsset fifthNonmonetaryAsset = new NonmonetaryAsset { Name = "Торговое здание", StartBalanceValue = 56000, ResidualBalanceValue = 5345, EstimatedValue = 1685733, Currency = "доллар", Description = "Здание по адресу улица бла бла, дом бла" };

            NonmonetaryAssets.Add(firstNonmonetaryAsset);
            NonmonetaryAssets.Add(secondNonmonetaryAsset);
            NonmonetaryAssets.Add(thirdNonmonetaryAsset);
            NonmonetaryAssets.Add(fourthNonmonetaryAsset);
            NonmonetaryAssets.Add(fifthNonmonetaryAsset);

            SaveChanges();
        }
Пример #9
0
 public void CreateCashAsset(CashAsset cashAsset)
 {
     context.CashAssets.Add(cashAsset);
     context.SaveChanges();
 }