123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace DataManager
- {
- public partial class UIFund : Form
- {
- private string fundId = string.Empty;
- private DataTable fundInfo = new DataTable();
- private DataTable tbNav;
- public UIFund()
- {
- InitializeComponent();
- InitializeData();
- }
- public UIFund(string fundId)
- {
- this.fundId = fundId;
-
- InitializeComponent();
- InitializeData();
- }
- public string FundId { get { return fundId; } }
- private void InitializeData()
- {
- txtFundId.Text = fundId;
- if (fundId != string.Empty)
- {
- fundInfo = DataAccess.Get_dm_fund_information(fundId, null);
- if (fundInfo == null || fundInfo.Rows.Count <= 0)
- {
- lblFundName.Text = string.Format("基金{0}不存在,得跟管理员说一下", fundId);
- lblFundName.ForeColor = Color.Red;
- return;
- }
- lblFundName.Text = fundInfo.Rows[0]["fund_name"].ToString();
- txtFundId.ReadOnly = true;
- txtRegisterCode.Text = fundInfo.Rows[0]["register_number"].ToString();
- txtRegisterCode.ReadOnly = true;
- lblInceptionDate.Text = fundInfo.Rows[0]["inception_date"].ToString();
- string s = fundInfo.Rows[0]["fund_type"].ToString();
- if (s != string.Empty)
- lblFundType.Text = UIConstants.FundType[int.Parse(s)];
- else
- lblFundType.Text = "";
- lblCompany.Text = fundInfo.Rows[0]["company_name"].ToString();
- lblRegisteDate.Text = fundInfo.Rows[0]["register_date"].ToString();
-
- s = fundInfo.Rows[0]["manager_type"].ToString();
- if (s != string.Empty)
- lblManagementType.Text = UIConstants.ManagerType[int.Parse(s)];
- else
- lblManagementType.Text = "";
- s = fundInfo.Rows[0]["base_currency"].ToString();
- if (s != string.Empty)
- lblCurrency.Text = UIConstants.Currency[int.Parse(s)];
- else
- lblCurrency.Text = "";
- s = fundInfo.Rows[0]["fund_status"].ToString();
- if (s != String.Empty)
- lblStatus.Text = UIConstants.FundStatus[int.Parse(s)];
- else
- lblStatus.Text = "";
- lblCustodian.Text = fundInfo.Rows[0]["custodian_name"].ToString();
- lblAmacUpdateDate.Text = fundInfo.Rows[0]["zjx_last_info_update_time"].ToString();
-
- txtFundShortName.Text = fundInfo.Rows[0]["fund_short_name"].ToString();
-
- BindingSource bs1 = new BindingSource();
- bs1.DataSource = UIConstants.HedgeFundStrategy;
- cmbStrategy.DataSource = bs1;
- cmbStrategy.DisplayMember = "Value";
- cmbStrategy.ValueMember = "Key";
- cmbStrategy.SelectedValue = int.Parse(fundInfo.Rows[0]["strategy"].ToString());
- // 净值频率
- string navFreq = fundInfo.Rows[0]["nav_frequency"].ToString().Trim();
- if (string.IsNullOrEmpty(navFreq)) navFreq = "未知";
- cmbNavFrequency.SelectedIndex = cmbNavFrequency.Items.IndexOf(navFreq);
- chkRating.Checked = fundInfo.Rows[0]["is_rating"].ToString() == "1" ? true : false;
- chkRanking.Checked = fundInfo.Rows[0]["is_ranking"].ToString() == "1" ? true : false;
- chkAuthorized.Checked = fundInfo.Rows[0]["is_authorized"].ToString() == "1" ? true : false;
- dtpNavStartDate.ShowCheckBox = true;
- dtpNavStartDate.Checked = false;
- dtpNavStartDate.Value = DateTime.Parse(lblInceptionDate.Text);
- dtpNavEndDate.ShowCheckBox = true;
- dtpNavEndDate.Checked = false;
- LoadNavGrid(null, null);
- }
-
- }
- private void LoadNavGrid(DateTime? startDate, DateTime? endDate)
- {
- tbNav = DataAccess.Get_Nav(fundId, startDate, endDate);
-
- grdNav.DataSource = tbNav;
- grdNav.Columns["fund_id"].Visible = false;
- grdNav.Columns["price_date"].HeaderText = "净值日期";
- grdNav.Columns["nav"].HeaderText = "净值";
- grdNav.Columns["cumulative_nav_withdrawal"].HeaderText = "现金分红累计净值";
- grdNav.Columns["cumulative_nav"].HeaderText = "分红再投累计净值";
- grdNav.Columns["cumulative_nav"].DefaultCellStyle.BackColor = Color.AntiqueWhite;
- grdNav.Columns["isvalid"].HeaderText = "状态";
- grdNav.Columns["creatorid"].HeaderText = "创建";
- grdNav.Columns["createtime"].HeaderText = "创建日期";
- grdNav.Columns["updaterid"].HeaderText = "更新";
- grdNav.Columns["updatetime"].HeaderText = "更新日期";
- grdNav.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
- grdNav.RowHeadersVisible = false;
- }
- private void btnDrawNavLineChart_Click(object sender, EventArgs e)
- {
- NavChart chart = new NavChart(FundId, tbNav);
- chart.Show();
- }
- private void btnSave_Click(object sender, EventArgs e)
- {
- MessageBox.Show("暂时不做什么事情");
- }
- private void grdNav_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- //int rowIndex = e.RowIndex;
- //int columnIndex = e.ColumnIndex;
- //if (rowIndex < 0 || columnIndex < 0) return;
- //DataGridViewRow row = grdNav.Rows[rowIndex];
- //if(row == null) return;
- }
- }
- }
|