| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace ddq
- {
- public partial class frmMain : Form
- {
- // 先hard-code公司ID,以后要按照登录用户来判断它的公司归属
- private string companyId = "CO000201PR";
- private int userId = 123;
- private DataTable fundDataTable;
- private DataTable peopleDataTable;
- public frmMain()
- {
- InitializeComponent();
- InitializeData();
- }
- private void InitializeData()
- {
- }
- private void tbcMain_SelectedIndexChanged(object sender, EventArgs e)
- {
- // Request
- if (tbcMain.SelectedIndex == 0) { }
- // Data
- else if (tbcMain.SelectedIndex == 1) {
- LoadFundList(companyId);
- }
- // Setting
- else { };
- }
- private void LoadFundList(string companyId)
- {
- if (fundDataTable == null)
- {
- fundDataTable = DataAccess.Get_fund_list_by_company(companyId, 1, 1000);
- InitFundListGrid(fundDataTable);
- }
- }
- private void InitFundListGrid(DataTable dt)
- {
- this.grdFundList.DataSource = dt;
- this.grdFundList.Columns["fund_id"].Visible = true;
- this.grdFundList.Columns["company_id"].Visible = false;
- this.grdFundList.Columns["fund_short_name"].HeaderText = "Fund Name";
- this.grdFundList.Columns["fund_status"].HeaderText = "Operating Status";
- this.grdFundList.Columns["management_start_date"].HeaderText = "Inception Date";
- this.grdFundList.Columns["management_start_date"].DefaultCellStyle.Format = "yyyy-MM-dd";
- this.grdFundList.Columns["management_end_date"].HeaderText = "Liquidate Date";
- this.grdFundList.Columns["management_end_date"].DefaultCellStyle.Format = "yyyy-MM-dd";
- this.grdFundList.Columns["ret_tenure"].HeaderText = "Return Since Inception";
- this.grdFundList.Columns["ret_tenure"].DefaultCellStyle.Format = "P1";
- }
- private void grdFundList_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- int rowIndex = e.RowIndex;
- int columnIndex = e.ColumnIndex;
- if (columnIndex < 0 || rowIndex < 0) return;
- DataRow row = fundDataTable.Rows[rowIndex];
- // 弹出基金页面
- string entityId = row["fund_id"].ToString();
- if (entityId.Length == 10 && Regex.Match(entityId, "^[HM]F").Success)
- {
- FundQ fundQ = new FundQ(entityId, companyId, userId);
- fundQ.Show();
- }
- }
- private void LoadPeopleList(string companyId)
- {
- if (peopleDataTable == null)
- {
- peopleDataTable = DataAccess.Get_dd_personnel_info(null, companyId);
- InitPeopleListGrid(peopleDataTable);
- }
- }
- private void InitPeopleListGrid(DataTable dt)
- {
- this.grdPeopleList.DataSource = dt;
- this.grdPeopleList.Columns["personnel_id"].Visible = false;
- this.grdPeopleList.Columns["company_id"].Visible = false;
- this.grdPeopleList.Columns["role"].Visible = false;
- this.grdPeopleList.Columns["name"].HeaderText = "Name";
- this.grdPeopleList.Columns["role_desc"].HeaderText = "Role";
- this.grdPeopleList.Columns["title"].HeaderText = "Title";
- this.grdPeopleList.Columns["industry_start_year"].HeaderText = "Industry Start Year";
- this.grdPeopleList.Columns["company_start_year"].HeaderText = "Company Start Year";
- this.grdPeopleList.Columns["bio"].HeaderText = "Bio";
- }
- private void tbcData_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (tbcData.SelectedIndex == 0)
- {
- LoadFundList(companyId);
- }
- else if (tbcData.SelectedIndex == 1)
- {
- LoadPeopleList(companyId);
- }
- else { }
- }
- //
- // People
- //
- private void btnAddPersonn_Click(object sender, EventArgs e)
- {
- LoadPersonnelQ(null);
- }
- private void grdPeopleList_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- int rowIndex = e.RowIndex;
- if (rowIndex < 0) return;
- string personnelId = peopleDataTable.Rows[rowIndex]["personnel_id"].ToString();
- LoadPersonnelQ(personnelId);
- }
- private void LoadPersonnelQ(string personnelId)
- {
- using (PersonnelQ dialog = new PersonnelQ(personnelId, this.companyId, this.userId))
- {
- dialog.StartPosition = FormStartPosition.CenterParent;
- DialogResult result = dialog.ShowDialog(this);
- if (result == DialogResult.OK)
- {
- peopleDataTable = DataAccess.Get_dd_personnel_info(null, this.companyId);
-
- this.grdPeopleList.DataSource = peopleDataTable;
- }
- }
- }
- }
- }
|