public double GetCurrentQuote(string username) { if (ServerDB.UsernameExists(username)) { return(QUOTE); } return(0.0); }
static void Tests() { // Initialize the quote ServerDB.InitQuote(10); // Update Quote ServerDB.UpdateQuote(5); if (ServerDB.GetQuote() != 5) { Console.WriteLine("Test Failed"); } ServerDB.UpdateQuote(10); if (ServerDB.GetQuote() != 10) { Console.WriteLine("Test Failed"); } // Register Users ServerDB.Register("uDavid", "David", "pass1"); ServerDB.Register("uEdu", "Edu", "pass2"); ServerDB.Register("uEdu", "x", "pass2"); ServerDB.Register("uEdu", "Edu", "x"); // Login if (ServerDB.Login("uEdu", "pass2") != "Edu") { Console.WriteLine("Test Failed"); } if (ServerDB.Login("x", "pass2") != null) { Console.WriteLine("Test Failed"); } if (ServerDB.Login("uEdu", "x") != null) { Console.WriteLine("Test Failed"); } // Order List <int> diginotes = new List <int>(); diginotes = ServerDB.InsertPurchaseOrder("uEdu", 6); diginotes = ServerDB.InsertSellingOrder("uDavid", 2); diginotes = ServerDB.InsertSellingOrder("uDavid", 2); diginotes = ServerDB.InsertSellingOrder("uDavid", 2); diginotes = ServerDB.InsertSellingOrder("uEdu", 6); diginotes = ServerDB.InsertPurchaseOrder("uDavid", 2); diginotes = ServerDB.InsertPurchaseOrder("uDavid", 2); diginotes = ServerDB.InsertPurchaseOrder("uDavid", 2); }
public DiginoteSystem() { if (!ServerDB.InitQuote(QUOTE)) { QUOTE = ServerDB.GetQuote(); } ServerDB.NewDBTransaction += HandleNewDBTransactionHandler; Console.WriteLine("Starting System with quote: " + QUOTE); Console.WriteLine("DiginoteSystem constructor called."); }
public List <SellOrder> GetPendingSellOrders(string username) { return(ServerDB.GetSellingOrders(username)); }
public List <Diginote> GetDiginotes(string username) { return(ServerDB.GetDiginotes(username)); }
public List <int> SellOrders(string username, int quantity) { return(ServerDB.InsertSellingOrder(username, quantity)); }
public List <int> PurchaseOrders(string username, int quantity) { return(ServerDB.InsertPurchaseOrder(username, quantity)); }
public string Login(string username, string password) { return(ServerDB.Login(username, password)); }
public string Register(string username, string nickname, string password) { return(ServerDB.Register(username, nickname, password)); }
// Setter for the static value of QUOTE that triggers the event private void SetQuote(double value) { QUOTE = value; ServerDB.UpdateQuote(QUOTE); UpdateQuote.Invoke(QUOTE); }
public void UnsuspendOrders(string username) { ServerDB.UnsuspendOrders(username); }
public void DeletePurchaseOrder(PurchaseOrder order) { ServerDB.DeletePurchaseOrder(order); }
public void DeleteSellOrder(SellOrder order) { ServerDB.DeleteSellingOrder(order); }
public List <Transaction> GetRecentTransactions() { return(ServerDB.GetTransactions(25)); }
public List <Transaction> GetTransactions(string username) { return(ServerDB.GetTransactions(username)); }
public List <PurchaseOrder> GetPendingPurchaseOrders(string username) { return(ServerDB.GetPurchaseOrders(username)); }