// Event Handler for when Stock Selection Changes // Passes the Stock back to the Calling Form (usually Main Form) private void lst_Portfolio_SelectedIndexChanged(object sender, EventArgs e) { StockModel stock; stock = (StockModel)lst_Portfolio.SelectedItem; callingForm.StockSelected(stock); }
// Method to handle Save Button Click private void btn_Save_Click(object sender, EventArgs e) { // Check that All Fields have values if (IsMissingInput()) { DisplayError(MissingDataMsg); this.DialogResult = DialogResult.None; } else { // Gather Information GatherStockInfo(); if (IsNewStock()) { // Save Basic Stock Info to Database GlobalConfig.Connection.Stocks_AddNew(stock); // Gather Transaction Information GatherTransactionInfo(); // Save Transaction to Database GlobalConfig.Connection.Transaction_AddNew(trans); // Gater Valuation Information GatherValuationInfo(); // Save Valuation to Database GlobalConfig.Connection.Valuation_AddNew(value); callingForm.StockSelected(stock); } else { this.DialogResult = DialogResult.None; } } }
public void StockSelected(StockModel stock) { callingForm.StockSelected(stock); }