Exemplo n.º 1
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;
                }
                if (resultDataGrid.CurrentCell.ColumnIndex <= 0)
                {
                    return;
                }

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

                int colId = resultDataGrid.CurrentCell.ColumnIndex;
                AppTypes.TimeRanges timeRange = AppTypes.TimeRangeFromCode(resultDataGrid.Columns[colId].DataPropertyName);
                ShowTradeTransactions(stockCodeRow, meta.Code, timeRange, timeScaleCb.myValue);
            }
            catch (Exception er)
            {
                this.ShowError(er);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Set what stock to be used as default
 /// </summary>
 /// <param name="stockCodeRow"></param>
 public void UseStock(data.tmpDS.stockCodeRow stockCodeRow)
 {
     this.ShowMessage("");
     this.myData.DataStockCode = stockCodeRow.code;
     ReloadChart();
     SetLanguage();
 }
Exemplo n.º 3
0
        private void dataGrid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                common.controls.baseDataGridView resultDataGrid = this.CurrentDataGridView;
                if (resultDataGrid == null)
                {
                    return;
                }
                string stockCode = resultTab.SelectedTab.Name;

                if (resultDataGrid.CurrentRow == null)
                {
                    return;
                }
                AppTypes.TimeRanges     timeRange    = AppTypes.TimeRangeFromCode(resultDataGrid.Columns[e.ColumnIndex].DataPropertyName);
                data.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(stockCode);
                if (stockCodeRow == null)
                {
                    return;
                }

                string strategyCode = resultDataGrid.CurrentRow.Cells[0].Value.ToString();
                ShowTradeTransactions(stockCodeRow, strategyCode, timeRange, timeScaleCb.myValue);
            }
            catch (Exception er)
            {
                this.ShowError(er);
            }
        }
Exemplo n.º 4
0
        private void profitDetailMenu_Click(object sender, EventArgs e)
        {
            try
            {
                if (resultDataGrid.CurrentRow == null || resultDataGrid.CurrentCell == null)
                {
                    return;
                }
                if (resultDataGrid.CurrentCell.ColumnIndex <= 0)
                {
                    return;
                }

                string stockCode = resultDataGrid.CurrentRow.Cells[0].Value.ToString();
                data.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(stockCode);
                if (stockCodeRow == null)
                {
                    return;
                }
                ShowTradeTransactions(stockCodeRow, strategyClb.myCheckedValues[resultDataGrid.CurrentCell.ColumnIndex - 1],
                                      periodicityEd.myTimeRange, periodicityEd.myTimeScale);
            }
            catch (Exception er)
            {
                this.ShowError(er);
            }
        }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
0
 public static void InitData(data.tmpDS.stockCodeRow row)
 {
     row.qty               = 0; row.boughtAmt = 0;
     row.boughtPrice       = 0;
     row.price             = 0;
     row.priceVariant      = 0;
     row.volume            = 0;
     row.amt               = 0;
     row.profitVariantAmt  = 0;
     row.profitVariantPerc = 0;
 }
Exemplo n.º 7
0
 private void selectBtn_Click(object sender, EventArgs e)
 {
     if (dataSource.Current == null)
     {
         selectedDataRow = null;
     }
     else
     {
         selectedDataRow = (data.tmpDS.stockCodeRow)(((DataRowView)dataSource.Current).Row);
     }
     this.Close();
 }
Exemplo n.º 8
0
 private void ShowChart()
 {
     if (this.myOnShowChart == null)
     {
         return;
     }
     data.tmpDS.stockCodeRow stockRow = this.CurrentRow;
     if (stockRow == null)
     {
         return;
     }
     myOnShowChart(stockRow.code);
 }
Exemplo n.º 9
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;
                    data.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(stockCode);
                    if (stockCodeRow == null)
                    {
                        return;
                    }

                    if (resultDataGrid.SelectedRows.Count > 0)
                    {
                        for (int rowId = 0; rowId < resultDataGrid.SelectedRows.Count; rowId++)
                        {
                            application.Strategy.Meta meta = application.Strategy.Libs.FindMetaByName(resultDataGrid.SelectedRows[rowId].Cells[0].Value.ToString());
                            for (int idx = 1; idx < resultDataGrid.ColumnCount; idx++)
                            {
                                AppTypes.TimeRanges timeRange = AppTypes.TimeRangeFromCode(resultDataGrid.Columns[idx].DataPropertyName);
                                ShowTradeTransactions(stockCodeRow, meta.Code, timeRange, timeScaleCb.myValue);
                            }
                        }
                    }
                    else
                    {
                        if (resultDataGrid.CurrentRow != null)
                        {
                            application.Strategy.Meta meta = application.Strategy.Libs.FindMetaByName(resultDataGrid.CurrentRow.Cells[0].Value.ToString());
                            for (int idx = 1; idx < resultDataGrid.ColumnCount; idx++)
                            {
                                AppTypes.TimeRanges timeRange = AppTypes.TimeRangeFromCode(resultDataGrid.Columns[idx].DataPropertyName);
                                ShowTradeTransactions(stockCodeRow, meta.Code, timeRange, timeScaleCb.myValue);
                            }
                        }
                    }
                }
            }
            catch (Exception er)
            {
                this.ShowError(er);
            }
        }
