public void GetTransaction() { const string accountName = "Test Account 1"; const string categoryName = "Test Category 1"; const byte categoryType = 1; var service = new MoneyService(); var userService = new UserService(); var userId1 = userService.Register("testUser1" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId1, accountName, 1); var accounts1 = service.GetAllAccounts(userId1); service.CreateCategory(userId1, categoryName, categoryType); var categories = service.GetAllCategories(userId1); service.Deposit(userId1, accounts1[0].Id, DateTime.Now, 25, 10, "Some income comment", categories[0].Id); var transactions = service.GetAllTransactions(userId1, accounts1[0].Id); Assert.Equal(1, transactions.Count); var transaction = service.GetTransaction(userId1, accounts1[0].Id, transactions[0].TransactionId); Assert.NotNull(transaction); Assert.Equal(2, transaction.Postings.Count); Assert.NotNull(transaction.Category); Assert.Equal(categoryName, transaction.Category.Name); Assert.Equal(categoryType, transaction.Category.CategoryType); Assert.NotNull(transaction.Postings[0].Account); Assert.Equal(accountName, transaction.Postings[0].Account.Name); }
static int ScriptDelete2() { var money = MoneyService.Read(new Money() { Currency = "RUB", Amount = 1000, WorkerMoney = 1 }, 1, 0).First(); // Предполагается, что действия до создания модели - это моделирование выбора пользователя var models = OrdersService.Read(new Orders() { MoneyId = money.Id }); DateTime startTime = DateTime.Now; foreach (var model in models) { OrdersService.Delete(model); } DateTime finishTime = DateTime.Now; return((int)(finishTime - startTime).TotalMilliseconds); /*Money model = new Money() { Currency = "RUB", Amount = 1000, WorkerMoney = 1 }; * * DateTime startTime = DateTime.Now; * MoneyService.Delete(model); * DateTime finishTime = DateTime.Now; * * return (int)(finishTime - startTime).TotalMilliseconds;*/ }
public void UpdateTransaction() { var userService = new UserService(); var service = new MoneyService(); var userId = userService.Register("testUser1" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId, "Test Account 1", 1); var accounts = service.GetAllAccounts(userId); service.CreateCategory(userId, "Test Category 1", 1); var categories = service.GetAllCategories(userId); service.Deposit(userId, accounts[0].Id, DateTime.Now, 25, 10, "Some income comment", null); service.Withdrawal(userId, accounts[0].Id, DateTime.Now, 10, 5, "Some expense comment", categories[0].Id); var balance = service.GetAccountBalance(userId, accounts[0].Id); Assert.Equal(200, balance); var transactionRecords = service.GetAllTransactions(userId, accounts[0].Id); var transactionId = transactionRecords[0].TransactionId; Assert.NotNull(transactionRecords); Assert.Equal(2, transactionRecords.Count); service.UpdateTransaction(transactionId, userId, accounts[0].Id, DateTime.Now, 32, 20, "Updated income", categories[0].Id, false); balance = service.GetAccountBalance(userId, accounts[0].Id); Assert.Equal(-690, balance); }
private void button_Click(object sender, RoutedEventArgs e) { var customer = new Customer { Name = textBoxCustomerName.Text, Telephone = textBoxCustomerPhone.Text }; var creditCard = new CreditCard { CardNumber = textBoxCreditCard.Text, Cvc = textBoxSecurityCode.Text, ExpireyDate = DateTime.Parse(textBoxExpireyDate.Text), }; bool success = MoneyService.Charge(customer, creditCard, decimal.Parse(textBoxAmount.Text)); if (success) { SmsService.SendSms("+18184348962", "Payment Successful"); MessageBox.Show("Payment Successful"); } else { SmsService.SendSms("+18184348962", "Payment Unsuccessful"); MessageBox.Show("Payment Unsuccessful"); } }
public void Initialize() { GameObjectsManager.Initialize(); ImageManager.Initialize(); TimeManager.Initialize(); SaveLoadService = new SaveLoadService(); SaveLoadService.Initialize(); ConfigurationService = new ConfigurationService(); ConfigurationService.Initialize(); BuyPriceDictionaryService = new BuyPriceDictionaryService(); BuyPriceDictionaryService.Initialize(); SellPriceDictionaryService = new SellPriceDictionaryService(); SellPriceDictionaryService.Initialize(); // before trade need to know a price TradeService = new TradeService(); TradeService.Initialize(); MoneyService = new MoneyService(); MoneyService.Initialize(); ProducerProductionDictionaryService = new ProducerProductionDictionaryService(); ProducerProductionDictionaryService.Initialize(); // ProductionDurationDictionaryService = new ProductionDurationDictionaryService(); ProductionDurationDictionaryService.Initialize(); SatietyDurationDictionaryService = new SatietyDurationDictionaryService(); SatietyDurationDictionaryService.Initialize(); // before visualize money amount need to know a money amount InventoryService = new InventoryService(); InventoryService.Initialize(); // before visualize inventory items amount need to know a inventory items amount UserInterfaceManager.Initialize(); }
public MoneyController() { var UnitOfWork = new EFUnitOfWork(); _MoneyService = new MoneyService(UnitOfWork); _LogService = new LogService(UnitOfWork); }
public void GetAllAssetTypes() { var service = new MoneyService(); var assets = service.GetAllAssetTypes(); Assert.Equal(4, assets.Count); }
public PayController() { servicePay = new PayService(db); serviceOrder = new OrderService(db); serviceRecharge = new RechargeService(db); serviceUser = new UserService(db); serviceMoney = new MoneyService(db); userTicket = new UserTicketDetailService(db); }
//实例化 public OrderController() { serviceOrder = new OrderService(db); serviceDetail = new OrderDetailService(db); serviceRoom = new RoomService(db); serviceMoney = new MoneyService(db); serviceFlow = new FlowService(db); serviceDiscount = new DiscountService(db); servicePay = new PayService(db); UserTicketDetail = new UserTicketDetailService(db); }
static void Main(string[] args) { CreditCardService creditCardService = new CreditCardService(); MoneyService moneyService = new MoneyService(); BuisnessCardService buisnessCardService = new BuisnessCardService(); creditCardService.GetCreditCard(); moneyService.GetMoney(); buisnessCardService.GetBuisnessCard(); Console.ReadKey(); }
static int ScriptUpdate2() { Money model = MoneyService.Read(new Money() { Currency = "RUB", Amount = 1000, WorkerMoney = 1 }, 1, 0).First(); DateTime startTime = DateTime.Now; MoneyService.Update(model); DateTime finishTime = DateTime.Now; return((int)(finishTime - startTime).TotalMilliseconds); }
static int ScriptInsert2() { Money model = new Money() { Currency = "RUB", Amount = 1000, WorkerMoney = 1 }; DateTime startTime = DateTime.Now; MoneyService.Create(model); DateTime finishTime = DateTime.Now; return((int)(finishTime - startTime).TotalMilliseconds); }
public static IEnumerable <MoneyViewModel> GetFakeData() { var moneyService = new MoneyService(); var query = from d in moneyService.GetAll() select new MoneyViewModel { Category = (MoneyCategory)d.Categoryyy, Total = d.Amounttt, Date = d.Dateee, Description = d.Remarkkk }; return(query); }
public ServiceAccess(Current.GetTicket getTicket, Current.GetUrl getUrl) { var repos = new Repos(getUrl); BaseMove = new BaseMoveSaverService(this, repos); Safe = new SafeService(this, repos); Admin = new AdminService(this, repos); Money = new MoneyService(this, repos); Robot = new RobotService(this, repos); Report = new ReportService(this, repos); Current = new Current(Safe, getTicket); }
public void Withdrawal() { var service = new MoneyService(); var userService = new UserService(); var userId = userService.Register("testUser" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId, "Test Account", 1); var accounts = service.GetAllAccounts(userId); service.CreateCategory(userId, "Test Category", 1); var categories = service.GetAllCategories(userId); service.Withdrawal(userId, accounts[0].Id, DateTime.Now, 13, 10, "Some expense comment", categories[0].Id); }
public void Transfer() { var service = new MoneyService(); var userService = new UserService(); var userId1 = userService.Register("testUser1" + Guid.NewGuid(), "testPassword"); var userId2 = userService.Register("testUser2" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId1, "Test Account 1", 1); service.CreateAccount(userId2, "Test Account 2", 1); var accounts1 = service.GetAllAccounts(userId1); var accounts2 = service.GetAllAccounts(userId2); service.Transfer(userId1, accounts1[0].Id, userId2, accounts2[0].Id, DateTime.Now, 78, "Some transfer comment"); }
public void Deposit() { var service = new MoneyService(); var userService = new UserService(); var userId = userService.Register("testUser" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId, "Test Account", 1); var accounts = service.GetAllAccounts(userId); service.CreateCategory(userId, "Test Category", 1); var categories = service.GetAllCategories(userId); service.Deposit(userId, accounts[0].Id, DateTime.Now, 25, 2, "Some income comment", categories[0].Id); }
public void CreateAccount() { const string expectedAccountName = "Test Account"; var userService = new UserService(); var service = new MoneyService(); var userId = userService.Register("testUser" + Guid.NewGuid(), "testPassword"); int accountId = service.CreateAccount(userId, expectedAccountName, 1); var accounts = service.GetAllAccounts(userId); Assert.Equal(1, accounts.Count); Assert.Equal(expectedAccountName, accounts[0].Name); }
public void DeleteCategory() { var userService = new UserService(); var service = new MoneyService(); var userId = userService.Register("testUser" + Guid.NewGuid(), "testPassword"); service.CreateCategory(userId, "Test Category", 1); var categories = service.GetAllCategories(userId); service.DeleteCategory(userId, categories[0].Id); categories = service.GetAllCategories(userId); Assert.Equal(0, categories.Count); }
public void DeleteAccount() { const string accountName = "Test Account"; var userService = new UserService(); var service = new MoneyService(); var userId = userService.Register("testUser" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId, accountName, 1); var accounts = service.GetAllAccounts(userId); service.DeleteAccount(userId, accounts[0].Id); accounts = service.GetAllAccounts(userId); Assert.Equal(0, accounts.Count); }
public MoneyController() { _mSvc = new MoneyService(); //預先取得類別的下拉選單 _CateList = new List <SelectListItem>() { new SelectListItem() { Text = "", Value = "" } }; _CateList.AddRange(_mSvc.EnumToSelectList <CategoryState>()); }
public List <MyMoneyViewModel> GetData() { MoneyService moneyService = new MoneyService(); var dbQuery = (from data in moneyService.Lookup() select new MyMoneyViewModel { Dateee = data.Dateee, Amounttt = data.Amounttt, Remarkkk = data.Remarkkk, Categoryyy = data.Categoryyy, }); return(dbQuery.ToList()); }
static int ScriptRead1() { Money model = MoneyService.Read(new Money() { Currency = "RUB", Amount = 1000, WorkerMoney = 1 }, 1, 0).First(); DateTime startTime = DateTime.Now; Money models = MoneyService.Read(model, 1, 0).First(); DateTime finishTime = DateTime.Now; Console.WriteLine("{0}: {1} - {2}", models.Id, models.Currency, models.Amount); return((int)(finishTime - startTime).TotalMilliseconds); }
public void GetAllCategories() { const string expectedCategoryName = "Test Category"; const byte expectedNewCategoryType = 1; var userService = new UserService(); var service = new MoneyService(); var userId = userService.Register("testUser" + Guid.NewGuid(), "testPassword"); service.CreateCategory(userId, expectedCategoryName, expectedNewCategoryType); var categories = service.GetAllCategories(userId); Assert.Equal(1, categories.Count); Assert.Equal(expectedCategoryName, categories[0].Name); Assert.Equal(expectedNewCategoryType, categories[0].CategoryType); }
public void OnClientEvent(Client client, string eventName, params object[] arguments) //arguments param can contain multiple params { switch (eventName) { case "KeyboardKey_E_Pressed": if (!client.isInVehicle) { if (client.hasData("player")) { ATM atm = ATMService.ATMList.FirstOrDefault(x => x.Position.DistanceTo(client.position) <= 1); if (atm != null) { OpenATM(client); API.sendChatMessageToPlayer(client, "ATM with ID: ~y~" + atm.Id + " ~w~found"); } } } break; case "ATM_Withdraw": if (MoneyService.HasPlayerEnoughBank(client, Convert.ToDouble(arguments[0]))) { MoneyService.WithdrawMoney(client, Convert.ToDouble(arguments[0])); API.sendNotificationToPlayer(client, "~g~" + arguments[0] + " $~w~ was withdrawn from the account."); API.triggerClientEvent(client, "ATM_CloseMenu"); } else { API.sendNotificationToPlayer(client, "~r~You don't have enough money on your account."); } break; case "ATM_Deposit": if (MoneyService.HasPlayerEnoughCash(client, Convert.ToDouble(arguments[0]))) { MoneyService.DepositMoney(client, Convert.ToDouble(arguments[0])); API.sendNotificationToPlayer(client, "There were ~g~" + arguments[0] + " $~w~ added to your account."); API.triggerClientEvent(client, "ATM_CloseMenu"); } else { API.sendNotificationToPlayer(client, "~r~You don't have enough money at your wallet."); } break; } }
void _runPreinit() { string systemPath_ = HostingEnvironment.MapPath(@"~"); InitService initService_ = __singleton <InitService> ._instance(); initService_._runPreinit(); AccountService accountService_ = __singleton <AccountService> ._instance(); accountService_._runPreinit(); MoneyService moneyService_ = __singleton <MoneyService> ._instance(); moneyService_._runPreinit(); }
public void UpdateAccount() { const string accountName = "Test Account"; const string expectedNewAccountName = "Renamed Account"; const int assetType = 1; const int expectedNewAssetType = 2; var userService = new UserService(); var service = new MoneyService(); var userId = userService.Register("testUser" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId, accountName, assetType); var accounts = service.GetAllAccounts(userId); service.UpdateAccount(userId, accounts[0].Id, expectedNewAccountName, expectedNewAssetType); accounts = service.GetAllAccounts(userId); Assert.Equal(1, accounts.Count); Assert.Equal(expectedNewAccountName, accounts[0].Name); Assert.Equal(expectedNewAssetType, accounts[0].AssetType.Id); }
public void GetAccountBalance() { var service = new MoneyService(); var userService = new UserService(); var userId1 = userService.Register("testUser1" + Guid.NewGuid(), "testPassword"); var userId2 = userService.Register("testUser2" + Guid.NewGuid(), "testPassword"); service.CreateAccount(userId1, "Test Account 1", 1); service.CreateAccount(userId2, "Test Account 2", 1); var accounts1 = service.GetAllAccounts(userId1); var accounts2 = service.GetAllAccounts(userId2); service.CreateCategory(userId1, "Test Category 1", 1); var categories1 = service.GetAllCategories(userId1); service.Deposit(userId1, accounts1[0].Id, DateTime.Now, 25, 10, "Some income comment", null); var balance = service.GetAccountBalance(userId1, accounts1[0].Id); Assert.Equal(250, balance); service.Withdrawal(userId1, accounts1[0].Id, DateTime.Now, 10, 5, "Some expense comment", categories1[0].Id); balance = service.GetAccountBalance(userId1, accounts1[0].Id); Assert.Equal(200, balance); balance = service.GetAccountBalance(userId2, accounts2[0].Id); Assert.Equal(0, balance); service.Transfer(userId1, accounts1[0].Id, userId2, accounts2[0].Id, DateTime.Now, 75, "Some transfer comment"); balance = service.GetAccountBalance(userId1, accounts1[0].Id); Assert.Equal(125, balance); balance = service.GetAccountBalance(userId2, accounts2[0].Id); Assert.Equal(75, balance); }
/// <summary> /// Initializes a new instance of the <see cref="AdminServiceTests"/> class. /// </summary> public AdminServiceTests() { Dispose(); adminService = new AdminService { DefaultFolder = DefaultFolder }; moneyService = new MoneyService { DefaultFolder = DefaultFolder }; string login = "******" + Guid.NewGuid(); moneyService.UserName = login; registrationService = new RegistrationService { DefaultFolder = DefaultFolder }; currentUser = registrationService.Register(login, "testPassword"); }
public HomeController() { var unitOfWork = new EFUnitOfWork(); _MoneyService = new MoneyService(unitOfWork); }