private void ToolStripButton_ModifyStock_Click(object sender, EventArgs e)
        {
            List <int> selectIndex = TSDataGridViewHelper.GetSelectRowIndex(secuGridView);

            if (selectIndex.Count == 0)
            {
                MessageDialog.Warn(this, msgSecurityModifySelect);
                return;
            }

            if (selectIndex.Count > 1)
            {
                MessageDialog.Warn(this, msgSecurityModifyOnlyOnce);
                return;
            }

            int rowIndex = selectIndex[0];

            if (rowIndex < 0 || rowIndex > _spotDataSource.Count)
            {
                MessageDialog.Warn(this, msgInvalidSelect);
                return;
            }

            TemplateStock stock = _spotDataSource[rowIndex];

            PortfolioSecurityDialog psDialog = new PortfolioSecurityDialog();

            psDialog.OnLoadControl(psDialog, DialogType.Modify);
            psDialog.OnLoadData(psDialog, stock);
            psDialog.SaveData += new FormLoadHandler(Dialog_SpotSecu_SaveData);
            psDialog.ShowDialog();
            if (psDialog.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                psDialog.Close();
                psDialog.Dispose();
            }
            else
            {
                psDialog.Close();
                psDialog.Dispose();
            }
        }
Exemple #2
0
        private void ToolStripButton_AddStock_Click(object sender, EventArgs e)
        {
            if (tempGridView.CurrentRow == null)
            {
                MessageDialog.Warn(this, msgAddTempSelect);
                return;
            }

            int rowIndex = tempGridView.CurrentRow.Index;

            if (rowIndex < 0 || rowIndex > _tempDataSource.Count)
            {
                MessageDialog.Warn(this, msgInvalidSelect);
                return;
            }

            TemplateStock stock = new TemplateStock
            {
                TemplateNo = _tempDataSource[rowIndex].TemplateId
            };

            PortfolioSecurityDialog psDialog = new PortfolioSecurityDialog();

            psDialog.OnLoadControl(psDialog, DialogType.New);
            psDialog.OnLoadData(psDialog, stock);
            psDialog.SaveData += new FormSaveHandler(Dialog_SpotSecu_SaveData);
            psDialog.ShowDialog();
            if (psDialog.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                psDialog.Close();
                psDialog.Dispose();
            }
            else
            {
                psDialog.Close();
                psDialog.Dispose();
            }
        }
Exemple #3
0
        private void ToolStripButton_ModifyStock_Click(object sender, EventArgs e)
        {
            var selectedStocks = _spotDataSource.Where(p => p.Selection).ToList();

            //List<int> selectIndex = TSDataGridViewHelper.GetSelectRowIndex(secuGridView);
            if (selectedStocks == null || selectedStocks.Count == 0)
            {
                MessageDialog.Warn(this, msgSecurityModifySelect);
                return;
            }

            if (selectedStocks.Count > 1)
            {
                MessageDialog.Warn(this, msgSecurityModifyOnlyOnce);
                return;
            }

            TemplateStock stock = selectedStocks[0];

            PortfolioSecurityDialog psDialog = new PortfolioSecurityDialog();

            psDialog.OnLoadControl(psDialog, DialogType.Modify);
            psDialog.OnLoadData(psDialog, stock);
            psDialog.SaveData += new FormSaveHandler(Dialog_SpotSecu_SaveData);
            psDialog.ShowDialog();
            if (psDialog.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                psDialog.Close();
                psDialog.Dispose();
            }
            else
            {
                psDialog.Close();
                psDialog.Dispose();
            }
        }