|
|
@@ -12,6 +12,11 @@ using System.Text.Json.Serialization;
|
|
|
using System.Drawing.Text;
|
|
|
using System.IO;
|
|
|
|
|
|
+using static ddq.Utility;
|
|
|
+using static ddq.DataAccess;
|
|
|
+using System.Diagnostics.Eventing.Reader;
|
|
|
+using System.Diagnostics.Metrics;
|
|
|
+using Org.BouncyCastle.Bcpg.OpenPgp;
|
|
|
|
|
|
namespace ddq
|
|
|
{
|
|
|
@@ -52,11 +57,6 @@ namespace ddq
|
|
|
|
|
|
fundInfoTable = DataAccess.Get_dd_fund_info(fundId, null, 1);
|
|
|
|
|
|
- bool hasPM = false;
|
|
|
- DataTable dtPM;
|
|
|
- bool hasTER = false;
|
|
|
- DataTable dtTER;
|
|
|
-
|
|
|
if (fundInfoTable != null && fundInfoTable.Rows.Count > 0)
|
|
|
{
|
|
|
|
|
|
@@ -70,96 +70,74 @@ namespace ddq
|
|
|
//
|
|
|
// General Info
|
|
|
//
|
|
|
- this.txtInvestmentObjective.Text = Utility.Json2Text(root, "investmentObjective");
|
|
|
- this.txtBenchmark.Text = Utility.Json2Text(root, "benchmark");
|
|
|
- this.txtInvestmentPhilosophy.Text = Utility.Json2Text(root, "investmentPhilosophy");
|
|
|
- this.txtManagementFee.Text = Utility.Json2Text(root, "managementFee");
|
|
|
- this.txtSubscriptionFee.Text = Utility.Json2Text(root, "subscriptionFee");
|
|
|
- this.txtRedemptionFee.Text = Utility.Json2Text(root, "redemptionFee");
|
|
|
- this.txtAdministrationFee.Text = Utility.Json2Text(root, "administrationFee");
|
|
|
- this.txtSwitchingFee.Text = Utility.Json2Text(root, "switchingFee");
|
|
|
- this.txtTrusteeFee.Text = Utility.Json2Text(root, "trusteeFee");
|
|
|
- this.txtPerformanceFee.Text = Utility.Json2Text(root, "performanceFee");
|
|
|
- this.txtPolicyOfClosingFund.Text = Utility.Json2Text(root, "policyOfClosingFund");
|
|
|
-
|
|
|
- JsonElement elmPM;
|
|
|
- hasPM = root.TryGetProperty("portfolioManagers", out elmPM);
|
|
|
+ LoadTextDataFromJson(this.txtInvestmentObjective, root, "investmentObjective", this.tspInvestmentObjective);
|
|
|
|
|
|
- if (hasPM == true)
|
|
|
- {
|
|
|
- dtPM = Utility.Json2Table(elmPM);
|
|
|
- InitPortfolioManagerGrid(dtPM);
|
|
|
- }
|
|
|
+ LoadTextDataFromJson(this.txtBenchmark, root, "benchmark", this.tspBenchmark);
|
|
|
+
|
|
|
+ LoadTextDataFromJson(this.txtInvestmentPhilosophy, root, "investmentPhilosophy", this.tspInvestmentPhilosophy);
|
|
|
|
|
|
- JsonElement elmTER;
|
|
|
- hasTER = root.TryGetProperty("ter", out elmTER);
|
|
|
+ LoadCurrentFees(root);
|
|
|
|
|
|
- if (hasTER == true)
|
|
|
- {
|
|
|
- dtTER = Utility.Json2Table(elmTER);
|
|
|
- InitTERGrid(dtTER);
|
|
|
- }
|
|
|
+ LoadTextDataFromJson(this.txtPolicyOfClosingFund, root, "policyOfClosingFund", this.tspPolicyOfClosingFund);
|
|
|
+
|
|
|
+ LoadPortfolioManager(root);
|
|
|
+
|
|
|
+ LoadTER(root);
|
|
|
|
|
|
//
|
|
|
// Process
|
|
|
//
|
|
|
- this.chkAllowDerivatives.Checked = Utility.Json2Text(root, "allowDerivatives").ToLower() == "true" ? true : false;
|
|
|
- this.chkUseDerivatives.Checked = Utility.Json2Text(root, "useDerivatives").ToLower() == "true" ? true : false;
|
|
|
- this.chkDerivativesForEfficent.Checked = this.chkUseDerivatives.Checked == true ? Utility.Json2Text(root, "drvForEffPM").ToLower() == "true" ? true : false : false;
|
|
|
- if (this.chkUseDerivatives.Checked == true)
|
|
|
- {
|
|
|
- this.chkDerivativesForEfficent.Checked = Utility.Json2Text(root, "drvForEffPM").ToLower() == "true" ? true : false;
|
|
|
- this.chkDerivatesForHedging.Checked = Utility.Json2Text(root, "drvForHedging").ToLower() == "true" ? true : false;
|
|
|
- this.chkDerivativesForMarket.Checked = Utility.Json2Text(root, "drvForMktAcs").ToLower() == "true" ? true : false;
|
|
|
- this.chkDerivatesForLeverage.Checked = Utility.Json2Text(root, "drvForLeverage").ToLower() == "true" ? true : false;
|
|
|
- }
|
|
|
- this.chkPriceTarget.Checked = Utility.Json2Text(root, "priceTarget").ToLower() == "true" ? true : false;
|
|
|
- if (this.chkPriceTarget.Checked == true)
|
|
|
- {
|
|
|
- this.txtOverrunPriceTarget.Text = Utility.Json2Text(root, "overrunPriceTarget");
|
|
|
- }
|
|
|
+ LoadDerivates(root);
|
|
|
+
|
|
|
+ LoadPriceTarget(root);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (hasPM == false)
|
|
|
- {
|
|
|
- dtPM = new DataTable();
|
|
|
+ }
|
|
|
|
|
|
- // 没有基金经理数据时,初始化表
|
|
|
- dtPM.Columns.Add("personnel_id", typeof(string));
|
|
|
- dtPM.Columns.Add("name", typeof(string));
|
|
|
- dtPM.Columns.Add("startDate", typeof(DateTime));
|
|
|
- dtPM.Columns.Add("endDate", typeof(DateTime));
|
|
|
|
|
|
- InitPortfolioManagerGrid(dtPM);
|
|
|
- }
|
|
|
+ private void LoadPortfolioManager(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ bool hasData = jsonElement.TryGetProperty("portfolioManagers", out JsonElement element);
|
|
|
|
|
|
- if (hasTER == false)
|
|
|
+ string strUpdateTime = "";
|
|
|
+
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+
|
|
|
+ if (hasData == true && element.ValueKind == JsonValueKind.Object)
|
|
|
{
|
|
|
- dtTER = new DataTable();
|
|
|
+ hasData &= element.TryGetProperty("v", out JsonElement elm);
|
|
|
|
|
|
- dtTER.Columns.Add("year", typeof(int));
|
|
|
- dtTER.Columns.Add("ter", typeof(decimal));
|
|
|
+ Utility.DDData dddata = Utility.Json2Table2(element);
|
|
|
|
|
|
- int year = DateTime.Today.Year - 1;
|
|
|
- for (int i = 0; i < 5; i++)
|
|
|
+ if (dddata != null)
|
|
|
{
|
|
|
- DataRow row = dtTER.NewRow();
|
|
|
- row["year"] = year - i;
|
|
|
- dtTER.Rows.Add(row);
|
|
|
+ dt = (DataTable)dddata.Value;
|
|
|
+
|
|
|
+ strUpdateTime = dddata.UpdateTime;
|
|
|
}
|
|
|
|
|
|
- InitTERGrid(dtTER);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 没有基金经理数据时,初始化表
|
|
|
+ dt.Columns.Add("personnel_id", typeof(string));
|
|
|
+ dt.Columns.Add("name", typeof(string));
|
|
|
+ dt.Columns.Add("startDate", typeof(DateTime));
|
|
|
+ dt.Columns.Add("endDate", typeof(DateTime));
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
+ InitPortfolioManagerGrid(dt, strUpdateTime);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- private void InitPortfolioManagerGrid(DataTable dt)
|
|
|
+ private void InitPortfolioManagerGrid(DataTable dt, string updateTime)
|
|
|
{
|
|
|
+ if (dt == null && updateTime == null) return;
|
|
|
+
|
|
|
this.grdPortfolioManager.DataSource = dt;
|
|
|
|
|
|
this.grdPortfolioManager.Columns["personnel_id"].Visible = false;
|
|
|
@@ -168,17 +146,91 @@ namespace ddq
|
|
|
this.grdPortfolioManager.Columns["name"].DisplayIndex = 0;
|
|
|
|
|
|
this.grdPortfolioManager.Columns["startDate"].HeaderText = "Start Date";
|
|
|
- this.grdPortfolioManager.Columns["startDate"].DefaultCellStyle.Format = "d";
|
|
|
+ this.grdPortfolioManager.Columns["startDate"].DefaultCellStyle.Format = "yyyy-MM-dd";
|
|
|
this.grdPortfolioManager.Columns["startDate"].DisplayIndex = 1;
|
|
|
|
|
|
this.grdPortfolioManager.Columns["endDate"].HeaderText = "End Date";
|
|
|
this.grdPortfolioManager.Columns["endDate"].DefaultCellStyle.Format = "yyyy-MM-dd";
|
|
|
this.grdPortfolioManager.Columns["endDate"].DisplayIndex = 2;
|
|
|
+
|
|
|
+ this.tspPortfolioManager.Text = updateTime;
|
|
|
+ this.tspPortfolioManager.ForeColor = IsChangedRecently(this.tspPortfolioManager.Text) ? COLOR_MODIFIED : COLOR_NORMAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void LoadCurrentFees(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ if (jsonElement.ValueKind != JsonValueKind.Object) return;
|
|
|
+
|
|
|
+ bool hasData = jsonElement.TryGetProperty("currentFees", out JsonElement element);
|
|
|
+
|
|
|
+ if (hasData)
|
|
|
+ {
|
|
|
+ if (element.ValueKind == JsonValueKind.Object)
|
|
|
+ {
|
|
|
+ hasData = element.TryGetProperty("v", out JsonElement elm);
|
|
|
+
|
|
|
+ if (hasData)
|
|
|
+ {
|
|
|
+ this.txtManagementFee.Text = Json2Text(elm, "managementFee");
|
|
|
+ this.txtSubscriptionFee.Text = Json2Text(elm, "subscriptionFee");
|
|
|
+ this.txtRedemptionFee.Text = Json2Text(elm, "redemptionFee");
|
|
|
+ this.txtAdministrationFee.Text = Json2Text(elm, "administrationFee");
|
|
|
+ this.txtSwitchingFee.Text = Json2Text(elm, "switchingFee");
|
|
|
+ this.txtTrusteeFee.Text = Json2Text(elm, "trusteeFee");
|
|
|
+ this.txtPerformanceFee.Text = Json2Text(elm, "performanceFee");
|
|
|
+
|
|
|
+ this.tspCurrentFee.Text = element.GetProperty("t").ToString();
|
|
|
+ this.tspCurrentFee.ForeColor = IsChangedRecently(this.tspCurrentFee.Text) ? COLOR_MODIFIED : COLOR_NORMAL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void InitTERGrid(DataTable dt)
|
|
|
+ private void LoadTER(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ bool hasData = jsonElement.TryGetProperty("totalExpenseRatio", out JsonElement element);
|
|
|
+
|
|
|
+ string strUpdateTime = "";
|
|
|
+
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+
|
|
|
+ if (hasData == true && element.ValueKind == JsonValueKind.Object)
|
|
|
+ {
|
|
|
+ hasData &= element.TryGetProperty("v", out JsonElement elm);
|
|
|
+
|
|
|
+ Utility.DDData dddata = Utility.Json2Table2(element);
|
|
|
+
|
|
|
+ if (dddata != null)
|
|
|
+ {
|
|
|
+ dt = (DataTable)dddata.Value;
|
|
|
+
|
|
|
+ strUpdateTime = dddata.UpdateTime;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt.Columns.Add("year", typeof(string));
|
|
|
+ dt.Columns.Add("ter", typeof(string));
|
|
|
+
|
|
|
+ int year = DateTime.Today.Year - 1;
|
|
|
+ for (int i = 0; i < 5; i++)
|
|
|
+ {
|
|
|
+ DataRow row = dt.NewRow();
|
|
|
+ row["year"] = year - i;
|
|
|
+ dt.Rows.Add(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ InitTERGrid(dt, strUpdateTime);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitTERGrid(DataTable dt, string updateTime)
|
|
|
{
|
|
|
+ if (dt == null || updateTime == null) return;
|
|
|
+
|
|
|
this.grdTER.DataSource = dt;
|
|
|
this.grdTER.Columns["year"].HeaderText = "Year";
|
|
|
this.grdTER.Columns["year"].ReadOnly = true;
|
|
|
@@ -189,6 +241,62 @@ namespace ddq
|
|
|
this.grdTER.Columns["ter"].DefaultCellStyle.Format = "N3";
|
|
|
this.grdTER.Columns["ter"].DisplayIndex = 1;
|
|
|
|
|
|
+ this.tspTER.Text = updateTime;
|
|
|
+ this.tspTER.ForeColor = Utility.IsChangedRecently(updateTime) ? COLOR_MODIFIED : COLOR_NORMAL;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void LoadDerivates(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ if (jsonElement.ValueKind != JsonValueKind.Object) return;
|
|
|
+
|
|
|
+ bool hasData = jsonElement.TryGetProperty("derivatives", out JsonElement element);
|
|
|
+
|
|
|
+ if (hasData)
|
|
|
+ {
|
|
|
+ if (element.ValueKind == JsonValueKind.Object)
|
|
|
+ {
|
|
|
+ hasData = element.TryGetProperty("v", out JsonElement elm);
|
|
|
+
|
|
|
+ if (hasData)
|
|
|
+ {
|
|
|
+ this.chkAllowDerivatives.Checked = Json2Boolean(elm, "allowed");
|
|
|
+ this.chkUseDerivatives.Checked = Json2Boolean(elm, "currentUse");
|
|
|
+ this.chkDerivativesForEfficent.Checked = Json2Boolean(elm, "effectiveManagement");
|
|
|
+ this.chkDerivatesForHedging.Checked = Json2Boolean(elm, "hedging");
|
|
|
+ this.chkDerivativesForMarket.Checked = Json2Boolean(elm, "marketAccess");
|
|
|
+ this.chkDerivatesForLeverage.Checked = Json2Boolean(elm, "leverage");
|
|
|
+
|
|
|
+ this.tspDerivatives.Text = element.GetProperty("t").ToString();
|
|
|
+ this.tspDerivatives.ForeColor = IsChangedRecently(this.tspDerivatives.Text) ? COLOR_MODIFIED : COLOR_NORMAL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void LoadPriceTarget(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ if (jsonElement.ValueKind != JsonValueKind.Object) return;
|
|
|
+
|
|
|
+ bool hasData = jsonElement.TryGetProperty("priceTarget", out JsonElement element);
|
|
|
+
|
|
|
+ if (hasData)
|
|
|
+ {
|
|
|
+ if (element.ValueKind == JsonValueKind.Object)
|
|
|
+ {
|
|
|
+ hasData = element.TryGetProperty("v", out JsonElement elm);
|
|
|
+
|
|
|
+ if (hasData)
|
|
|
+ {
|
|
|
+ this.chkPriceTarget.Checked = Json2Boolean(elm, "assigned");
|
|
|
+ this.txtOverrunPriceTarget.Text = Json2Text(elm, "overrun");
|
|
|
+
|
|
|
+ this.tspPriceTarget.Text = element.GetProperty("t").ToString();
|
|
|
+ this.tspPriceTarget.ForeColor = IsChangedRecently(this.tspPriceTarget.Text) ? COLOR_MODIFIED : COLOR_NORMAL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void FundQ_Load(object sender, EventArgs e)
|
|
|
@@ -203,31 +311,43 @@ namespace ddq
|
|
|
// 数据对象
|
|
|
var textData = new
|
|
|
{
|
|
|
- fundId = this.fundId,
|
|
|
// -- General Info --
|
|
|
- investmentObjective = this.txtInvestmentObjective.Text,
|
|
|
- benchmark = this.txtBenchmark.Text,
|
|
|
- investmentPhilosophy = this.txtInvestmentPhilosophy.Text,
|
|
|
- portfolioManagers = Utility.DataTable2List((DataTable)this.grdPortfolioManager.DataSource),
|
|
|
- ter = Utility.DataTable2List((DataTable)this.grdTER.DataSource),
|
|
|
- managementFee = this.txtManagementFee.Text,
|
|
|
- subscriptionFee = this.txtSubscriptionFee.Text,
|
|
|
- redemptionFee = this.txtRedemptionFee.Text,
|
|
|
- administrationFee = this.txtAdministrationFee.Text,
|
|
|
- switchingFee = this.txtSwitchingFee.Text,
|
|
|
- trusteeFee = this.txtTrusteeFee.Text,
|
|
|
- performanceFee = this.txtPerformanceFee.Text,
|
|
|
- policyOfClosingFund = this.txtPolicyOfClosingFund.Text,
|
|
|
+ investmentObjective = AddInfo(this.txtInvestmentObjective.Text, userId),
|
|
|
+ benchmark = AddInfo(this.txtBenchmark.Text, userId),
|
|
|
+ investmentPhilosophy = AddInfo(this.txtInvestmentPhilosophy.Text, userId),
|
|
|
+ portfolioManagers = AddInfo(Utility.DataTable2List((DataTable)this.grdPortfolioManager.DataSource), userId),
|
|
|
+ totalExpenseRatio = AddInfo(Utility.DataTable2List((DataTable)this.grdTER.DataSource), userId),
|
|
|
+
|
|
|
+ currentFees = AddInfo(new
|
|
|
+ {
|
|
|
+ managementFee = this.txtManagementFee.Text,
|
|
|
+ subscriptionFee = this.txtSubscriptionFee.Text,
|
|
|
+ redemptionFee = this.txtRedemptionFee.Text,
|
|
|
+ administrationFee = this.txtAdministrationFee.Text,
|
|
|
+ switchingFee = this.txtSwitchingFee.Text,
|
|
|
+ trusteeFee = this.txtTrusteeFee.Text,
|
|
|
+ performanceFee = this.txtPerformanceFee.Text
|
|
|
+ }, userId),
|
|
|
+
|
|
|
+ policyOfClosingFund = AddInfo(this.txtPolicyOfClosingFund.Text, userId),
|
|
|
// -- Process --
|
|
|
- allowDerivatives = this.chkAllowDerivatives.Checked,
|
|
|
- useDerivatives = this.chkUseDerivatives.Checked,
|
|
|
- drvForEffPM = this.chkDerivativesForEfficent.Checked,
|
|
|
- drvForHedging = this.chkDerivatesForHedging.Checked,
|
|
|
- drvForMktAcs = this.chkDerivativesForMarket.Checked,
|
|
|
- drvForLeverage = this.chkDerivatesForLeverage.Checked,
|
|
|
- priceTarget = this.chkPriceTarget.Checked,
|
|
|
- overrunPriceTarget = this.txtOverrunPriceTarget.Text,
|
|
|
- updateTime = DateTime.Now
|
|
|
+
|
|
|
+ derivatives = AddInfo( new
|
|
|
+ {
|
|
|
+ allowed = this.chkAllowDerivatives.Checked,
|
|
|
+ currentUse = this.chkUseDerivatives.Checked,
|
|
|
+ effectiveManagement = this.chkDerivativesForEfficent.Checked,
|
|
|
+ hedging = this.chkDerivatesForHedging.Checked,
|
|
|
+ marketAccess = this.chkDerivativesForMarket.Checked,
|
|
|
+ leverage = this.chkDerivatesForLeverage.Checked
|
|
|
+ }, userId),
|
|
|
+
|
|
|
+ priceTarget = AddInfo( new
|
|
|
+ {
|
|
|
+ assigned = this.chkPriceTarget.Checked,
|
|
|
+ overrun = this.txtOverrunPriceTarget.Text
|
|
|
+ }, userId)
|
|
|
+
|
|
|
};
|
|
|
|
|
|
// 序列化选项
|
|
|
@@ -299,6 +419,19 @@ namespace ddq
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private void chkAllowDerivatives_CheckedChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ bool isChecked = chkAllowDerivatives.Checked;
|
|
|
+
|
|
|
+ this.chkUseDerivatives.Enabled = isChecked;
|
|
|
+
|
|
|
+ if (isChecked == false)
|
|
|
+ {
|
|
|
+ this.chkUseDerivatives.Checked = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void chkUseDerivatives_CheckedChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
|
|
|
@@ -407,5 +540,6 @@ namespace ddq
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|