예제 #1
0
        //// EVENTS ////

        private void Form1_Load(object sender, EventArgs e)
        {
            SystemSetting.systemDir       = Environment.CurrentDirectory;
            SystemSetting.databaseFileDir = SystemSetting.systemDir + "\\record.db";
            SystemSetting.errorLogDir     = SystemSetting.systemDir + "\\error_log\\";
            SystemSetting.downloadJsonDir = SystemSetting.systemDir + "\\download\\";
            SystemSetting.defaultPage     = SystemSetting.systemDir + "\\default.html";
            SystemSetting.CheckDirectory(SystemSetting.errorLogDir);
            SystemSetting.CheckDirectory(SystemSetting.downloadJsonDir);
            webBrowserInner.Navigate(SystemSetting.defaultPage);
            DatabaseHelper.LoadDatabase();
            LoadShareholderNameList();
        }
예제 #2
0
        private void QueryQgqpData(double proMin, double proMax)
        {
            var reader = DatabaseHelper.QueryQGQPDataByMainControl(proMin, proMax);

            if (reader.HasRows)
            {
                var commentList = new List <StockCommentList>();
                while (reader.Read())
                {
                    try
                    {
                        var record = new StockCommentList()
                        {
                            Tradecode = reader["TRADECODE"].ToString(),
                            Tradedate = Convert.ToDateTime(reader["TRADEDATE"].ToString()),
                            Stockname = reader["STOCKNAME"].ToString(),
                            Jgcyd     = Convert.ToDouble(reader["JGCYD"].ToString()) * 100,
                            Zljlr     = Convert.ToInt64(reader["ZLJLR"].ToString()),
                        };
                        commentList.Add(record);
                    }
                    catch (Exception ex)
                    {
                        SystemSetting.LogAndDisplayError(ex, "MainForm.cs, line 114");
                    }
                }
                if (commentList.Count > 0)
                {
                    var ui = new Views.UI_QgqpData(proMin * 100, proMax * 100, commentList.Count);
                    ui.FillData(commentList);
                    int heightIntend = (commentList.Count + 2) * 23 + 38;
                    ui.Height = heightIntend < ui.minimumHeight ? ui.minimumHeight : heightIntend;
                    ui.Dock   = DockStyle.Top;
                    this.panel_main.Controls.Add(ui);
                }
            }
            else
            {
                MessageBox.Show("未找到记录值!");
            }
        }
예제 #3
0
 private void LoadShareholderNameList()
 {
     try
     {
         SQLiteDataReader reader = DatabaseHelper.GetShareholderNameList();
         SystemSetting.lstTopTenShareholder        = new List <string>();
         SystemSetting.lstTopTenShareholderDisplay = new BindingList <string>();
         listBox_shareholders.Items.Clear();
         while (reader.Read())
         {
             try
             {
                 SystemSetting.lstTopTenShareholder.Add(reader[0].ToString());
                 // SystemSetting.lstTopTenShareholderDisplay.Add(reader[0].ToString());
             }
             catch (Exception ex)
             {
                 SystemSetting.LogAndDisplayError(ex, "MainForm.cs, line 142");
             }
         }
         if (SystemSetting.lstTopTenShareholder.Count > 0)
         {
             listBox_shareholders.SuspendLayout();
             SystemSetting.lstTopTenShareholderDisplay = new BindingList <string>(SystemSetting.lstTopTenShareholder.Take(SystemSetting.recordCountPerPage).ToList());
             listBox_shareholders.DataSource           = SystemSetting.lstTopTenShareholderDisplay;
             label_shareholderList.Text = $"股东列表({SystemSetting.lstTopTenShareholder.Count})";
             var totalPageCount = (int)Math.Ceiling(SystemSetting.lstTopTenShareholder.Count * 1.0 / SystemSetting.recordCountPerPage);
             var dataIndexArray = Enumerable.Range(1, totalPageCount).ToArray();
             comboBox_paging.Items.Clear();
             comboBox_paging.Items.AddRange(dataIndexArray.Cast <object>().ToArray());
             comboBox_paging.SelectedIndex = 0;
             listBox_shareholders.ResumeLayout();
             listBox_shareholders.Invalidate();
         }
     }
     catch (Exception ex)
     {
         SystemSetting.LogAndDisplayError(ex, "MainForm.cs, line 138");
     }
 }
