Joey il y a 6 mois
Parent
commit
8ff3cb63d6
5 fichiers modifiés avec 1281 ajouts et 0 suppressions
  1. 628 0
      DataAccess.cs
  2. 178 0
      NavChart.Designer.cs
  3. 193 0
      NavChart.cs
  4. 120 0
      NavChart.resx
  5. 162 0
      UIFund.cs

+ 628 - 0
DataAccess.cs

@@ -0,0 +1,628 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Common;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Configuration;
+
+using MySql.Data.MySqlClient;
+using System.Runtime.InteropServices.ComTypes;
+using static DataManager.UIConstants;
+using System.ComponentModel.Design;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
+using System.Xml.Linq;
+
+namespace DataManager
+{
+    public class DataAccess
+    {
+        private static String connectionString = ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString;
+
+        public const sbyte DM_NULL = -99;
+
+        public static DataTable Get_cm_user_by_cellphone(string cellphone)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_cm_user_by_cellphone", connection);
+
+            MySqlParameter i_cellphone = new MySqlParameter("i_cellphone", cellphone);
+
+            ad.SelectCommand.Parameters.Add(i_cellphone);
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+
+
+        public static DataTable Get_dm_user(int? userId, sbyte? role)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_user", connection);
+
+            MySqlParameter i_userid = new MySqlParameter("i_userid", userId);
+            MySqlParameter i_role = new MySqlParameter("i_role", role);
+
+            ad.SelectCommand.Parameters.Add(i_userid);
+            ad.SelectCommand.Parameters.Add(i_role);
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+
+
+        /// <summary>
+        /// 取数据采集任务列表
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <param name="taskId"></param>
+        /// <param name="companyId"></param>
+        /// <param name="taskDate"></param>
+        /// <param name="taskType"></param>
+        /// <param name="isValid"></param>
+        /// <returns></returns>
+        public static DataTable Get_dm_collection_task(int? userId, int? taskId, string providerId, string providerKeyword,
+                                                       DateTime? taskDate, short? taskType, string entityId, string entityKeyword, sbyte? isValid)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_collection_task", connection);
+
+            MySqlParameter i_userid = new MySqlParameter("i_userid", userId);
+            MySqlParameter i_task_id = new MySqlParameter("i_task_id", taskId);
+            MySqlParameter i_provider_id = new MySqlParameter("i_provider_id", providerId);
+            MySqlParameter i_provider_keyword = new MySqlParameter("i_provider_keyword", providerKeyword);
+            MySqlParameter i_task_date = new MySqlParameter("i_task_date", taskDate);
+            MySqlParameter i_task_type = new MySqlParameter("i_task_type", taskType);
+            MySqlParameter i_entity_id = new MySqlParameter("i_entity_id", entityId);
+            MySqlParameter i_entity_keywordword = new MySqlParameter("i_entity_keyword", entityKeyword);
+            MySqlParameter i_isvalid = new MySqlParameter("i_isvalid", isValid);
+
+            ad.SelectCommand.Parameters.Add(i_userid);
+            ad.SelectCommand.Parameters.Add(i_task_id);
+            ad.SelectCommand.Parameters.Add(i_provider_id);
+            ad.SelectCommand.Parameters.Add(i_provider_keyword);
+            ad.SelectCommand.Parameters.Add(i_task_date);
+            ad.SelectCommand.Parameters.Add(i_task_type);
+            ad.SelectCommand.Parameters.Add(i_entity_id);
+            ad.SelectCommand.Parameters.Add(i_entity_keywordword);
+            ad.SelectCommand.Parameters.Add(i_isvalid);
+
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+        public static void Set_dm_collection_task(int? taskId, string providerId, DateTime taskDate, Int16 taskType, 
+                                                  string entityId, string errMessage,
+                                                  sbyte isvalid, int userId, out int task_id)
+        {
+
+            task_id = 0;
+
+            using (MySqlConnection connection = new MySqlConnection(connectionString))
+            {
+
+                connection.Open();
+
+                MySqlCommand cmd = new MySqlCommand("sp_set_dm_collection_task", connection);
+
+                MySqlParameter i_task_id = new MySqlParameter("i_task_id", taskId);
+                MySqlParameter i_provider_id = new MySqlParameter("i_provider_id", providerId);
+                MySqlParameter i_task_date = new MySqlParameter("i_task_date", taskDate);
+                MySqlParameter i_task_type = new MySqlParameter("i_task_type", taskType);
+                MySqlParameter i_entity_id = new MySqlParameter("i_entity_id", entityId);
+                MySqlParameter i_err_message = new MySqlParameter("i_err_message", errMessage);
+                MySqlParameter i_isvalid = new MySqlParameter("i_isvalid", isvalid);
+                MySqlParameter i_user_id = new MySqlParameter("i_user_id", userId);
+
+                MySqlParameter o_task_id = new MySqlParameter("o_task_id", DbType.Int32);
+                o_task_id.Direction = ParameterDirection.Output;
+
+                cmd.Parameters.Add(i_task_id);
+                cmd.Parameters.Add(i_provider_id);
+                cmd.Parameters.Add(i_task_date);
+                cmd.Parameters.Add(i_task_type);
+                cmd.Parameters.Add(i_isvalid);
+                cmd.Parameters.Add(i_entity_id);
+                cmd.Parameters.Add(i_err_message);
+                cmd.Parameters.Add(i_user_id);
+                cmd.Parameters.Add(o_task_id);
+
+                cmd.CommandType = CommandType.StoredProcedure;
+
+
+                cmd.Connection = connection;
+                cmd.ExecuteNonQuery();
+
+                task_id = int.Parse(cmd.Parameters["o_task_id"].Value.ToString());
+            }
+
+        }
+
+        /// <summary>
+        /// 取公司联系任务列表
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <param name="taskId"></param>
+        /// <param name="companyId"></param>
+        /// <param name="taskDate"></param>
+        /// <param name="taskType"></param>
+        /// <param name="isValid"></param>
+        /// <param name="priority"></param>
+        /// <param name="followUpDate"></param>
+        /// <param name="companyAsset"></param>
+        /// <returns></returns>
+        public static DataTable Get_dm_contact_task(int? userId, int? taskId, string companyId, string companyKeyword,
+                                                    DateTime? taskDate, short? taskType, sbyte? isValid, sbyte? priority, 
+                                                    DateTime? followUpDate, sbyte? companyAsset)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_contact_task", connection);
+
+            MySqlParameter i_userid = new MySqlParameter("i_userid", userId);
+            MySqlParameter i_task_id = new MySqlParameter("i_task_id", taskId);
+            MySqlParameter i_company_id = new MySqlParameter("i_company_id", companyId);
+            MySqlParameter i_company_keyword = new MySqlParameter("i_company_keyword", companyKeyword);
+            MySqlParameter i_task_date = new MySqlParameter("i_task_date", taskDate);
+            MySqlParameter i_task_type = new MySqlParameter("i_task_type", taskType);
+            MySqlParameter i_isvalid = new MySqlParameter("i_isvalid", isValid);
+            MySqlParameter i_priority = new MySqlParameter("i_priority", priority);
+            MySqlParameter i_follow_up_date = new MySqlParameter("i_follow_up_date", followUpDate);
+            MySqlParameter i_company_asset_size = new MySqlParameter("i_company_asset_size", companyAsset);
+
+            ad.SelectCommand.Parameters.Add(i_userid);
+            ad.SelectCommand.Parameters.Add(i_task_id);
+            ad.SelectCommand.Parameters.Add(i_company_id);
+            ad.SelectCommand.Parameters.Add(i_company_keyword);
+            ad.SelectCommand.Parameters.Add(i_task_date);
+            ad.SelectCommand.Parameters.Add(i_task_type);
+            ad.SelectCommand.Parameters.Add(i_isvalid);
+            ad.SelectCommand.Parameters.Add(i_priority);
+            ad.SelectCommand.Parameters.Add(i_follow_up_date);
+            ad.SelectCommand.Parameters.Add(i_company_asset_size);
+
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+        /// <summary>
+        /// 更新联系任务表
+        /// </summary>
+        /// <param name="taskId"></param>
+        /// <param name="companyId"></param>
+        /// <param name="taskDate"></param>
+        /// <param name="taskType"></param>
+        /// <param name="isvalid"></param>
+        /// <param name="priority"></param>
+        /// <param name="followUpDate"></param>
+        /// <param name="userId"></param>
+        public static void Set_dm_contact_task(int? taskId, string companyId, DateTime taskDate, Int16 taskType, sbyte isvalid,
+                                               sbyte priority, DateTime? followUpDate, int userId, out int task_id)
+        {
+
+            task_id = 0;
+
+            using (MySqlConnection connection = new MySqlConnection(connectionString))
+            {
+
+                connection.Open();
+
+                MySqlCommand cmd = new MySqlCommand("sp_set_dm_contact_task", connection);
+
+                MySqlParameter i_task_id = new MySqlParameter("i_task_id", taskId);
+                MySqlParameter i_company_id = new MySqlParameter("i_company_id", companyId);
+                MySqlParameter i_task_date = new MySqlParameter("i_task_date", taskDate);
+                MySqlParameter i_task_type = new MySqlParameter("i_task_type", taskType);
+                MySqlParameter i_isvalid = new MySqlParameter("i_isvalid", isvalid);
+                MySqlParameter i_priority = new MySqlParameter("i_priority", priority);
+                MySqlParameter i_follow_up_date = new MySqlParameter("i_follow_up_date", followUpDate);
+                MySqlParameter i_user_id = new MySqlParameter("i_user_id", userId);
+
+                MySqlParameter o_task_id = new MySqlParameter("o_task_id", DbType.Int32);
+                o_task_id.Direction = ParameterDirection.Output;
+
+                cmd.Parameters.Add(i_task_id);
+                cmd.Parameters.Add(i_company_id);
+                cmd.Parameters.Add(i_task_date);
+                cmd.Parameters.Add(i_task_type);
+                cmd.Parameters.Add(i_isvalid);
+                cmd.Parameters.Add(i_priority);
+                cmd.Parameters.Add(i_follow_up_date);
+                cmd.Parameters.Add(i_user_id);
+                cmd.Parameters.Add(o_task_id);
+
+                cmd.CommandType = CommandType.StoredProcedure;
+
+
+                cmd.Connection = connection;
+                cmd.ExecuteNonQuery();
+
+                task_id = int.Parse(cmd.Parameters["o_task_id"].Value.ToString());
+            }
+
+        }
+        /// <summary>
+        /// 取基金基本信息
+        /// </summary>
+        /// <param name="fundId"></param>
+        /// <returns></returns>
+        public static DataTable Get_dm_fund_information(string fundId, string companyId)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_fund_information", connection);
+
+            MySqlParameter i_fundId = new MySqlParameter("i_fund_id", fundId);
+            MySqlParameter i_company_id = new MySqlParameter("i_company_id", companyId);
+
+            ad.SelectCommand.Parameters.Add(i_fundId);
+            ad.SelectCommand.Parameters.Add(i_company_id);
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+
+        }
+
+        public static DataTable Get_dm_company_information(string companyId)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_company_information", connection);
+
+            MySqlParameter i_company_id = new MySqlParameter("i_company_id", companyId);
+
+            ad.SelectCommand.Parameters.Add(i_company_id);
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+
+        }
+
+
+        /// <summary>
+        /// 搜索公司(目前仅支持对 company_short_name 的搜索)
+        /// </summary>
+        /// <param name="companyType"></param> 私募证券:1
+        /// <param name="keyWord"></param>
+        /// <returns></returns>
+        public static DataTable Search_dm_company(int? companyType, string keyWord)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_dm_search_company", connection);
+
+            MySqlParameter i_companyType = new MySqlParameter("i_company_type", companyType);
+            MySqlParameter i_keyWord = new MySqlParameter("i_key_word", keyWord);
+
+            ad.SelectCommand.Parameters.Add(i_companyType);
+            ad.SelectCommand.Parameters.Add(i_keyWord);
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+
+        }
+
+        /// <summary>
+        /// 搜索基金(目前仅支持对 fund_short_name 的搜索)
+        /// </summary>
+        /// <param name="raiseType"></param> 私募:1、公募:2
+        /// <param name="keyWord"></param>
+        /// <returns></returns>
+        public static DataTable Search_dm_fund(int? raiseType, string keyWord)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_dm_search_fund", connection);
+
+            MySqlParameter i_raise_type = new MySqlParameter("i_raise_type", raiseType);
+            MySqlParameter i_keyWord = new MySqlParameter("i_key_word", keyWord);
+
+            ad.SelectCommand.Parameters.Add(i_raise_type);
+            ad.SelectCommand.Parameters.Add(i_keyWord);
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+
+        }
+
+        public static DataTable Get_Nav(string fundId, DateTime? startDate, DateTime? endDate)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_nav", connection);
+
+            MySqlParameter i_fund_id = new MySqlParameter("i_fund_id", fundId);
+            MySqlParameter i_start_date = new MySqlParameter("i_start_date", startDate);
+            MySqlParameter i_end_date = new MySqlParameter("i_end_date", endDate);
+
+            ad.SelectCommand.Parameters.Add(i_fund_id);
+            ad.SelectCommand.Parameters.Add(i_start_date);
+            ad.SelectCommand.Parameters.Add(i_end_date);
+
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+
+        public static DataTable Get_dm_memo(sbyte jobType, int taskId)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_task_memo", connection);
+
+            MySqlParameter i_job_type = new MySqlParameter("i_job_type", jobType);
+            MySqlParameter i_task_id = new MySqlParameter("i_task_id", taskId);
+
+            ad.SelectCommand.Parameters.Add(i_job_type);
+            ad.SelectCommand.Parameters.Add(i_task_id);
+
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+
+        public static void Set_dm_memo(sbyte jobType, int taskId, string memo, int userId)
+        {
+            using (MySqlConnection connection = new MySqlConnection(connectionString))
+            {
+
+                connection.Open();
+
+                MySqlCommand cmd = new MySqlCommand("sp_set_dm_task_memo", connection);
+
+                MySqlParameter i_job_type = new MySqlParameter("i_job_type", jobType);
+                MySqlParameter i_task_id = new MySqlParameter("i_task_id", taskId);
+                MySqlParameter i_memo = new MySqlParameter("i_memo", memo);
+                MySqlParameter i_userid = new MySqlParameter("i_userid", userId);
+
+                cmd.Parameters.Add(i_job_type);
+                cmd.Parameters.Add(i_task_id);
+                cmd.Parameters.Add(i_memo);
+                cmd.Parameters.Add(i_userid);
+
+                cmd.CommandType = CommandType.StoredProcedure;
+
+
+                cmd.Connection = connection;
+                cmd.ExecuteNonQuery();
+            }
+        }
+
+        public static DataTable Get_dm_contacts(string companyId)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_dm_get_contacts", connection);
+
+            MySqlParameter i_company_id = new MySqlParameter("i_company_id", companyId);
+
+            ad.SelectCommand.Parameters.Add(i_company_id);
+
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+
+
+        public static int Set_dm_contacts(DataTable dt, string companyId, int userId)
+        {
+            int ret = 0;
+
+            if (dt == null || dt.Rows.Count <= 0) { return ret; }
+
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                DataRow dataRow = dt.Rows[i];
+
+                int o_id;
+
+                if (dataRow.RowState == DataRowState.Deleted)
+                {
+                    Set_dm_contacts(int.Parse(dataRow["id", DataRowVersion.Original].ToString()), dataRow["company_id", DataRowVersion.Original].ToString(),
+                                    dataRow["name", DataRowVersion.Original].ToString(), dataRow["role", DataRowVersion.Original].ToString(),
+                                    dataRow["phone", DataRowVersion.Original].ToString(), dataRow["wechat", DataRowVersion.Original].ToString(),
+                                    dataRow["email", DataRowVersion.Original].ToString(),
+                                    0, userId, out o_id);
+
+                    ret++;
+                }
+                else if (dataRow.RowState == DataRowState.Added || dataRow.RowState == DataRowState.Modified)
+                {
+
+                    int? id = null;
+                    if (string.IsNullOrEmpty(dataRow["id"].ToString()) == false)
+                        id = int.Parse(dataRow["id"].ToString());
+
+
+                    Set_dm_contacts(id, companyId, dataRow["name"].ToString(), dataRow["role"].ToString(), dataRow["phone"].ToString(),
+                                                   dataRow["wechat"].ToString(), dataRow["email"].ToString(),
+                                                   1, userId, out o_id);
+
+                    if (dataRow.RowState == DataRowState.Added)
+                    {
+                        dataRow["id"] = o_id;
+                        dataRow["company_id"] = companyId;
+                    }
+
+                    ret++;
+                }
+            }
+
+            return ret;
+        }
+
+        public static void Set_dm_contacts(int? id, string companyId, string name, string role, string phone, 
+                                           string wechat, string email, sbyte isvalid, int userId, out int out_id)
+        {
+            using (MySqlConnection connection = new MySqlConnection(connectionString))
+            {
+
+                connection.Open();
+
+                MySqlCommand cmd = new MySqlCommand("sp_dm_set_contacts", connection);
+
+                MySqlParameter i_id = new MySqlParameter("i_id", id);
+                MySqlParameter i_company_id = new MySqlParameter("i_company_id", companyId);
+                MySqlParameter i_name = new MySqlParameter("i_name", name);
+                MySqlParameter i_role = new MySqlParameter("i_role", role);
+                MySqlParameter i_phone = new MySqlParameter("i_phone", phone);
+                MySqlParameter i_wechat = new MySqlParameter("i_wechat", wechat);
+                MySqlParameter i_email = new MySqlParameter("i_email", email);
+                MySqlParameter i_isvalid = new MySqlParameter("i_isvalid", isvalid);
+                MySqlParameter i_userid = new MySqlParameter("i_userid", userId);
+                
+                MySqlParameter o_id = new MySqlParameter("o_id", DbType.Int32);
+                o_id.Direction = ParameterDirection.Output;
+
+                cmd.Parameters.Add(i_id);
+                cmd.Parameters.Add(i_company_id);
+                cmd.Parameters.Add(i_name);
+                cmd.Parameters.Add(i_role);
+                cmd.Parameters.Add(i_phone);
+                cmd.Parameters.Add(i_wechat);
+                cmd.Parameters.Add(i_email);
+                cmd.Parameters.Add(i_isvalid);
+                cmd.Parameters.Add(i_userid);
+                cmd.Parameters.Add(o_id);
+
+                cmd.CommandType = CommandType.StoredProcedure;
+
+
+                cmd.Connection = connection;
+                cmd.ExecuteNonQuery();
+
+                out_id = int.Parse(cmd.Parameters["o_id"].Value.ToString());
+            }
+        }
+
+        public static DataTable Get_dm_company_cover(string companyId, sbyte? coverType, int? userId)
+        {
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_company_cover", connection);
+
+            MySqlParameter i_company_id = new MySqlParameter("i_company_id", companyId);
+            MySqlParameter i_cover_type = new MySqlParameter("i_cover_type", coverType);
+            MySqlParameter i_userid = new MySqlParameter("i_userid", userId);
+
+            ad.SelectCommand.Parameters.Add(i_company_id);
+            ad.SelectCommand.Parameters.Add(i_cover_type);
+            ad.SelectCommand.Parameters.Add(i_userid);
+
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+
+        /// <summary>
+        /// 批量更新公司-对接人员关系
+        /// </summary>
+        /// <param name="updateQuery">Json字符串</param>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        public static int Set_dm_company_cover(string updateQuery, int userId)
+        {
+            int ret = -1;
+
+            using (MySqlConnection connection = new MySqlConnection(connectionString))
+            {
+
+                connection.Open();
+
+                MySqlCommand cmd = new MySqlCommand("sp_set_dm_company_cover", connection);
+
+                MySqlParameter i_update_query = new MySqlParameter("i_update_query", updateQuery);
+                MySqlParameter i_userid = new MySqlParameter("i_userid", userId);
+
+                cmd.Parameters.Add(i_update_query);
+                cmd.Parameters.Add(i_userid);
+
+                cmd.CommandType = CommandType.StoredProcedure;
+
+                cmd.Connection = connection;
+                cmd.ExecuteNonQuery();
+
+                ret = 1;
+            }
+
+            return ret;
+        }
+
+        /// <summary>
+        /// 取基金指数,benchmark_type: 0-主基准、1-分类平均
+        /// </summary>
+        /// <param name="fundId"></param>
+        /// <returns></returns>
+        public static DataTable Get_dm_fund_benchmark(string fundId)
+        {
+
+            MySqlConnection connection = new MySqlConnection(connectionString);
+            MySqlDataAdapter ad = new MySqlDataAdapter("sp_get_dm_fund_benchmark", connection);
+
+            MySqlParameter i_fund_id = new MySqlParameter("i_fund_id", fundId);
+
+            ad.SelectCommand.Parameters.Add(i_fund_id);
+
+            ad.SelectCommand.CommandType = CommandType.StoredProcedure;
+
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+
+            connection.Close();
+
+            return dt;
+        }
+    }
+}

