예제 #1
0
        private void fXRiskMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                List <SQLFunc.SubResults> myData  = mySQL.GetData(DBTables["FXRisk"].ToString(), "*");
                List <SQLFunc.SubResults> Headers = mySQL.Get_TblFields(DBTables["FXRisk"].ToString());

                if (myData.Count == 0)
                {
                    MessageBox.Show("No data for this table");
                    return;
                }

                Parameters myParam = new Parameters(Headers, myData, false, "Period for deviation are: [0, 6M], [6M, 1Y], [1Y, 2Y], ...");
                myParam.ShowDialog();
                if (myParam != null && myParam.IsSaved)
                {
                    mySQL.ClearTable(DBTables["FXRisk"].ToString());
                    for (int i = 0; i < myParam.Data2Write.Count; i++)
                    {
                        mySQL.InsertData(DBTables["FXRisk"].ToString(), myParam.Data2Write[i]);
                    }
                    myParam.Close();
                }
            }
            catch
            { MessageBox.Show("Issue while getting data for FX Risk management"); }
        }
예제 #2
0
        private void SetGrid()
        {
            myData = sql.Get_TblFields(TPTbl);

            DataGridViewCell cell = new DataGridViewTextBoxCell();

            for (int i = 0; i < myData.Count; i++)
            {
                DataGridViewColumn       myCol;
                DataGridViewComboBoxCell cellBox = new DataGridViewComboBoxCell();

                if (IsRiskTests && i < 3)
                {
                    List <SQLFunc.SubResults> data;

                    if (i == 0)
                    {
                        data = sql.GetData(CountryTbl, "*");
                    }
                    else if (i == 1)
                    {
                        data = sql.GetData(SectorTbl, "*");
                    }
                    else
                    {
                        data = new List <SQLFunc.SubResults>();
                    }

                    for (int j = 0; j < data.Count; j++)
                    {
                        cellBox.Items.Add(data[j]._SubResults[0].ToString());
                    }

                    myCol = new DataGridViewColumn(cellBox);
                }
                else
                {
                    myCol = new DataGridViewColumn(cell);
                }

                myCol.Name       = (string)myData[i]._SubResults[3];
                myCol.HeaderText = myCol.Name;

                dataGrid.Columns.Add(myCol);
            }
        }