public frmCategoryEdit(ref StockEngine se) { sEngine = se; AllowScaling = false; lbListOfCodes = new CListBox(); lbListOfCodes.Location = new Point(10, 10); lbListOfCodes.BorderStyle = BorderStyle.None; lbListOfCodes.Size = new Size((this.Width / 3) - 30, this.Height - 200); this.Controls.Add(lbListOfCodes); lbListOfCategories = new CListBox(); lbListOfCategories.Location = new Point(lbListOfCodes.Left + lbListOfCodes.Width, 10); lbListOfCategories.BorderStyle = BorderStyle.None; lbListOfCategories.Size = new Size((this.Width / 2) - 30, this.Height - 200); this.Controls.Add(lbListOfCategories); AddMessage("INST1", "Insert key to add a category, Enter to edit the selected one, Esc to exit.", new Point(10, BelowLastControl)); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.StartPosition = FormStartPosition.CenterScreen; this.Size = new Size(815, 640); ListAllCategories(); lbListOfCodes.Focus(); lbListOfCodes.KeyDown += new KeyEventHandler(lbListOfCodes_KeyDown); lbListOfCodes.SelectedIndexChanged += new EventHandler(lbListOfCodes_SelectedIndexChanged); lbListOfCodes.SelectedIndex = 0; this.Text = "Category Edit"; }
public frmNewBatchEditOptions(ref StockEngine se) { sEngine = se; this.AllowScaling = false; this.Size = new Size(550, 150); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; AddInputControl("SHOPCODE", "Shop Code :", new Point(10, 20), 300, "Enter the Shop Code, F5 for a list"); InputTextBox("SHOPCODE").GotFocus += new EventHandler(ShopCodeGotFoucs); AddInputControl("SUPCODE", "Supplier Code :", new Point(10, BelowLastControl), 300, "Press F5 for a list of suppliers"); InputTextBox("SUPCODE").MaxCharCount = 6; InputTextBox("SUPCODE").KeyDown += new KeyEventHandler(SupCodeKeyDown); InputTextBox("SUPCODE").AutoCompleteMode = AutoCompleteMode.Append; InputTextBox("SUPCODE").AutoCompleteSource = AutoCompleteSource.CustomSource; InputTextBox("SUPCODE").AutoCompleteCustomSource.AddRange(sEngine.GetListOfSuppliers()); AddInputControl("CAT", "Category :", new Point(10, BelowLastControl), 300, "Press F5 to select a category"); InputTextBox("CAT").KeyDown += new KeyEventHandler(CatKeyDown); for (int i = 0; i < ibArray.Length; i++) { ibArray[i].tbInput.KeyDown += new KeyEventHandler(tbKeyDown); } AlignInputTextBoxes(); this.Text = "Batch Edit Options"; }
public Security GetSecurity(string symbol) { using (DataContext) { var sec = DataContext.Securities.SingleOrDefault(s => s.Symbol == symbol); if (sec == null) { var engine = new StockEngine(); sec = engine.GetSecurityQuotes(symbol).FirstOrDefault(); DataContext.Securities.Add(sec); var opStatus = Save(sec); if (!opStatus.Status) { sec = new Stock { Company = "Error getting quote." }; } } if (sec is Stock) { sec.DataPoints = new DataSimulator().GetDataPoints(sec.Last); } return(sec); } }
public frmCatGroupAddEdit(ref StockEngine se) { sEngine = se; AddMessage("INST", "Insert to add a category group, Shift & Delete to delete a category group. Enter to edit the category group with the same keys.", new Point(10, 10)); lbListOfCatGroups = new CListBox(); lbListOfCatGroups.Location = new Point(10, BelowLastControl); lbListOfCatGroups.Size = new Size(500, this.Height - 60); lbListOfCatGroups.SelectedIndexChanged += new EventHandler(lbListOfCatGroups_SelectedIndexChanged); lbListOfCatGroups.KeyDown += new KeyEventHandler(lbListOfCatGroups_KeyDown); this.Controls.Add(lbListOfCatGroups); lbListOfCatsInGroup = new CListBox(); lbListOfCatsInGroup.Location = new Point(520, lbListOfCatGroups.Top); lbListOfCatsInGroup.KeyDown += new KeyEventHandler(lbListOfCatsInGroup_KeyDown); lbListOfCatsInGroup.Size = new Size(500, this.Height - 60); this.Controls.Add(lbListOfCatsInGroup); string[] sItems = sEngine.GetListOfCategoryGroupNames(); lbListOfCatGroups.Items.AddRange(sItems); lbListOfCatGroups.SelectedIndex = 0; this.WindowState = FormWindowState.Maximized; this.Text = "Add / Edit Category Groups"; }
/*public bool OnlyShowOwedCommissioners * { * get * { * return bShowingOnlyOwed; * } * set * { * lbCode.Items.Clear(); * lbName.Items.Clear(); * string[] sCodes = sEngine.GetListOfCommissioners(); * for (int i = 0; i < sCodes.Length; i++) * { * if ((sEngine.GetCommissionerAmountOwed(sCodes[i]) != 0 && value) || !value) * { * lbCode.Items.Add(sCodes[i]); * lbName.Items.Add(sEngine.GetCommissionerName(sCodes[i])); * } * } * * if (lbCode.Items.Count > 0) * lbCode.SelectedIndex = 0; * } * }*/ public frmListOfCommissioners(ref StockEngine se) { sEngine = se; this.AllowScaling = false; this.Size = new Size(280, 300); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; AddMessage("INST", "Press Insert to add or edit a commissioner.", new Point(10, 10)); lbCode = new CListBox(); lbCode.Location = new Point(10, BelowLastControl); lbCode.Size = new Size(60, this.Height - 65); lbCode.BorderStyle = BorderStyle.None; lbCode.KeyDown += new KeyEventHandler(lbKeyDown); lbCode.SelectedIndexChanged += new EventHandler(lbSelChanged); this.Controls.Add(lbCode); lbName = new CListBox(); lbName.Location = new Point(lbCode.Left + lbCode.Width, lbCode.Top); lbName.Size = new Size(200, this.Height - 65); lbName.BorderStyle = BorderStyle.None; lbName.KeyDown += new KeyEventHandler(lbKeyDown); lbName.SelectedIndexChanged += new EventHandler(lbSelChanged); this.Controls.Add(lbName); LoadCommissioners(); this.Text = "Select a Commissioner"; }
public frmOrderSetup(ref StockEngine se) { sEngine = se; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.AllowScaling = false; this.Size = new System.Drawing.Size(800, 400); this.VisibleChanged += new EventHandler(frmOrderSetup_VisibleChanged); this.KeyDown += new KeyEventHandler(frmOrderSetup_KeyDown); AddMessage("INST", "Please enter header information about the order here :", new Point(10, 20)); AddInputControl("SHOPCODE", "Shop Code :", new Point(10, BelowLastControl), 250); InputTextBox("SHOPCODE").GotFocus += new EventHandler(ShopCodeGotFocus); AddInputControl("ORDERNUM", "Order Number :", new Point(10, BelowLastControl), 250, "Previous order was number " + sEngine.LastOrderNumber.ToString() + ", press F5 (or double click in the box) for a list of orders"); InputTextBox("ORDERNUM").Text = (sEngine.LastOrderNumber + 1).ToString(); InputTextBox("ORDERNUM").DoubleClick += new EventHandler(frmOrderSetupOrderNum_DoubleClick); InputTextBox("ORDERNUM").KeyDown += new KeyEventHandler(OrderNumKeyDown); AddInputControl("SUPCODE", "Supplier Code :", new Point(10, BelowLastControl), 250, "Press F5 (or double click in the box) to select a supplier."); InputTextBox("SUPCODE").KeyDown += new KeyEventHandler(SupCodeKeyDown); InputTextBox("SUPCODE").GotFocus += new EventHandler(SupCodeGotFocus); InputTextBox("SUPCODE").AutoCompleteMode = AutoCompleteMode.Append; InputTextBox("SUPCODE").AutoCompleteSource = AutoCompleteSource.CustomSource; InputTextBox("SUPCODE").AutoCompleteCustomSource.AddRange(sEngine.GetListOfSuppliers()); InputTextBox("SUPCODE").DoubleClick += new EventHandler(SupplierCodeDoubleClick); AddInputControl("SUPREF", "Supplier Ref:", new Point(10, BelowLastControl), 250, "Enter the reference number for this order that the supplier uses"); AddInputControl("NOTES", "Notes :", new Point(10, BelowLastControl), 350, "Any notes about the order"); AddInputControl("REQ", "Is this a requisition order?", new Point(10, BelowLastControl), 250, "Y/N"); InputTextBox("REQ").Text = "N"; InputTextBox("REQ").GotFocus += new EventHandler(ReqGotFocus); AddInputControl("DUE", "Due Date :", new Point(10, BelowLastControl), 250, "The expected delivery date of this order"); InputTextBox("DUE").KeyDown += new KeyEventHandler(DueKeyDown); DateTime dtNow = DateTime.Now; dtNow = dtNow.AddDays(7); string sDay = dtNow.Day.ToString(); while (sDay.Length < 2) { sDay = "0" + sDay; } string sMonth = dtNow.Month.ToString(); while (sMonth.Length < 2) { sMonth = "0" + sMonth; } string sYear = dtNow.Year.ToString()[2].ToString() + dtNow.Year.ToString()[3].ToString(); InputTextBox("DUE").Text = sDay + sMonth + sYear; AddMessage("RAISED", "Date Raised : " + sEngine.GetDDMMYYDate(), new Point(10, BelowLastControl)); this.Text = "Order Setup"; bOK = new Button(); bOK.Size = new Size(100, 40); bOK.Location = new Point(10, this.ClientSize.Height - 10 - bOK.Top - bOK.Height); bOK.Text = "OK"; bOK.Click += new EventHandler(bOK_Click); this.Controls.Add(bOK); this.AlignInputTextBoxes(); }
public frmOffersReceptDesigner(string sBarcode, ref StockEngine sEngine) { InitializeComponent(); this.sBarcode = sBarcode; this.sEngine = sEngine; textBox1.Text = sEngine.LoadOffersReceipt(sBarcode); }
/// <summary> /// Initialises the form /// </summary> /// <param name="se">The stockengine to use</param> /// <param name="bReceiving">True if receiving, false if returning</param> public frmReceiveComissionItem(ref StockEngine se, bool bReceiving) { this.bReceiving = bReceiving; sEngine = se; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.Size = new Size(750, 140); if (bReceiving) { AddInputControl("SHOPCODE", "Shop Code : ", new Point(10, 10), 300, "Enter the code of the shop to receive the item to"); InputTextBox("SHOPCODE").GotFocus += new EventHandler(ShopCodeGotFocus); AddInputControl("BARCODE", "Item's Barcode : ", new Point(10, BelowLastControl), 300, "Enter the barcode of the comission item to receive. Press F5 to search."); InputTextBox("BARCODE").KeyDown += new KeyEventHandler(BarcodeKeyDown); AddInputControl("QTY", "Quantity Receiving : ", new Point(10, BelowLastControl), 300, "Enter the quantity of this item to receive"); InputTextBox("QTY").KeyDown += new KeyEventHandler(QtyKeyDown); this.Text = "Receive A Commission Item"; } else { AddInputControl("SHOPCODE", "Shop Code : ", new Point(10, 10), 300, "Enter the code of the shop that the item is being returned from"); InputTextBox("SHOPCODE").GotFocus += new EventHandler(ShopCodeGotFocus); AddInputControl("BARCODE", "Item's Barcode : ", new Point(10, BelowLastControl), 300, "Enter the barcode of the comission item to return. Press F5 to search"); InputTextBox("BARCODE").KeyDown += new KeyEventHandler(BarcodeKeyDown); AddInputControl("QTY", "Quantity Returning : ", new Point(10, BelowLastControl), 300, "Enter the quantity of this item to return"); InputTextBox("QTY").KeyDown += new KeyEventHandler(QtyKeyDown); this.Text = "Return A Commission Item"; } AlignInputTextBoxes(); }
public void SaveToDatabase_And_LoadFromDatabase() { // Arrange StockEngine engine = GetEngine(); List <Quote> stocks = new List <Quote>(); Quote stock1 = new Quote("SYM1") { Id = Guid.NewGuid(), LastTradePrice = 1.50m, }; Quote stock2 = new Quote("SYM2") { Id = Guid.NewGuid(), LastTradePrice = 2.50m }; stocks.Add(stock1); stocks.Add(stock2); // Act engine.InsertQuotes(stocks); List <Quote> stocksFromDb = engine.AllQuotes().ToList(); // Assert Assert.That(stocksFromDb.Count, Is.EqualTo(2)); Assert.That(stocksFromDb[0].Id, Is.EqualTo(stock1.Id)); Assert.That(stocksFromDb[0].LastTradePrice, Is.EqualTo(stock1.LastTradePrice)); Assert.That(stocksFromDb[0].Symbol, Is.EqualTo(stock1.Symbol)); Assert.That(stocksFromDb[1].Id, Is.EqualTo(stock2.Id)); Assert.That(stocksFromDb[1].LastTradePrice, Is.EqualTo(stock2.LastTradePrice)); Assert.That(stocksFromDb[1].Symbol, Is.EqualTo(stock2.Symbol)); }
void frmStockValSetup_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { frmReportDates frd = new frmReportDates(Period.Monthly); frd.ShowDialog(); if (frd.SelectedFolder != "$NONE") { InputTextBox("DATE").Text = frd.SelectedFolder; SendKeys.Send("{ENTER}"); } } else if (e.KeyCode == Keys.Enter) { if (InputTextBox("DATE").Text != "") { sOldEngine = new StockEngine(InputTextBox("DATE").Text); sOldEngine.StockValuationToPrinter(); } else { sEngine.StockValuationToPrinter(); } this.Close(); } else if (e.KeyCode == Keys.Escape) { this.Close(); } }
public frmGetBarcode(ref StockEngine se) { sEngine = se; SetupForm(); this.FormClosing += new FormClosingEventHandler(frmGetBarcode_FormClosing); this.VisibleChanged += frmGetBarcode_VisibleChanged; }
public frmSingleInputBox(string sQuestion, ref StockEngine se) { sEngine = se; this.AllowScaling = false; this.Size = new Size(510, 110); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; lblQuestion = new Label(); lblQuestion.Location = new Point(10, 10); lblQuestion.Text = sQuestion; lblQuestion.AutoSize = true; this.Controls.Add(lblQuestion); tbResponse = new TextBox(); tbResponse.Location = new Point(10, BelowLastControl); tbResponse.Size = new Size(400, 25); this.Controls.Add(tbResponse); tbResponse.KeyDown += new KeyEventHandler(tbResponse_KeyDown); bOK = new Button(); bOK.Location = new Point(414, tbResponse.Top); bOK.Size = new Size(65, 23); bOK.Text = "OK"; this.Controls.Add(bOK); bOK.Click += new EventHandler(bOK_Click); }
public frmAddSingleItem(ref StockEngine se) { sEngine = se; AddInputControl("BARCODE", "Item Barcode : ", new Point(10, 10), 500, "Enter the barcode of the item"); AddInputControl("DESCRIPTION", "Item Description : ", new Point(10, BelowLastControl), 500, "Enter the description of the item"); AddInputControl("RRP", "Price : ", new Point(10, BelowLastControl), 500, "Enter the selling price of the item"); }
public frmVATRateEdit(ref StockEngine se) { sEngine = se; this.AllowScaling = false; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.Size = new System.Drawing.Size(400, 70); SetupForm(); }
/// <summary> /// Retrieves the stock quote from the Internet. /// </summary> /// <param name="symbol">Specify the symbol of the stock to retrieve.</param> /// <returns>The value of the stock quote.</returns> public static StockEngine Execute(string symbol) { StockEngine engine = new StockEngine(symbol, false); HttpWebRequest request = engine.CreateRequest(); engine.ProcessResponse(request); return(engine); }
public frmPayForCommissionItem(ref StockEngine sEngine) { // Get the barcode of the commission item frmSingleInputBox fsfiGetCode = new frmSingleInputBox("Enter the Barcode of the commission item. Press F5 to look up:", ref sEngine); fsfiGetCode.ShowDialog(); if (fsfiGetCode.Response != "$NONE") { frmSingleInputBox fsfiGetQtySold = new frmSingleInputBox("Enter the quantity of items that you are paying for:", ref sEngine); fsfiGetQtySold.ShowDialog(); if (fsfiGetQtySold.Response != "$NONE") { decimal dQtyPaid = -1; try { dQtyPaid = Convert.ToDecimal(fsfiGetQtySold.Response); } catch { System.Windows.Forms.MessageBox.Show("Invalid number entered."); return; } frmSingleInputBox fGetAmount = new frmSingleInputBox("Enter the total amount that you paid for the items:", ref sEngine); fGetAmount.ShowDialog(); if (fGetAmount.Response != "$NONE") { decimal dAmountPaid = -1; try { dAmountPaid = Convert.ToDecimal(fGetAmount.Response); } catch { System.Windows.Forms.MessageBox.Show("Invalid amount entered."); return; } frmListOfShops flos = new frmListOfShops(ref sEngine); flos.ShowDialog(); if (flos.SelectedShopCode != "$NONE") { // Code here to straighten out the stock files if (sEngine.MarkCommissionItemAsPaid(fsfiGetCode.Response, dQtyPaid, dAmountPaid, flos.SelectedShopCode)) { System.Windows.Forms.MessageBox.Show(dQtyPaid.ToString() + " " + sEngine.GetMainStockInfo(fsfiGetCode.Response)[1] + " paid for at a total of " + dAmountPaid.ToString()); } else { System.Windows.Forms.MessageBox.Show("Unfortunately the items couldn't be paid for. This could be because the total you've ever received is less than the total you're trying to pay for"); } } else { return; } } } } }
public frmGraphSettings(ref StockEngine sEngine) { this.sEngine = sEngine; AllowScaling = false; this.FormBorderStyle = FormBorderStyle.SizableToolWindow; this.Size = new System.Drawing.Size(550, 600); this.Text = "Graph Settings"; SetupForm(); }
public frmWeeklySalesSummary(ref StockEngine se) { sEngine = se; this.Size = new Size(700, 590); this.SurroundListBoxes = true; lbWeekNum = new CListBox(); lbWeekNum.Location = new Point(10, 31); lbWeekNum.Size = new Size(50, 500); lbWeekNum.BorderStyle = BorderStyle.None; lbWeekNum.KeyDown += new KeyEventHandler(lbLastYear_KeyDown); lbWeekNum.SelectedIndexChanged += new EventHandler(lbLastYear_SelectedIndexChanged); this.Controls.Add(lbWeekNum); AddMessage("WEEK", "Week", new Point(10, 10)); lbLastYear = new CListBox(); lbLastYear.Location = new Point(60, 31); lbLastYear.Size = new Size(150, 500); lbLastYear.BorderStyle = BorderStyle.None; lbLastYear.KeyDown += new KeyEventHandler(lbLastYear_KeyDown); lbLastYear.SelectedIndexChanged += new EventHandler(lbLastYear_SelectedIndexChanged); lbLastYear.RightToLeft = RightToLeft.Yes; this.Controls.Add(lbLastYear); AddMessage("LY", "Last Year", new Point(60, 10)); lbThisYear = new CListBox(); lbThisYear.Location = new Point(210, 31); lbThisYear.Size = new Size(150, 500); lbThisYear.BorderStyle = BorderStyle.None; lbThisYear.KeyDown += new KeyEventHandler(lbLastYear_KeyDown); lbThisYear.RightToLeft = RightToLeft.Yes; lbThisYear.SelectedIndexChanged += new EventHandler(lbLastYear_SelectedIndexChanged); this.Controls.Add(lbThisYear); AddMessage("TY", "This Year", new Point(210, 10)); lbWeekCommencing = new CListBox(); lbWeekCommencing.Location = new Point(400, 31); lbWeekCommencing.Size = new Size(this.ClientSize.Width - 10 - lbWeekCommencing.Left, 500); lbWeekCommencing.BorderStyle = BorderStyle.None; lbWeekCommencing.KeyDown += new KeyEventHandler(lbLastYear_KeyDown); lbWeekCommencing.SelectedIndexChanged += new EventHandler(lbLastYear_SelectedIndexChanged); this.Controls.Add(lbWeekCommencing); AddMessage("WC", "Week Commencing", new Point(360, 10)); lbAverage = new Label(); lbAverage.Location = new Point(lbWeekNum.Left, lbWeekNum.Top + lbWeekNum.Height); lbAverage.AutoSize = true; this.Controls.Add(lbAverage); this.AllowScaling = false; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.Text = "Weekly Sales Summary"; LoadStats(); //lbWeekNum.SelectedIndex = sEngine.WeekCalc(DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString()) - 1; }
public AddMultiBarcodeItem(ref StockEngine sEngine) { frmSingleInputBox fsiGetBarcode = new frmSingleInputBox("Enter the barcode for the new multi-barcode item", ref sEngine); fsiGetBarcode.ShowDialog(); if (fsiGetBarcode.Response != "$NONE") { Barcode = fsiGetBarcode.Response; frmSingleInputBox fsiGetDesc = new frmSingleInputBox("Enter the description for the new multi-barcode item", ref sEngine); fsiGetDesc.ShowDialog(); if (fsiGetDesc.Response != "$NONE") { frmListOfShops flos = new frmListOfShops(ref sEngine); flos.ShowDialog(); frmListOfTills flot = new frmListOfTills(ref sEngine, flos.SelectedShopCode); flot.ShowDialog(); System.Windows.Forms.MessageBox.Show("When the till is free, it will temporarily move to this computer. Enter the number 0 as your ID, and enter the transaction as you would like it to appear when you enter " + fsiGetBarcode.Response + " at the till. Then press the space bar and the till program will quit back to this", "Instructions", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); sEngine.RunTillSoftware(); string[] sData = sEngine.GetStoredTransactionFromTill(Convert.ToInt32(flot.sSelectedTillCode)); int nOfLines = 0; foreach (string line in sData) { if (line.Contains(',')) { nOfLines++; } } string[] sBarcodes = new string[nOfLines]; decimal[] dQuantities = new decimal[nOfLines]; decimal[] dAmountPerItem = new decimal[nOfLines]; for (int i = 0; i < nOfLines; i++) { string[] sTemp = sData[i].Split(','); sBarcodes[i] = sTemp[0]; dQuantities[i] = Convert.ToDecimal(sTemp[1]); dAmountPerItem[i] = Convert.ToDecimal(sTemp[2]) / dQuantities[i]; } sEngine.AddMultiItemItem(fsiGetBarcode.Response, fsiGetDesc.Response, flos.SelectedShopCode, sBarcodes, dQuantities, dAmountPerItem); if (System.Windows.Forms.MessageBox.Show("Upload changes to all tills now?", "Upload?", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { sEngine.CopyWaitingFilesToTills(); } } else { Barcode = "$NULL"; } } else { Barcode = "$NULL"; } }
public frmReportSelect(Period rType, ref StockEngine se) { sEngine = se; rtSelectedReport = rType; this.AllowScaling = false; this.Size = new Size(820, 233); SetupForm(); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.VisibleChanged += frmReportSelect_VisibleChanged; }
public frmAddEditOffers(ref StockEngine sEngine) { this.sEngine = sEngine; this.AllowScaling = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Size = new Size(825, 550); this.Text = "Add/Edit Offers"; SetupForm(); LoadOffers(); }
public MainWindow() { InitializeComponent(); configHandler = new ConfigurationHandler(this); createNewDialog = new CreateNewDialog(configHandler); stockEngine = new StockEngine(this); stockListView.ItemsSource = stockEngine.dashItems; }
public frmStockLevelReportConfig(ref StockEngine se) { sEngine = se; SetupForm(); this.AllowScaling = false; this.Size = new Size(750, 100); this.StartPosition = FormStartPosition.CenterScreen; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.VisibleChanged += frmStockLevelReportConfig_VisibleChanged; }
public void LoadSymbolsFromTextFile() { // Arrange StockEngine engine = GetEngine(); // Act IEnumerable <string> symbols = engine.LoadSymbolsFromTextFile("aim.txt"); // Assert Assert.That(symbols.Count(), Is.EqualTo(674)); }
public void LookUpPrice_With_Bad_Symbol_Returns_Null() { // Arrange StockEngine engine = GetEngine(); // Act Quote quote = engine.LookupPrice("FARTYFART.L"); // Assert Assert.Null(quote); }
long tickCount_ = 0; // 시간 등록 public void start() { StockEngine engine = StockEngine.getInstance; engine.addOrder(new SuddenlyHighTradingStock()); engine.addOrder(new YesterdayHighTradingStock()); engine.addOrder(new AgencyTradingStock()); engine.addOrder(new NewHighPriceStock()); tickCount_ = DateTime.Now.Ticks; }
public frmListOfSuppliers(ref StockEngine se) { sEngine = se; AddMessage("CODE", "Supplier Code", new Point(10, 10)); AddMessage("NAME", "Supplier Name", new Point(100, 10)); AddMessage("EDIT", "Press Insert To Add / Edit A Supplier, Shift+Del to Delete", new Point(10, BelowLastControl)); this.AllowScaling = false; this.SurroundListBoxes = true; this.Size = new Size(400, 100); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.Text = "Select A Supplier"; lbCode = new CListBox(); lbCode.Height = 5; lbCode.Location = new Point(10, BelowLastControl); lbCode.BorderStyle = BorderStyle.None; this.Controls.Add(lbCode); lbName = new CListBox(); lbName.Height = 5; lbName.Location = new Point(100, lbCode.Top); lbName.BorderStyle = BorderStyle.None; this.Controls.Add(lbName); string[] sTillCodes = sEngine.GetListOfSuppliers(); Array.Sort(sTillCodes); for (int i = 0; i < sTillCodes.Length; i++) { string[] sTillData = sEngine.GetSupplierDetails(sTillCodes[i]); lbCode.Items.Add(sTillData[0]); lbName.Items.Add(sTillData[1]); if (this.Height < 700) { lbCode.Height += lbCode.ItemHeight; lbName.Height += lbName.ItemHeight; this.Height += lbName.ItemHeight; } } lbCode.Size = new Size(90, this.ClientSize.Height - 10 - lbCode.Top); lbName.Size = new Size(this.ClientSize.Width - 10 - lbName.Left, this.ClientSize.Height - 10 - lbName.Top); lbName.Focus(); lbName.SelectedIndexChanged += new EventHandler(lbName_SelectedIndexChanged); lbName.KeyDown += new KeyEventHandler(lbName_KeyDown); lbCode.KeyDown += new KeyEventHandler(lbName_KeyDown); lbCode.SelectedIndexChanged += new EventHandler(lbCode_SelectedIndexChanged); if (lbName.Items.Count >= 1) { lbName.SelectedIndex = 0; } this.Text = "Select A Supplier"; }
public frmStockValSetup(ref StockEngine se) { sEngine = se; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.Size = new Size(850, 70); this.Text = "Stock Valuation Setup"; AddInputControl("DATE", "Date of Stock Valuation : ", new Point(10, 10), 500, "Press F5 for a list of dates, leave blank for as of today."); InputTextBox("DATE").KeyDown += new KeyEventHandler(frmStockValSetup_KeyDown); this.VisibleChanged += frmStockValSetup_VisibleChanged; }
public frmInvoiceCosts(ref StockEngine se) { sEngine = se; this.Size = new Size(1024, 768); this.SurroundListBoxes = true; lbBarcode = new CListBox(); lbBarcode.Location = new Point(10, 31); lbBarcode.Size = new Size(200, this.ClientSize.Height - 10 - lbBarcode.Top); lbBarcode.BorderStyle = BorderStyle.None; lbBarcode.KeyDown += new KeyEventHandler(lbKeyDown); lbBarcode.SelectedIndexChanged += new EventHandler(lbSelChanged); this.Controls.Add(lbBarcode); AddMessage("BARCODE", "Barcode", new Point(10, 10)); lbDesc = new CListBox(); lbDesc.Location = new Point(210, 31); lbDesc.Size = new Size(300, this.ClientSize.Height - 10 - lbBarcode.Top); lbDesc.BorderStyle = BorderStyle.None; lbDesc.KeyDown += new KeyEventHandler(lbKeyDown); lbDesc.SelectedIndexChanged += new EventHandler(lbSelChanged); this.Controls.Add(lbDesc); AddMessage("DESC", "Description", new Point(210, 10)); lbQtyRecd = new CListBox(); lbQtyRecd.Location = new Point(510, 31); lbQtyRecd.Size = new Size(100, this.ClientSize.Height - 10 - lbBarcode.Top); lbQtyRecd.BorderStyle = BorderStyle.None; lbQtyRecd.KeyDown += new KeyEventHandler(lbKeyDown); lbQtyRecd.RightToLeft = RightToLeft.Yes; lbQtyRecd.SelectedIndexChanged += new EventHandler(lbSelChanged); this.Controls.Add(lbQtyRecd); AddMessage("RECD", "Qty Received", new Point(510, 10)); lbCost = new CListBox(); lbCost.Location = new Point(610, 31); lbCost.Size = new Size(100, this.ClientSize.Height - 10 - lbBarcode.Top); lbCost.BorderStyle = BorderStyle.None; lbCost.KeyDown += new KeyEventHandler(lbKeyDown); lbCost.RightToLeft = RightToLeft.Yes; lbCost.SelectedIndexChanged += new EventHandler(lbSelChanged); this.Controls.Add(lbCost); AddMessage("COST", "Cost", new Point(610, 10)); this.VisibleChanged += new EventHandler(frmInvoiceCosts_VisibleChanged); this.FormClosing += new FormClosingEventHandler(frmInvoiceCosts_FormClosing); this.AllowScaling = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Text = "Enter Invoice Costs"; this.Width = lbCost.Left + lbCost.Width + 10 + (this.Width - this.ClientSize.Width); // Get the settlement discount EnterSettlementDiscount(); }
public frmSuppliersForItem(ref StockEngine se, string Barcode) { sEngine = se; this.AllowScaling = false; this.Size = new Size(400, 240); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.Text = "Suppliers for " + sEngine.GetMainStockInfo(Barcode)[1]; this.SurroundListBoxes = true; int nOfResults = 0; string[,] sSuppliers = sEngine.GetListOfSuppliersForItem(Barcode, ref nOfResults); AddMessage("NAME", "Supplier Name", new Point(10, 10)); lbSupName = new CListBox(); lbSupName.Location = new Point(10, 35); lbSupName.Size = new Size(200, this.ClientSize.Height - lbSupName.Top - 10); lbSupName.SelectedIndexChanged += new EventHandler(lbSelectedChanged); lbSupName.BorderStyle = BorderStyle.None; lbSupName.KeyDown += new KeyEventHandler(lbKeyDown); this.Controls.Add(lbSupName); AddMessage("COST", "Last Cost", new Point(210, 10)); lbSupCost = new CListBox(); lbSupCost.Location = new Point(210, 35); lbSupCost.Size = new Size(75, this.ClientSize.Height - lbSupName.Top - 10); lbSupCost.SelectedIndexChanged += new EventHandler(lbSelectedChanged); lbSupCost.RightToLeft = RightToLeft.Yes; lbSupCost.BorderStyle = BorderStyle.None; lbSupCost.KeyDown += new KeyEventHandler(lbKeyDown); this.Controls.Add(lbSupCost); AddMessage("CODE", "Supplier Code", new Point(285, 10)); lbSupCode = new CListBox(); lbSupCode.Location = new Point(285, 35); lbSupCode.Size = new Size(this.ClientSize.Width - lbSupCode.Left - 10, this.ClientSize.Height - lbSupName.Top - 10); lbSupCode.SelectedIndexChanged += new EventHandler(lbSelectedChanged); lbSupCode.BorderStyle = BorderStyle.None; lbSupCode.KeyDown += new KeyEventHandler(lbKeyDown); this.Controls.Add(lbSupCode); for (int i = 0; i < nOfResults; i++) { lbSupName.Items.Add(sEngine.GetSupplierDetails(sSuppliers[i, 1])[1]); lbSupCost.Items.Add(FormatMoneyForDisplay(sSuppliers[i, 3])); lbSupCode.Items.Add(sSuppliers[i, 2]); } if (nOfResults > 0) { lbSupName.SelectedIndex = 0; } }
/// <summary> /// Retrieves the stock quote from the Internet. /// </summary> /// <param name="symbol">Specify the symbol of the stock to retrieve.</param> /// <returns>The value of the stock quote.</returns> public static StockEngine Execute(string symbol) { StockEngine engine = new StockEngine(symbol, false); HttpWebRequest request = engine.CreateRequest(); engine.ProcessResponse(request); return engine; }