private void stockGV_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (this.myOnShowChart == null)
         {
             return;
         }
         databases.tmpDS.stockCodeRow stockRow = this.CurrentRow;
         if (stockRow == null)
         {
             return;
         }
         myOnShowChart(stockRow.code);
     }
     catch (Exception er)
     {
         ErrorHandler(this, er);
     }
 }
Esempio n. 2
0
 public override void SetLanguage()
 {
     this.ShowMessage("");
     base.SetLanguage();
     if (this.myData.DataStockCode == null)
     {
         return;
     }
     databases.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(this.myData.DataStockCode);
     if (stockCodeRow != null)
     {
         if (commonClass.SysLibs.IsUseVietnamese())
         {
             this.Text = stockCodeRow.tickerCode.Trim() + " - " + stockCodeRow.name;
         }
         else
         {
             this.Text = stockCodeRow.tickerCode.Trim() + " - " + (stockCodeRow.IsnameEnNull()?common.Consts.constNotAvailable:stockCodeRow.nameEn);
         }
     }
 }
Esempio n. 3
0
 public bool Find(string code, bool ShowSelectionIfNotFound)
 {
     try
     {
         selectedDataRow = null;
         code = code.Trim();
         if (code != "")
         {
             selectedDataRow = DataAccess.Libs.myStockCodeTbl.FindBycode(code);
             if(selectedDataRow != null) return true;
             if (!ShowSelectionIfNotFound) return false;
         }
         LoadData(); 
         this.ShowDialog();
         return (this.selectedDataRow != null);
     }
     catch (Exception er)
     {
         this.ShowError(er);
     }
     return false;
 }
Esempio n. 4
0
 private void profitDetailMenu_Click(object sender, EventArgs e)
 {
     try
     {
         if (resultDataGrid.CurrentRow == null)
         {
             return;
         }
         int    cellId    = (resultDataGrid.CurrentCell != null && resultDataGrid.CurrentCell.ColumnIndex > 0 ? resultDataGrid.CurrentCell.ColumnIndex - 1:0);
         string stockCode = resultDataGrid.CurrentRow.Cells[0].Value.ToString();
         databases.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(stockCode);
         if (stockCodeRow == null)
         {
             return;
         }
         ShowTradeTransactions(stockCodeRow, strategyClb.myCheckedValues[cellId], this.myDataParam);
     }
     catch (Exception er)
     {
         this.ShowError(er);
     }
 }
Esempio n. 5
0
        public virtual void SetEditData(databases.baseDS.tradeAlertRow row)
        {
            transCodeEd.Text = "";
            databases.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(row.stockCode);
            if (stockCodeRow != null)
            {
                databases.baseDS.stockExchangeRow stockExchangeRow = DataAccess.Libs.myStockExchangeTbl.FindBycode(stockCodeRow.stockExchange);
                if (stockExchangeRow != null)
                {
                    feePercEd.Value = stockExchangeRow.tranFeePerc;
                }
            }
            codeEd.Text         = row.stockCode;
            onTimeEd.myDateTime = row.onTime;
            portfolioCb.myValue = row.portfolio;
            qtyEd.Value         = 0; subTotalEd.Value = 0; feeAmtEd.Value = 0; totalAmtEd.Value = 0;
            transTypeCb.myValue = (AppTypes.TradeActions)row.tradeAction;
            statusCb.myValue    = AppTypes.CommonStatus.New;
            CalculatePriceAndFeePercentage();

            codeEd.Focus();
        }
Esempio n. 6
0
        private void profitDetailMenu_Click(object sender, EventArgs e)
        {
            try
            {
                common.controls.baseDataGridView resultDataGrid = this.CurrentDataGridView;
                if (resultDataGrid == null || resultDataGrid.CurrentRow == null || resultDataGrid.CurrentCell == null)
                {
                    return;
                }

                //TUAN - 29 Sept 2012 fix bug profit detail and all profit details
                if (resultDataGrid.CurrentCell.ColumnIndex < 0)
                {
                    return;
                }
                //TUAN - 29 Sept 2012 fix bug profit detail and all profit details

                string stockCode = resultTab.SelectedTab.Name;
                databases.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(stockCode);
                if (stockCodeRow == null)
                {
                    return;
                }
                application.Strategy.StrategyMeta meta = application.Strategy.StrategyLibs.FindMetaByName(resultDataGrid.CurrentRow.Cells[0].Value.ToString());

                //TUAN - 29 Sept 2012 fix bug profit detail and all profit details
                int colId = resultDataGrid.CurrentCell.ColumnIndex == 0 ? 1 : resultDataGrid.CurrentCell.ColumnIndex;
                //TUAN - 29 Sept 2012 fix bug profit detail and all profit details
                DataParams dataParam = new DataParams(timeScaleCb.myValue.Code, AppTypes.TimeRangeFromCode(resultDataGrid.Columns[colId].DataPropertyName), 0);
                ShowTradeTransactions(stockCodeRow, meta.Code, dataParam);
            }
            catch (Exception er)
            {
                this.ShowError(er);
            }
        }
