|
@@ -3,6 +3,7 @@ using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Data;
|
|
|
+using System.Diagnostics.Eventing.Reader;
|
|
|
using System.Drawing;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
@@ -13,22 +14,17 @@ namespace DataManager
|
|
|
{
|
|
|
public partial class UIFund : Form
|
|
|
{
|
|
|
-
|
|
|
+ private int userId;
|
|
|
private string fundId = string.Empty;
|
|
|
|
|
|
private DataTable fundInfo = new DataTable();
|
|
|
|
|
|
private DataTable tbNav;
|
|
|
|
|
|
- public UIFund()
|
|
|
- {
|
|
|
- InitializeComponent();
|
|
|
- InitializeData();
|
|
|
- }
|
|
|
-
|
|
|
- public UIFund(string fundId)
|
|
|
+ public UIFund(string fundId, int userId)
|
|
|
{
|
|
|
this.fundId = fundId;
|
|
|
+ this.userId = userId;
|
|
|
|
|
|
InitializeComponent();
|
|
|
InitializeData();
|
|
@@ -36,6 +32,8 @@ namespace DataManager
|
|
|
|
|
|
public string FundId { get { return fundId; } }
|
|
|
|
|
|
+ public int UserId { get { return userId; } }
|
|
|
+
|
|
|
private void InitializeData()
|
|
|
{
|
|
|
txtFundId.Text = fundId;
|
|
@@ -66,6 +64,8 @@ namespace DataManager
|
|
|
lblFundType.Text = "";
|
|
|
|
|
|
lblCompany.Text = fundInfo.Rows[0]["company_name"].ToString();
|
|
|
+ lblCompany.ForeColor = Color.DodgerBlue;
|
|
|
+
|
|
|
lblRegisteDate.Text = fundInfo.Rows[0]["register_date"].ToString();
|
|
|
|
|
|
s = fundInfo.Rows[0]["manager_type"].ToString();
|
|
@@ -91,12 +91,22 @@ namespace DataManager
|
|
|
|
|
|
txtFundShortName.Text = fundInfo.Rows[0]["fund_short_name"].ToString();
|
|
|
|
|
|
- BindingSource bs1 = new BindingSource();
|
|
|
- bs1.DataSource = UIConstants.HedgeFundStrategy;
|
|
|
- cmbStrategy.DataSource = bs1;
|
|
|
+
|
|
|
+ cmbStrategy.DataSource = new BindingSource(UIConstants.HedgeFundStrategy, null); ;
|
|
|
cmbStrategy.DisplayMember = "Value";
|
|
|
cmbStrategy.ValueMember = "Key";
|
|
|
- cmbStrategy.SelectedValue = int.Parse(fundInfo.Rows[0]["strategy"].ToString());
|
|
|
+ s = fundInfo.Rows[0]["strategy"].ToString();
|
|
|
+ int strategyId = -1;
|
|
|
+ if (s != string.Empty) strategyId = int.Parse(s);
|
|
|
+ cmbStrategy.SelectedValue = strategyId;
|
|
|
+
|
|
|
+ cmbSubStrategy.DataSource = new BindingSource(LoadSubStrategy(strategyId), null);
|
|
|
+ cmbSubStrategy.DisplayMember = "Value";
|
|
|
+ cmbSubStrategy.ValueMember = "Key";
|
|
|
+ s = fundInfo.Rows[0]["substrategy"].ToString();
|
|
|
+ int substrategyId = -1;
|
|
|
+ if (s != string.Empty) substrategyId = int.Parse(s);
|
|
|
+ cmbSubStrategy.SelectedValue = substrategyId;
|
|
|
|
|
|
|
|
|
string navFreq = fundInfo.Rows[0]["nav_frequency"].ToString().Trim();
|
|
@@ -127,6 +137,95 @@ namespace DataManager
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void btnSave_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ string fundShortName = txtFundShortName.Text.Trim();
|
|
|
+ int? strategyId = int.Parse(cmbStrategy.SelectedValue.ToString());
|
|
|
+ int? subStrategyId = int.Parse(cmbSubStrategy.SelectedValue.ToString());
|
|
|
+ string parentFundId = txtParentFund.Text.Trim();
|
|
|
+ parentFundId = (string.IsNullOrEmpty(parentFundId) ? null : parentFundId);
|
|
|
+ string navFrequency = cmbNavFrequency.SelectedText.ToString();
|
|
|
+ sbyte isAuthorized = (sbyte)(chkAuthorized.Checked ? 1 : 0);
|
|
|
+ sbyte isRanking = (sbyte)(chkRanking.Checked ? 1 : 0);
|
|
|
+ sbyte isRating = (sbyte)(chkRating.Checked ? 1 : 0);
|
|
|
+
|
|
|
+ DataAccess.Set_dm_fund_information(FundId, fundShortName, strategyId, subStrategyId, parentFundId, navFrequency, isAuthorized, isRanking, isRating, UserId);
|
|
|
+
|
|
|
+ MessageBox.Show("所有更新顺利存盘", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Dictionary<int, string> LoadSubStrategy(int strategyId)
|
|
|
+ {
|
|
|
+ Dictionary<int, string> d;
|
|
|
+ int[] keysToSelect = null;
|
|
|
+
|
|
|
+ switch (cmbStrategy.SelectedValue)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ keysToSelect = new int[] { 1010, 1020, 1030, -1 };
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ keysToSelect = new int[] { 2010, -1 };
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ keysToSelect = new int[] { 3010, 3020, 3030, 3040, 3050, -1 };
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ keysToSelect = new int[] { 4010, 4020, 4030, 4040, -1 };
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ keysToSelect = new int[] { 5010, 5020, 5030, -1 };
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ keysToSelect = new int[] { 6010, 6020, 6030, -1 };
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ keysToSelect = new int[] { 7010, 7020, -1 };
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ keysToSelect = new int[] { 8010, 8020, -1 };
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ keysToSelect = new int[] { -1 };
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ d = UIConstants.HedgeFundSubStrategy.Where(kvp => keysToSelect.Contains(kvp.Key)).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
|
|
|
+
|
|
|
+ return d;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void cmbStrategy_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (cmbStrategy.ContainsFocus)
|
|
|
+ {
|
|
|
+ int strategyId = int.Parse(cmbStrategy.SelectedValue.ToString());
|
|
|
+
|
|
|
+ cmbSubStrategy.DataSource = new BindingSource(LoadSubStrategy(strategyId), null);
|
|
|
+ cmbSubStrategy.DisplayMember = "Value";
|
|
|
+ cmbSubStrategy.ValueMember = "Key";
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void lblCompany_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ string companyId = fundInfo.Rows[0]["advisor_id"].ToString();
|
|
|
+
|
|
|
+ if (companyId.Length == 10)
|
|
|
+ {
|
|
|
+ UICompany frm = new UICompany(companyId, UserId);
|
|
|
+ frm.ShowDialog();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void LoadNavGrid(DateTime? startDate, DateTime? endDate)
|
|
|
{
|
|
|
tbNav = DataAccess.Get_Nav(fundId, startDate, endDate);
|
|
@@ -155,11 +254,6 @@ namespace DataManager
|
|
|
chart.Show();
|
|
|
}
|
|
|
|
|
|
- private void btnSave_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- MessageBox.Show("暂时不做什么事情");
|
|
|
- }
|
|
|
-
|
|
|
private void grdNav_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
|
|
@@ -178,5 +272,7 @@ namespace DataManager
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|