DDQ.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Text.RegularExpressions;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace ddq
  12. {
  13. public partial class frmMain : Form
  14. {
  15. // 先hard-code公司ID,以后要按照登录用户来判断它的公司归属
  16. private string companyId = "CO000201PR";
  17. private DataTable fundDataTable;
  18. public frmMain()
  19. {
  20. InitializeComponent();
  21. InitializeData();
  22. }
  23. private void InitializeData()
  24. {
  25. }
  26. private void tbcMain_SelectedIndexChanged(object sender, EventArgs e)
  27. {
  28. if (tbcMain.SelectedIndex == 0) { }
  29. else if (tbcMain.SelectedIndex == 1) {
  30. LoadFundList(companyId);
  31. }
  32. else { };
  33. }
  34. private void LoadFundList(string companyId)
  35. {
  36. if (fundDataTable == null)
  37. {
  38. fundDataTable = DataAccess.Get_fund_list_by_company(companyId, 1, 1000);
  39. this.grdFundList.DataSource = fundDataTable;
  40. }
  41. }
  42. private void grdFundList_CellContentClick(object sender, DataGridViewCellEventArgs e)
  43. {
  44. int rowIndex = e.RowIndex;
  45. int columnIndex = e.ColumnIndex;
  46. if (columnIndex < 0 || rowIndex < 0) return;
  47. DataRow row = fundDataTable.Rows[rowIndex];
  48. // 弹出基金页面
  49. string entityId = row["fund_id"].ToString();
  50. if (entityId.Length == 10 && Regex.Match(entityId, "^[HM]F").Success)
  51. {
  52. FundQ fundQ = new FundQ(entityId);
  53. fundQ.Show();
  54. }
  55. }
  56. }
  57. }