예제 #4
0
        //// FUNCTIONS ////

        private void QueryAndDisplayTopTenShareholder(string name)
        {
            try
            {
                SQLiteDataReader reader = DatabaseHelper.QueryByShareholderName(name);
                if (reader.HasRows)
                {
                    TopTenShareholder topTenShareholder = new TopTenShareholder(name);
                    while (reader.Read())
                    {
                        try
                        {
                            ShareHoldingRecord record = new ShareHoldingRecord()
                            {
                                dateOfRecord    = DatabaseHelper.ColumnExists(reader, "dateOfRecord") ? reader["dateOfRecord"].ToString() : "",
                                ranking         = DatabaseHelper.ColumnExists(reader, "ranking") ? reader["ranking"].ToString() : "",
                                stockCode       = DatabaseHelper.ColumnExists(reader, "stockCode") ? reader["stockCode"].ToString() : "",
                                stockName       = DatabaseHelper.ColumnExists(reader, "stockName") ? reader["stockName"].ToString() : "",
                                shareholderType = DatabaseHelper.ColumnExists(reader, "shareholderType") ? reader["shareholderType"].ToString() : "",
                                shareType       = DatabaseHelper.ColumnExists(reader, "shareType") ? reader["shareType"].ToString() : "",
                                numberOfShares  = DatabaseHelper.ColumnExists(reader, "numberOfShares") ? reader["numberOfShares"].ToString() : "",
                                percentageOfTotalTradableShares = DatabaseHelper.ColumnExists(reader, "percentageOfTotalTradableShares") ? reader["percentageOfTotalTradableShares"].ToString() : "",
                                statusChange    = DatabaseHelper.ColumnExists(reader, "statusChange") ? reader["statusChange"].ToString() : "",
                                changeRate      = DatabaseHelper.ColumnExists(reader, "changeRate") ? reader["changeRate"].ToString() : "",
                                financialReport = new FinancialReport()
                                {
                                    stockCode                               = DatabaseHelper.ColumnExists(reader, "stockCode") ? reader["stockCode"].ToString() : "",
                                    dateOfRecord                            = DatabaseHelper.ColumnExists(reader, "dateOfRecord") ? reader["dateOfRecord"].ToString() : "",
                                    basicProfitPerShare                     = DatabaseHelper.ColumnExists(reader, "basicProfitPerShare") ? reader["basicProfitPerShare"].ToString() : "",
                                    netAssetsPerShare                       = DatabaseHelper.ColumnExists(reader, "netAssetsPerShare") ? reader["netAssetsPerShare"].ToString() : "",
                                    providentFundPerShare                   = DatabaseHelper.ColumnExists(reader, "providentFundPerShare") ? reader["providentFundPerShare"].ToString() : "",
                                    undistributedProfitPerShare             = DatabaseHelper.ColumnExists(reader, "undistributedProfitPerShare") ? reader["undistributedProfitPerShare"].ToString() : "",
                                    cashFlowPerShare                        = DatabaseHelper.ColumnExists(reader, "cashFlowPerShare") ? reader["cashFlowPerShare"].ToString() : "",
                                    totalOperatingIncome                    = DatabaseHelper.ColumnExists(reader, "totalOperatingIncome") ? reader["totalOperatingIncome"].ToString() : "",
                                    grossProfit                             = DatabaseHelper.ColumnExists(reader, "grossProfit") ? reader["grossProfit"].ToString() : "",
                                    netProfitAttributable                   = DatabaseHelper.ColumnExists(reader, "netProfitAttributable") ? reader["netProfitAttributable"].ToString() : "",
                                    deductionOfNonNetProfit                 = DatabaseHelper.ColumnExists(reader, "deductionOfNonNetProfit") ? reader["deductionOfNonNetProfit"].ToString() : "",
                                    totalOperatingIncomeYearOnYearGrowth    = DatabaseHelper.ColumnExists(reader, "totalOperatingIncomeYearOnYearGrowth") ? reader["totalOperatingIncomeYearOnYearGrowth"].ToString() : "",
                                    netProfitAttributableYearOnYearGrowth   = DatabaseHelper.ColumnExists(reader, "netProfitAttributableYearOnYearGrowth") ? reader["netProfitAttributableYearOnYearGrowth"].ToString() : "",
                                    deductionOfNonNetProfitYearOnYearGrowth = DatabaseHelper.ColumnExists(reader, "deductionOfNonNetProfitYearOnYearGrowth") ? reader["deductionOfNonNetProfitYearOnYearGrowth"].ToString() : "",
                                    totalOperatingIncomeRingGrowth          = DatabaseHelper.ColumnExists(reader, "totalOperatingIncomeRingGrowth") ? reader["totalOperatingIncomeRingGrowth"].ToString() : "",
                                    netProfitAttributableRingGrowth         = DatabaseHelper.ColumnExists(reader, "netProfitAttributableRingGrowth") ? reader["netProfitAttributableRingGrowth"].ToString() : "",
                                    deductionOfNonNetProfitRingGrowth       = DatabaseHelper.ColumnExists(reader, "deductionOfNonNetProfitRingGrowth") ? reader["deductionOfNonNetProfitRingGrowth"].ToString() : "",
                                    dilutedReturnOnEquity                   = DatabaseHelper.ColumnExists(reader, "dilutedReturnOnEquity") ? reader["dilutedReturnOnEquity"].ToString() : "",
                                    dilutedReturnOnTotalAssets              = DatabaseHelper.ColumnExists(reader, "dilutedReturnOnTotalAssets") ? reader["dilutedReturnOnTotalAssets"].ToString() : "",
                                    grossMargin                             = DatabaseHelper.ColumnExists(reader, "grossMargin") ? reader["grossMargin"].ToString() : "",
                                    netProfitRate                           = DatabaseHelper.ColumnExists(reader, "netProfitRate") ? reader["netProfitRate"].ToString() : ""
                                }
                            };
                            topTenShareholder.lstShareHoldingRecord.Add(record);
                        }
                        catch (Exception ex)
                        {
                            SystemSetting.LogAndDisplayError(ex, "MainForm.cs, line 114");
                        }
                    }
                    if (topTenShareholder.lstShareHoldingRecord.Count > 0)
                    {
                        Views.UI_TopTenShareholder ui = new Views.UI_TopTenShareholder();
                        ui.PopulateDataInTable(topTenShareholder);
                        int heightIntend = (topTenShareholder.lstShareHoldingRecord.Count + 2) * 23 + 38;
                        ui.Height = heightIntend < ui.minimumHeight ? ui.minimumHeight : heightIntend;

                        ui.Dock = DockStyle.Top;
                        this.panel_main.Controls.Add(ui);
                    }
                }
                else
                {
                    MessageBox.Show("未找到记录值!");
                }
            }
            catch (Exception ex1)
            {
                SystemSetting.LogAndDisplayError(ex1, "MainForm.cs, line 124");
            }
        }