private void lvList_DoubleClick(object sender, EventArgs e) { if (lvList.SelectedItems.Count == 1) { StockAnalysisRequest request = new StockAnalysisRequest(); request.Period = Session.Entities.GetPeriod(int.Parse(lvList.SelectedItems[0].Text)); frmStockAnalysis frm = new frmStockAnalysis(request); frm.ShowDialog(); } }
private void analysisToolStripMenuItem_Click(object sender, EventArgs e) { StockAnalysisRequest request = new StockAnalysisRequest(); for (int i = 0; i < lvList.SelectedItems.Count; i++) { if (!string.IsNullOrEmpty(lvList.SelectedItems[i].SubItems["StockCode"].Text)) { request.StockCodes.Add(lvList.SelectedItems[i].SubItems["StockCode"].Text); } } request.Period = period; request.StockCodes = request.StockCodes.Distinct().ToList(); frmStockAnalysis frm = new frmStockAnalysis(request); frm.ShowDialog(); }
public frmStockAnalysis(StockAnalysisRequest request) { this.request = request; InitializeComponent(); setTranslateMessage(); if (request.StockCodes.Count == 0) { stocks = Session.Entities.GetStocks(); } else { foreach (var stockCode in request.StockCodes) { var stock = Session.Entities.GetStock(stockCode); if (stock != null) { stocks.Add(stock); } } } Text = $"{request.Period.PeriodName} - {Translate.GetMessage("stock-analysis")}"; }