Esempio n. 7
0
 private void selectBtn_Click(object sender, EventArgs e)
 {
     if (dataSource.Current == null) selectedDataRow =null;
     else selectedDataRow = (databases.tmpDS.stockCodeRow)(((DataRowView)dataSource.Current).Row);
     this.Close();
 }
Esempio n. 8
0
 protected override object MakeItem(string value)
 {
     stockCodeRow = myDataTbl.FindBycode(value);
     if (stockCodeRow == null) return new common.myComboBoxItem(value, value);
     return new common.myComboBoxItem(value + " - " + (stockCodeRow.IsnameEnNull()?"":stockCodeRow.nameEn), value);
 }
Esempio n. 9
0
 protected override object MakeItem(string value)
 {
     stockCodeRow = this.myDataTbl.FindBycode(value);
     if (stockCodeRow == null) return new common.myComboBoxItem(value, value);
     if (commonClass.SysLibs.IsUseVietnamese()) 
         return new common.myComboBoxItem(value + " - " + stockCodeRow.name, value);
     return new common.myComboBoxItem(value + " - " + (stockCodeRow.IsnameEnNull() ? "" : stockCodeRow.nameEn), value);
 }
Esempio n. 10
0
        private void allProfitDetailMenu_Click(object sender, EventArgs e)
        {
            try
            {
                using (new DataAccess.PleaseWait())
                {
                    common.controls.baseDataGridView resultDataGrid = this.CurrentDataGridView;
                    if (resultDataGrid == null)
                    {
                        return;
                    }

                    string stockCode = resultTab.SelectedTab.Name;
                    databases.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(stockCode);
                    if (stockCodeRow == null)
                    {
                        return;
                    }

                    DataParams dataParam = new DataParams(timeScaleCb.myValue.Code, AppTypes.TimeRanges.None, 0);
                    //TUAN - 29 Sept 2012 fix bug profit detail and all profit details
                    int min = int.MaxValue;
                    int max = -1;
                    for (int i = 0; i < resultDataGrid.SelectedCells.Count; i++)
                    {
                        if (resultDataGrid.SelectedCells[i].RowIndex > max)
                        {
                            max = resultDataGrid.SelectedCells[i].RowIndex;
                        }
                        if (resultDataGrid.SelectedCells[i].RowIndex < min)
                        {
                            min = resultDataGrid.SelectedCells[i].RowIndex;
                        }
                    }
                    //if (resultDataGrid.SelectedRows.Count > 0)
                    if (min < max)
                    {
                        for (int rowId = min; rowId <= max; rowId++)
                        {
                            application.Strategy.StrategyMeta meta = application.Strategy.StrategyLibs.FindMetaByName(resultDataGrid.Rows[rowId].Cells[0].Value.ToString());
                            for (int idx = 1; idx < resultDataGrid.ColumnCount; idx++)
                            {
                                dataParam.TimeRange = AppTypes.TimeRangeFromCode(resultDataGrid.Columns[idx].DataPropertyName);
                                ShowTradeTransactions(stockCodeRow, meta.Code, dataParam);
                            }
                        }
                        //for (int rowId = 0; rowId < resultDataGrid.SelectedRows.Count; rowId++)
                        //{
                        //    application.Strategy.StrategyMeta meta = application.Strategy.StrategyLibs.FindMetaByName(resultDataGrid.SelectedRows[rowId].Cells[0].Value.ToString());
                        //    for (int idx = 1; idx < resultDataGrid.ColumnCount; idx++)
                        //    {
                        //        dataParam.TimeRange = AppTypes.TimeRangeFromCode(resultDataGrid.Columns[idx].DataPropertyName);
                        //        ShowTradeTransactions(stockCodeRow, meta.Code, dataParam);
                        //    }
                        //}
                    }
                    //TUAN - 29 Sept 2012 fix bug profit detail and all profit details
                    else
                    {
                        if (resultDataGrid.CurrentRow != null)
                        {
                            application.Strategy.StrategyMeta meta = application.Strategy.StrategyLibs.FindMetaByName(resultDataGrid.CurrentRow.Cells[0].Value.ToString());
                            for (int idx = 1; idx < resultDataGrid.ColumnCount; idx++)
                            {
                                dataParam.TimeRange = AppTypes.TimeRangeFromCode(resultDataGrid.Columns[idx].DataPropertyName);
                                ShowTradeTransactions(stockCodeRow, meta.Code, dataParam);
                            }
                        }
                    }
                }
            }
            catch (Exception er)
            {
                this.ShowError(er);
            }
        }