Exemplo n.º 10
0
 public static data.tmpDS.stockCodeRow FindAndCache(data.tmpDS.stockCodeDataTable tbl, string code)
 {
     data.tmpDS.stockCodeRow row = tbl.FindBycode(code);
     if (row != null)
     {
         return(row);
     }
     data.tmpDSTableAdapters.stockCodeTA dataTA = new data.tmpDSTableAdapters.stockCodeTA();
     dataTA.ClearBeforeFill = false;
     dataTA.FillByCode(tbl, code);
     row = tbl.FindBycode(code);
     if (row != null)
     {
         return(row);
     }
     return(null);
 }
Exemplo n.º 11
0
 public static data.tmpDS.stockCodeRow FindAndCache_StockCodeShort(string code)
 {
     data.tmpDS.stockCodeRow row = myCachedTmpDS.stockCode.FindBycode(code);
     if (row != null)
     {
         return(row);
     }
     data.tmpDSTableAdapters.stockCodeTA dataTA = new data.tmpDSTableAdapters.stockCodeTA();
     dataTA.ClearBeforeFill = false;
     dataTA.FillByCode(myCachedTmpDS.stockCode, code);
     row = myCachedTmpDS.stockCode.FindBycode(code);
     if (row != null)
     {
         return(row);
     }
     return(null);
 }
 private void stockGV_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (this.myOnShowChart == null)
         {
             return;
         }
         data.tmpDS.stockCodeRow stockRow = this.CurrentRow;
         if (stockRow == null)
         {
             return;
         }
         myOnShowChart(stockRow.code);
     }
     catch (Exception er)
     {
         ErrorHandler(this, er);
     }
 }
Exemplo n.º 13
0
 public override void SetLanguage()
 {
     this.ShowMessage("");
     base.SetLanguage();
     if (this.myData.DataStockCode == null)
     {
         return;
     }
     data.tmpDS.stockCodeRow stockCodeRow = DataAccess.Libs.myStockCodeTbl.FindBycode(this.myData.DataStockCode);
     if (stockCodeRow != null)
     {
         if (commonClass.AppLibs.IsUseVietnamese())
         {
             this.Text = stockCodeRow.tickerCode.Trim() + " - " + stockCodeRow.name;
         }
         else
         {
             this.Text = stockCodeRow.tickerCode.Trim() + " - " + (stockCodeRow.IsnameEnNull()?common.Consts.constNotAvailable:stockCodeRow.nameEn);
         }
     }
 }
Exemplo n.º 14
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;
 }
Exemplo n.º 15
0
        protected void ShowTradeTransactions(data.tmpDS.stockCodeRow stockCodeRow, string strategyCode,
                                             AppTypes.TimeRanges timeRange, AppTypes.TimeScale timeScale)
        {
            string         formName = stockCodeRow.code.Trim() + "," + timeRange.ToString() + "," + application.Strategy.Libs.GetMetaName(strategyCode) + "," + timeScale.Code;
            profitEstimate myForm   = profitEstimate.GetForm(formName);

            myForm.myTimeRange    = timeRange;
            myForm.myTimeScale    = timeScale;
            myForm.myStockCode    = stockCodeRow.code;
            myForm.myOptions      = new EstimateOptions();
            myForm.myStrategyCode = strategyCode;
            myForm.ReLoad();
            myForm.Text = "(" + formName + ")";
            if (this.myDockedPane != null)
            {
                myForm.Show(this.myDockedPane);
            }
            else
            {
                myForm.ShowDialog();
            }
        }
Exemplo n.º 16
0
 protected override object MakeItem(string value)
 {
     stockCodeRow = this.myDataTbl.FindBycode(value);
     if (stockCodeRow == null) return new common.myComboBoxItem(value, value);
     if (commonClass.AppLibs.IsUseVietnamese()) 
         return new common.myComboBoxItem(value + " - " + stockCodeRow.name, value);
     return new common.myComboBoxItem(value + " - " + (stockCodeRow.IsnameEnNull() ? "" : stockCodeRow.nameEn), value);
 }
Exemplo n.º 17
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);
 }
Exemplo n.º 18
0
 private void selectBtn_Click(object sender, EventArgs e)
 {
     if (dataSource.Current == null) selectedDataRow =null;
     else selectedDataRow = (data.tmpDS.stockCodeRow)(((DataRowView)dataSource.Current).Row);
     this.Close();
 }