+ 178 - 0
NavChart.Designer.cs

@@ -0,0 +1,178 @@
+namespace DataManager
+{
+    partial class NavChart
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+            System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.btnDateChanged = new System.Windows.Forms.Button();
+            this.cmbTimePeriod = new System.Windows.Forms.ComboBox();
+            this.dtpEndDate = new System.Windows.Forms.DateTimePicker();
+            this.label1 = new System.Windows.Forms.Label();
+            this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
+            this.chtNav = new System.Windows.Forms.DataVisualization.Charting.Chart();
+            this.cmbBenchmark = new System.Windows.Forms.ComboBox();
+            this.panel1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.chtNav)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // panel1
+            // 
+            this.panel1.Controls.Add(this.cmbBenchmark);
+            this.panel1.Controls.Add(this.btnDateChanged);
+            this.panel1.Controls.Add(this.cmbTimePeriod);
+            this.panel1.Controls.Add(this.dtpEndDate);
+            this.panel1.Controls.Add(this.label1);
+            this.panel1.Controls.Add(this.dtpStartDate);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
+            this.panel1.Location = new System.Drawing.Point(0, 0);
+            this.panel1.Margin = new System.Windows.Forms.Padding(4);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(820, 64);
+            this.panel1.TabIndex = 0;
+            // 
+            // btnDateChanged
+            // 
+            this.btnDateChanged.Location = new System.Drawing.Point(329, 16);
+            this.btnDateChanged.Name = "btnDateChanged";
+            this.btnDateChanged.Size = new System.Drawing.Size(75, 25);
+            this.btnDateChanged.TabIndex = 4;
+            this.btnDateChanged.Text = "OK";
+            this.btnDateChanged.UseVisualStyleBackColor = true;
+            this.btnDateChanged.Click += new System.EventHandler(this.btnDateChanged_Click);
+            // 
+            // cmbTimePeriod
+            // 
+            this.cmbTimePeriod.FormattingEnabled = true;
+            this.cmbTimePeriod.Items.AddRange(new object[] {
+            "成立以来",
+            "近3月",
+            "近1年",
+            "近2年",
+            "近3年",
+            "近5年",
+            "近10年"});
+            this.cmbTimePeriod.Location = new System.Drawing.Point(448, 16);
+            this.cmbTimePeriod.Name = "cmbTimePeriod";
+            this.cmbTimePeriod.Size = new System.Drawing.Size(121, 25);
+            this.cmbTimePeriod.TabIndex = 3;
+            this.cmbTimePeriod.SelectedIndexChanged += new System.EventHandler(this.cmbTimePeriod_SelectedIndexChanged);
+            // 
+            // dtpEndDate
+            // 
+            this.dtpEndDate.Location = new System.Drawing.Point(182, 18);
+            this.dtpEndDate.Margin = new System.Windows.Forms.Padding(4);
+            this.dtpEndDate.Name = "dtpEndDate";
+            this.dtpEndDate.ShowCheckBox = true;
+            this.dtpEndDate.Size = new System.Drawing.Size(140, 23);
+            this.dtpEndDate.TabIndex = 2;
+            this.dtpEndDate.Leave += new System.EventHandler(this.dtpEndDate_Leave);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(158, 21);
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(20, 17);
+            this.label1.TabIndex = 1;
+            this.label1.Text = "至";
+            // 
+            // dtpStartDate
+            // 
+            this.dtpStartDate.Location = new System.Drawing.Point(15, 18);
+            this.dtpStartDate.Margin = new System.Windows.Forms.Padding(4);
+            this.dtpStartDate.Name = "dtpStartDate";
+            this.dtpStartDate.ShowCheckBox = true;
+            this.dtpStartDate.Size = new System.Drawing.Size(140, 23);
+            this.dtpStartDate.TabIndex = 0;
+            // 
+            // chtNav
+            // 
+            chartArea1.Name = "ChartArea1";
+            this.chtNav.ChartAreas.Add(chartArea1);
+            this.chtNav.Dock = System.Windows.Forms.DockStyle.Fill;
+            legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
+            legend1.Name = "Legend1";
+            this.chtNav.Legends.Add(legend1);
+            this.chtNav.Location = new System.Drawing.Point(0, 64);
+            this.chtNav.Margin = new System.Windows.Forms.Padding(4);
+            this.chtNav.Name = "chtNav";
+            series1.ChartArea = "ChartArea1";
+            series1.Legend = "Legend1";
+            series1.Name = "fund";
+            series2.ChartArea = "ChartArea1";
+            series2.Legend = "Legend1";
+            series2.Name = "index";
+            this.chtNav.Series.Add(series1);
+            this.chtNav.Series.Add(series2);
+            this.chtNav.Size = new System.Drawing.Size(820, 401);
+            this.chtNav.TabIndex = 1;
+            // 
+            // cmbBenchmark
+            // 
+            this.cmbBenchmark.FormattingEnabled = true;
+            this.cmbBenchmark.Location = new System.Drawing.Point(613, 16);
+            this.cmbBenchmark.Name = "cmbBenchmark";
+            this.cmbBenchmark.Size = new System.Drawing.Size(183, 25);
+            this.cmbBenchmark.TabIndex = 5;
+            this.cmbBenchmark.SelectedIndexChanged += new System.EventHandler(this.cmbBenchmark_SelectedIndexChanged);
+            // 
+            // NavChart
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(820, 465);
+            this.Controls.Add(this.chtNav);
+            this.Controls.Add(this.panel1);
+            this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Margin = new System.Windows.Forms.Padding(4);
+            this.Name = "NavChart";
+            this.Text = "NavChart";
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.chtNav)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Panel panel1;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.DateTimePicker dtpStartDate;
+        private System.Windows.Forms.DataVisualization.Charting.Chart chtNav;
+        private System.Windows.Forms.DateTimePicker dtpEndDate;
+        private System.Windows.Forms.ComboBox cmbTimePeriod;
+        private System.Windows.Forms.Button btnDateChanged;
+        private System.Windows.Forms.ComboBox cmbBenchmark;
+    }
+}

