// Add new or Update public int SaveFinanceManagerAsync(FinanceManager financeManager) { if (financeManager.Id != 0) { return(database.Update(financeManager)); } else { return(database.Insert(financeManager)); } }
public ActionResult Docs() { var mng = new DocsManager(); var finMng = new FinanceManager(); ViewBag.DocTypes = mng.GetDocTypes(); ViewBag.DocStatuses = mng.GetDocStatuses(); ViewBag.FinProjects = finMng.GetProjects().OrderBy(x => x.name).ToList(); ViewBag.FinContragents = finMng.GetFinContragents().OrderBy(x => x.name).ToList(); return(View()); }
public void StartWaves() { waveNumber = 0; currentPhase = WaveManagerPhase.Rest; Debug.Log("Start waves"); if (gameStartEvent != null) { gameStartEvent.Invoke(Waves.Length); } FinanceManager.AddCoin(startMoney); StartCoroutine("WaveQueueRoutine"); }
public void CreditPayment_InvalidTest() { FinanceManager financeManager = new FinanceManager(); FinantialDB.Accounts.Clear(); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); IAccount account = FinantialDB.Accounts.Values.ToList()[0]; double oldCredit = account.CreditPayment; Assert.Throws <KeyNotFoundException>(() => financeManager.CreditPayment(Guid.NewGuid(), 100)); }
public void Initialize(Actor elevator, FinanceManager financeManager, int shaftsAmount) { elevator.AddNode(elevatorCollectNode); BuyShaftUI.FinanceManager = financeManager; UpgradeActorUI.FinanceManager = financeManager; UpgradeActorUI.ShaftManager = ShaftManager; if (ShaftManager.MaxShafts <= shaftsAmount) { BuyShaftUI.gameObject.SetActive(false); } }
private void UpdateManagers() { cityManager = this.gameObject.GetComponent <CityManager>(); environmentManager = this.gameObject.GetComponent <EnvironmentManager>(); financeManager = this.gameObject.GetComponent <FinanceManager>(); legislationManager = this.gameObject.GetComponent <LegislationManager>(); popularityManager = this.gameObject.GetComponent <PopularityManager>(); powerPlantManager = this.gameObject.GetComponent <PowerPlantManager>(); researchDevelopmentManager = this.gameObject.GetComponent <ResearchDevelopmentManager>(); resourceManager = this.gameObject.GetComponent <ResourceManager>(); management = true; ++count; }
private IEnumerator GoToDaddy() { float time = Time.time; coinPosition = transform.position; while (Time.time - time < timeToMove) { transform.position = VectorLerp(coinPosition, playerPosition, (Time.time - time) / timeToMove); yield return(null); } FinanceManager.AddCoin(coinValue); Destroy(gameObject); }
private void Awake() { if (singleton != null && singleton != this) { Destroy(gameObject); return; } else { singleton = this; DontDestroyOnLoad(gameObject); } }
private void UpdateManagers() { cityManager = this.gameObject.GetComponent<CityManager>(); environmentManager = this.gameObject.GetComponent<EnvironmentManager>(); financeManager = this.gameObject.GetComponent<FinanceManager>(); legislationManager = this.gameObject.GetComponent<LegislationManager>(); popularityManager = this.gameObject.GetComponent<PopularityManager>(); powerPlantManager = this.gameObject.GetComponent<PowerPlantManager>(); researchDevelopmentManager = this.gameObject.GetComponent<ResearchDevelopmentManager>(); resourceManager = this.gameObject.GetComponent<ResourceManager>(); management = true; ++count; }
public void CreditPayment_ValidTest() { FinanceManager financeManager = new FinanceManager(); FinantialDB.Accounts.Clear(); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); IAccount account = FinantialDB.Accounts.Values.ToList()[0]; double oldCredit = account.CreditPayment; financeManager.CreditPayment(account.ID, 100); Assert.IsTrue(account.CreditPayment == oldCredit - 100 * 1.05); }
public void AddFunds_InvalidTestClientDb(double amount) { IFinanceManager financeManager = new FinanceManager(); IClientManager clientManager = new ClientManager(financeManager, new EmailSenderMock()); financeManager.CreateAccount("6345634563456", new Bank(), 1500, 0, true); var account = FinantialDB.Accounts.Values.ToList()[0]; IClient client = new PravnoLice("dasdfasdf", "r34f324f", "Novi Sad", "*****@*****.**", DateTime.Now, new List <IAccount>()); ICurrency currency = FinantialDB.Currency["EUR"]; double oldAmount = account.CreditPayment; Assert.Throws <KeyNotFoundException>(() => clientManager.AddFunds(client, account.ID, amount, currency), "Account not found in clients database."); }
// GET: Finances public ActionResult Index() { var mng = new FinanceManager(); var mng_hr = new HRManager(); var mng_crm = new CRMManager(); ViewBag.contragentName = mng.GetFinContragents(); ViewBag.typeName = mng.GetFinTypes(); ViewBag.projectName = mng.GetProjects(); ViewBag.statusName = mng.GetFinStatuses(); ViewBag.hrName = mng_hr.GetHumans(); ViewBag.crmName = mng_crm.GetClients(); return(View()); }
public void CreateTransaction_InvalidCompanyID() { IEmailSender emailSender = Substitute.For <IEmailSender>(); IFinanceManager financeManager = new FinanceManager(); IClientManager clientManager = new ClientManager(); ISalesManager salesManager = new SalesManager(); clientManager.RegisterUser("Pera", "Peric", "*****@*****.**", "peraPeric123", "Novi Sad", new DateTime(1992, 5, 6), new List <IAccount>()); IClient client = ShoppingClient.Clients[0]; ITransactionManager transactionManager = new TransactionManager(clientManager, salesManager, financeManager, emailSender); Assert.Throws <KeyNotFoundException>(() => transactionManager.CreateTransaction(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), 5), "Company does not exists in database."); }
public void GetAccountById_InvalidTest() { FinanceManager financeManager = new FinanceManager(); FinantialDB.Accounts.Clear(); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); Guid targetId = FinantialDB.Accounts.Values.ToList()[0].ID; Assert.Throws <KeyNotFoundException>(() => financeManager.GetAccountByID(Guid.NewGuid())); }
public void CreateTransaction_InvalidOfferID() { IEmailSender emailSender = Substitute.For <IEmailSender>(); IFinanceManager financeManager = new FinanceManager(); IClientManager clientManager = new ClientManager(); ISalesManager salesManager = new SalesManager(); clientManager.RegisterUser("Pera", "Peric", "*****@*****.**", "peraPeric123", "Novi Sad", new DateTime(1992, 5, 6), new List <IAccount>()); clientManager.RegisterOrg("Prodavnica", "q234ffsad", "Novi Sad", "*****@*****.**", new DateTime(2010, 1, 1), new List <IAccount>()); IClient client = ShoppingClient.Clients.FirstOrDefault(x => x is FizickoLice); IClient company = ShoppingClient.Clients.FirstOrDefault(x => x is PravnoLice); ITransactionManager transactionManager = new TransactionManager(clientManager, salesManager, financeManager, emailSender); Assert.Throws <KeyNotFoundException>(() => transactionManager.CreateTransaction(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), 5), "Offer does not exists in database."); }
void Awake() { stubList = new Transform[stubManager.transform.childCount]; towerList = new List <Transform>(); for (int i = 0; i < stubManager.transform.childCount; i++) { Transform stub = stubManager.transform.GetChild(i); stub.GetComponent <Stub>().ID = i; stubList[i] = stub; } CannonBallFactory.getInstance().initCannonBallItem(CannonBallItem); fm = FinanceManager.getInstance(); data = GameData.getInstance(); }
public IHttpActionResult UpdateRates() { var externalService = new ApiService(); var manager = new FinanceManager(_bankService, externalService); try { manager.UpdateCurrencyRates(); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok("Rates Updated")); }
public void CalculateNpvReturnsCorrectValue2() { //Arrange var initialInvestment = 500; var cashFlows = new List <double> { 1200, 2300 }; var discountRate = 1.75; var financeManager = new FinanceManager(); //Act var netPresentValue = financeManager.CalculateNetPresentValue(initialInvestment, discountRate, cashFlows); //Asset Assert.AreEqual(2900.93, netPresentValue); }
public MainWindow() { InitializeComponent(); // Set Sources _tickets = TicketManager.GetTickets(); TicketListView.ItemsSource = _tickets; _finances = FinanceManager.GetFinances(); FinancesListView.ItemsSource = _finances; _businesses = CustomerManager.GetCustomers(); BussinessListView.ItemsSource = _businesses; _techs = TechnicianManager.GetTechnicians(); TechListView.ItemsSource = _techs; }
public void GetAccountById_ValidTest() { FinanceManager financeManager = new FinanceManager(); FinantialDB.Accounts.Clear(); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); Guid targetId = FinantialDB.Accounts.Values.ToList()[0].ID; IAccount account = financeManager.GetAccountByID(targetId); Assert.IsTrue(account.ID == targetId); }
public void AddFunds_ValidTestFizickoLiceKredit(double amount) { IFinanceManager financeManager = new FinanceManager(); IClientManager clientManager = new ClientManager(financeManager, new EmailSenderMock()); financeManager.CreateAccount("6345634563456", new Bank(), 1500, 0, true); var account = FinantialDB.Accounts.Values.ToList()[0]; IClient client = new PravnoLice("dasdfasdf", "r34f324f", "Novi Sad", "*****@*****.**", DateTime.Now, new List <IAccount>() { account }); ICurrency currency = FinantialDB.Currency["EUR"]; double oldAmount = account.CreditPayment; clientManager.AddFunds(client, account.ID, amount, currency); Assert.IsTrue(oldAmount > account.CreditPayment); }
// Update is called once per frame void Update() { float dist = navMesh.remainingDistance; if (dist != Mathf.Infinity && navMesh.pathStatus == NavMeshPathStatus.PathComplete & dist < targetDistance) { // Finish if (FinanceManager.TryWithdrawal(banishCost)) { LogTurretDamage(); WaveManager.CreeperDies(); } else { WaveManager.Defeat(); } Destroy(gameObject); } }
public ActionResult Contragents_remove(int id) { var res = false; var mng = new FinanceManager(); var item = mng.GetFinContragent(id); var msg = ""; if (item != null) { res = mng.DeleteFinContragent(id); msg = res ? "Контрагент удален!" : "Чтобы удалить данного контрагента, вначале необходимо удалить все его транзакции"; } return(Json(new { result = res, msg })); }
public AssetEntrysController() { _organizationManager = new OrganizationManager(); _branchManager = new BranchManager(); _assetLocationManager = new AssetLocationManager(); _assetTypeManager = new AssetTypeManager(); _assetGroupManager = new AssetGroupManager(); _assetManufacturerManager = new AssetManufacturerManager(); _assetModelManager = new AssetModelManager(); _assetEntryManager = new AssetEntryManager(); _financeManager = new FinanceManager(); _serviceOrRepairingManager = new ServiceOrRepairingManager(); _noteManager = new NoteManager(); _attachmentManager = new AttachmentManager(); _vendorManager = new VendorManager(); }
private void btnLogin_Click(object sender, EventArgs e) { try { UserType usertype = User.Login(txtUsername.Text, txtPassword.Text); if (usertype == UserType.Undefined) { throw new NullReferenceException(); } object user = null; Form home = null; switch (usertype) { case UserType.Admin: user = new Admin(txtUsername.Text, txtPassword.Text); home = new AdminHome((Admin)user); break; case UserType.FinanceManager: user = new FinanceManager(txtUsername.Text, txtPassword.Text); home = new FinanceManagerHome((FinanceManager)user); break; case UserType.ClientManager: user = new ClaimManager(txtUsername.Text, txtPassword.Text); home = new ClaimManagerHome((ClaimManager)user); break; case UserType.Client: user = new Client(txtUsername.Text, txtPassword.Text); home = new ClientHome((Client)user); break; } Hide(); home.ShowDialog(); txtPassword.Text = string.Empty; Show(); } catch (NullReferenceException ex) { MessageBox.Show("Incorrect username or password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void CreateTransaction_ValidTest(int year, int month, int day, int rating, string transcationTypeKey) { IEmailSender emailSender = Substitute.For <IEmailSender>(); IFinanceManager financeManager = new FinanceManager(); IClientManager clientManager = new ClientManager(); ISalesManager salesManager = new SalesManager(); ShoppingClient.Clients.Clear(); ShoppingOffers.Offers.Clear(); clientManager.RegisterUser("Pera", "Peric", "*****@*****.**", "peraPeric123", "Novi Sad", new DateTime(1992, 5, 6), new List <IAccount>()); clientManager.RegisterOrg("Prodavnica", "q234ffsad", "Novi Sad", "*****@*****.**", new DateTime(2010, 1, 1), new List <IAccount>()); IClient client = ShoppingClient.Clients.FirstOrDefault(x => x is FizickoLice); IClient company = ShoppingClient.Clients.FirstOrDefault(x => x is PravnoLice); IProduct product = new Product("Product", "Description", 3000, 1); salesManager.CreateOffer(company, new List <IProduct>() { product }, new List <ITransport>()); financeManager.CreateAccount("41234123453425", new Bank(), 100000, 0, false); financeManager.CreateAccount("456345634567456", new Bank(), 100000, 0, false); IAccount customerAccount = FinantialDB.Accounts.Values.ToList()[0]; IAccount companyAccount = FinantialDB.Accounts.Values.ToList()[1]; client.ListOfAccounts.Add(customerAccount); customerAccount.Balance = 1000000; company.ListOfAccounts.Add(companyAccount); companyAccount.Balance = 2000000; IOffer offer = ShoppingOffers.Offers.Values.ToList()[0]; offer.SubmitionDate = new DateTime(year, month, day); ITransactionManager transactionManager = new TransactionManager(clientManager, salesManager, financeManager, emailSender); ITransactionType transactionType = ShoppingTransaction.TransactionTypes[transcationTypeKey]; transactionManager.CreateTransaction(client.ID, company.ID, offer.ID, transactionType.ID, rating); Assert.IsTrue(client.ListOfBuyingTransaction.Count == 1); Assert.IsTrue(company.ListOfSellingTransaction.Count == 1); }
public ActionResult Finances_remove(int id) { var res = false; var mng = new FinanceManager(); var item = mng.GetFinFinance(id); var msg = ""; if (item != null) { mng.DeleteFinFinance(id); msg = "Транзакция удалена!"; res = true; } return(Json(new { result = res, msg = msg })); }
public void AddFunds_ValidTestFizickoLiceRacun(double amount) { IFinanceManager financeManager = new FinanceManager(); IClientManager clientManager = new ClientManager(financeManager, new EmailSenderMock()); FinantialDB.Accounts.Clear(); financeManager.CreateAccount("6345634563456", new Bank(), 1500, 0, false); var account = FinantialDB.Accounts.Values.ToList()[0]; IClient client = new FizickoLice("Marko", "Markovic", "*****@*****.**", "marko123", DateTime.Now, "Novi Sad", new List <IAccount>() { account }); ICurrency currency = FinantialDB.Currency["EUR"]; double oldAmount = account.Balance; clientManager.AddFunds(client, account.ID, amount, currency); Assert.AreEqual(oldAmount + amount * currency.Value, account.Balance); }
public static void Victory() { //Gather all coins left GameObject[] coins; coins = GameObject.FindGameObjectsWithTag("Coin"); foreach (GameObject coin in coins) { coin.GetComponent <Coin> ().FastGather(); } //FIXME add small delay for balance accounting, playing coin gather sfx, anything else. //fill it with fireworks, for example. //Output balance Debug.Log("Victory. Balance: " + FinanceManager.GetBalance()); instance.StopAllCoroutines(); instance.currentPhase = WaveManagerPhase.StopGame; if (instance.gameEndedEvent != null) { instance.gameEndedEvent.Invoke(); } }
public void CheckBalance_ValidTest() { FinanceManager financeManager = new FinanceManager(); FinantialDB.Accounts.Clear(); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true); IAccount account = FinantialDB.Accounts.Values.ToList()[0]; account.Balance = 500; double balance = account.Balance; double balance2 = financeManager.CheckBalance(account.ID); Assert.AreEqual(balance, balance2); }
private void ConfirmOweButton_Click(object sender, RoutedEventArgs e) { if (Utility.TextHasNoData(this.CompanyBox) || Utility.TextHasNoData(this.HowMuchTextBox) || Utility.TextHasNoData(this.WhyMoneyOwedTextBox) || Customer == null) { MessageBox.Show("Input all fields"); return; } // Create the finance and upload it Finance finance = new Finance { FinanceCustomer = Customer, FinanceOwe = HowMuchTextBox.Text, FinanceDescription = WhyMoneyOwedTextBox.Text }; FinanceManager.AddFinance(finance); (new MainWindow()).Show(); this.Close(); }