+ 193 - 0
NavChart.cs

@@ -0,0 +1,193 @@
+using System;
+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;
+using System.Windows.Forms.DataVisualization.Charting;
+using System.Windows.Markup;
+using System.Xaml.Schema;
+
+namespace DataManager
+{
+    public partial class NavChart : Form
+    {
+        private string fundId;
+        private DataTable nav;
+        private DataTable indexNav;
+        private DateTime oldestPriceDate = new DateTime(2000,1,1);
+        private DateTime latestPriceDate = DateTime.Today;
+
+
+        public NavChart(string fundId, DataTable nav)
+        {
+            InitializeComponent();
+
+            this.fundId = fundId;
+            this.nav = nav;
+
+            InitializeData();
+        }
+
+        private void InitializeData()
+        {
+            dtpStartDate.Checked = true;
+            if (nav != null && nav.Rows.Count > 0)
+            {
+                oldestPriceDate = DateTime.Parse(nav.Select("", "price_date")[0]["price_date"].ToString());
+
+                if (oldestPriceDate <= new DateTime(1990, 1, 1)) oldestPriceDate = new DateTime(1990, 1, 1);
+
+                latestPriceDate = DateTime.Parse(nav.Select("", "price_date")[nav.Rows.Count - 1]["price_date"].ToString());
+
+                dtpStartDate.Value = oldestPriceDate;
+            }
+                
+            dtpEndDate.Checked = true;
+            dtpEndDate.Value = DateTime.Today;
+
+            cmbTimePeriod.SelectedIndex = 0;
+
+            cmbBenchmark.DataSource = DataAccess.Get_dm_fund_benchmark(fundId);
+            cmbBenchmark.DisplayMember = "index_short_name";
+            cmbBenchmark.ValueMember = "index_id";
+            cmbBenchmark.SelectedIndex = 0; 
+
+            chtNav.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.LightGray;
+            chtNav.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Gray;
+            chtNav.ChartAreas[0].AxisY.MinorGrid.Enabled = true;
+            chtNav.ChartAreas[0].AxisY.MinorGrid.LineColor = Color.LightGray;
+            chtNav.ChartAreas[0].AxisY.MinorGrid.LineDashStyle = ChartDashStyle.Dot;
+            chtNav.ChartAreas[0].AxisY2.MinorGrid.Enabled = false;
+            chtNav.ChartAreas[0].AxisY2.MajorGrid.LineColor = Color.LightGray;
+
+            // Y 轴最大最小值自适应
+            chtNav.ChartAreas[0].AxisY.IsStartedFromZero = false;
+            chtNav.ChartAreas[0].AxisY2.IsStartedFromZero = false;
+
+            Series seriesFund = chtNav.Series[0];
+            seriesFund.ChartType = SeriesChartType.Line;
+            seriesFund.MarkerStyle = MarkerStyle.Circle;
+            seriesFund.LegendText = "分红再投净值";
+            BindChartData(nav, seriesFund);
+
+            Series seriesIndex = chtNav.Series[1];
+            seriesIndex.ChartType = SeriesChartType.Line;
+            seriesIndex.YAxisType = AxisType.Secondary;
+            seriesIndex.LegendText = cmbBenchmark.GetItemText(cmbBenchmark.SelectedItem);
+            string indexId = cmbBenchmark.SelectedValue.ToString();
+            indexNav = DataAccess.Get_Nav(indexId, oldestPriceDate, latestPriceDate);
+            BindChartData(indexNav, seriesIndex);
+
+        }
+
+        private DataTable FilterDate(DataTable data, DateTime startDate, DateTime endDate)
+        {
+            DataTable dt = null;
+
+            if (startDate > endDate)
+            {
+                MessageBox.Show("起始日不能大于截止日哦");
+                return null;
+            }
+
+            if (data != null && data.Rows.Count > 0)
+            {
+
+                string expression = "price_date <= #" + endDate.ToString() + "# and price_date >= #" + startDate.ToString() + "#";
+                DataRow[] rows = data.Select(expression, "price_date");
+
+                if (rows != null && rows.Length > 0)
+                    dt = rows.CopyToDataTable();
+            }
+
+            return dt;
+        }
+
+        private void BindChartData(DataTable data, Series series)
+        {
+            if (data != null && data.Rows.Count > 0)
+                series.Points.DataBind(data.AsEnumerable(), "price_date", "cumulative_nav", "");
+
+        }
+
+
+        // 这个事件不好用,但Value_Changed会深度死机
+        private void dtpEndDate_Leave(object sender, EventArgs e)
+        {
+
+        }
+
+        private void btnDateChanged_Click(object sender, EventArgs e)
+        {
+            DateTime startDate = dtpStartDate.Value;
+            if (dtpStartDate.Checked == false) startDate = DateTime.MinValue;
+            
+            DateTime endDate = dtpEndDate.Value;
+            if (dtpEndDate.Checked == false) endDate = DateTime.MaxValue;
+
+            BindChartData(FilterDate(nav, startDate, endDate), chtNav.Series["fund"]);
+            BindChartData(FilterDate(indexNav, startDate, endDate), chtNav.Series["index"]);
+        }
+
+        private void cmbTimePeriod_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            DateTime startDate = new DateTime();
+            DateTime endDate = DateTime.Today;
+
+            switch (cmbTimePeriod.SelectedIndex)
+            {
+                case 0:
+                    startDate = oldestPriceDate;
+                    break;
+                case 1:
+                    startDate = endDate.AddMonths(-3);
+                    break;
+                case 2:
+                    startDate = endDate.AddYears(-1);
+                    break;
+                case 3:
+                    startDate = endDate.AddYears(-2);
+                    break;
+                case 4:
+                    startDate = endDate.AddYears(-3);
+                    break;
+                case 5:
+                    startDate = endDate.AddYears(-5);
+                    break;
+                case 6:
+                    startDate = endDate.AddYears(-10);
+                    break;
+                default:
+                    startDate = oldestPriceDate;
+                    break;
+            }
+
+            dtpStartDate.Value = startDate;
+            dtpEndDate.Value = endDate;
+
+            BindChartData(FilterDate(nav, startDate, endDate), chtNav.Series["fund"]);
+            BindChartData(FilterDate(indexNav, startDate, endDate), chtNav.Series["index"]);
+        }
+
+        private void cmbBenchmark_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            string indexId = cmbBenchmark.SelectedValue.ToString();
+
+            if(indexId.Length != 10) return;
+
+            indexNav = DataAccess.Get_Nav(indexId, oldestPriceDate, latestPriceDate);
+
+            DateTime startDate = DateTime.Parse(dtpStartDate.Text);
+            DateTime endDate = DateTime.Parse(dtpEndDate.Text);
+
+            chtNav.Series["index"].LegendText = cmbBenchmark.GetItemText(cmbBenchmark.SelectedItem); ;
+
+            BindChartData(FilterDate(indexNav, startDate, endDate), chtNav.Series["index"]);
+
+        }
+    }
+}

+ 120 - 0
NavChart.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 162 - 0
UIFund.cs

@@ -0,0 +1,162 @@
+using System;
+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());
+
+                // txtManager.Text = fundInfo.Rows[0]["manager_id"]
+                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;
+
+
+        }
+    }
+}