Parcourir la source

上传文件至 ''

Joey il y a 4 semaines
Parent
commit
ba6b64ad25
4 fichiers modifiés avec 137 ajouts et 38 suppressions
  1. 6 5
      UICollectionTask.cs
  2. 6 5
      UICompany.cs
  3. 12 11
      UIFund.Designer.cs
  4. 113 17
      UIFund.cs

+ 6 - 5
UICollectionTask.cs

@@ -131,7 +131,7 @@ namespace DataManager
 
             if (task.ProviderId == null || task.ProviderId.Length != 10)
             {
-                MessageBox.Show("还没输入公司呢...");
+                MessageBox.Show("还没输入公司呢...", "建议信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 txtCompanyShortName.Focus();
                 return;
             }
@@ -155,7 +155,8 @@ namespace DataManager
         {
             if (txtCompanyShortName.TextLength < 2)
             {
-                MessageBox.Show("请输入至少两个字,不然结果太多看不过来 @@");
+                MessageBox.Show("请输入至少两个字,不然结果太多看不过来 @@", "建议信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+
                 txtCompanyShortName.Focus();
                 return;
             }
@@ -164,7 +165,7 @@ namespace DataManager
             DataTable companys = DataAccess.Search_dm_company(UIConstants.CompanyType.FirstOrDefault(x=>x.Value=="私募证券投资").Key, txtCompanyShortName.Text.Trim());
             if (companys == null || companys.Rows.Count == 0)
             {
-                MessageBox.Show("- - 没有找到结果,换个关键字试试?");
+                MessageBox.Show("- - 没有找到结果,换个关键字试试?", "建议信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 txtCompanyShortName.Focus();
                 return;
 
@@ -248,7 +249,7 @@ namespace DataManager
         {
             if (txtEntityName.TextLength < 3)
             {
-                MessageBox.Show("请输入至少三个字,不然结果太多看不过来 @@");
+                MessageBox.Show("请输入至少三个字,不然结果太多看不过来 @@", "建议信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 txtEntityName.Focus();
                 return;
             }
@@ -257,7 +258,7 @@ namespace DataManager
             DataTable funds = DataAccess.Search_dm_fund(UIConstants.RaiseType.FirstOrDefault(x=>x.Value=="私募").Key, txtEntityName.Text.Trim());
             if (funds == null || funds.Rows.Count == 0)
             {
-                MessageBox.Show("- - 没有找到结果,换个关键字试试?");
+                MessageBox.Show("- - 没有找到结果,换个关键字试试?", "建议信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 txtEntityName.Focus();
                 return;
 

+ 6 - 5
UICompany.cs

@@ -203,7 +203,7 @@ namespace DataManager
 
             contactList.AcceptChanges();
 
-            MessageBox.Show("成功更新了" + updatedCnt.ToString() + "个联系人");
+            MessageBox.Show("成功更新了" + updatedCnt.ToString() + "个联系人", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
             
         }
 
@@ -257,6 +257,7 @@ namespace DataManager
             grdFund.Columns["createtime"].Visible = false;
             grdFund.Columns["updaterid"].Visible = false;
             grdFund.Columns["updatetime"].Visible = false;
+            grdFund.Columns["max_price_date"].HeaderText = "最新净值日";
 
             grdFund.Columns["fund_short_name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
 
@@ -274,7 +275,7 @@ namespace DataManager
             DataGridViewRow row = grdFund.Rows[rowIndex];
             string fundId = row.Cells["fund_id"].Value.ToString();
             
-            UIFund frm = new UIFund(fundId);
+            UIFund frm = new UIFund(fundId, UserId);
             frm.ShowDialog();
         }
 
@@ -348,7 +349,7 @@ namespace DataManager
             int ret = DataAccess.Set_dm_company_cover(query, UserId);
 
             string message = ret < 0 ? "Oops... 变更存数据库时出了错" : "人员覆盖变更已经成功存盘~";
-            MessageBox.Show(message);
+            MessageBox.Show(message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
         }
         /// <summary>
@@ -434,7 +435,7 @@ namespace DataManager
                 }
                 catch (Exception ex)
                 {
-                    MessageBox.Show("文件上传失败:" + ex.Message);
+                    MessageBox.Show("文件上传失败:" + ex.Message, "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
 
             }
@@ -478,7 +479,7 @@ namespace DataManager
 
             Label lblFileName = new Label();
             lblFileName.Text = fileName;
-            lblFileName.ForeColor = Color.Navy;
+            lblFileName.ForeColor = Color.DodgerBlue;
             lblFileName.Size = new Size(panFile.Width, panFile.Height/2);
             lblFileName.Location = new Point(panFile.Location.X, panFile.Location.Y + panFile.Size.Height/2);
             lblFileName.TextAlign = ContentAlignment.MiddleCenter;

+ 12 - 11
UIFund.Designer.cs

@@ -61,7 +61,7 @@
             this.cmbNavFrequency = new System.Windows.Forms.ComboBox();
             this.label12 = new System.Windows.Forms.Label();
             this.label14 = new System.Windows.Forms.Label();
-            this.cmbManagers = new System.Windows.Forms.ComboBox();
+            this.cmbSubStrategy = new System.Windows.Forms.ComboBox();
             this.cmbStrategy = new System.Windows.Forms.ComboBox();
             this.chkAuthorized = new System.Windows.Forms.CheckBox();
             this.btnSave = new System.Windows.Forms.Button();
@@ -391,6 +391,7 @@
             this.lblCompany.Size = new System.Drawing.Size(82, 17);
             this.lblCompany.TabIndex = 16;
             this.lblCompany.Text = "XXXX-XX-XX";
+            this.lblCompany.Click += new System.EventHandler(this.lblCompany_Click);
             // 
             // label11
             // 
@@ -438,7 +439,7 @@
             this.gpbFundEditing.Controls.Add(this.cmbNavFrequency);
             this.gpbFundEditing.Controls.Add(this.label12);
             this.gpbFundEditing.Controls.Add(this.label14);
-            this.gpbFundEditing.Controls.Add(this.cmbManagers);
+            this.gpbFundEditing.Controls.Add(this.cmbSubStrategy);
             this.gpbFundEditing.Controls.Add(this.cmbStrategy);
             this.gpbFundEditing.Controls.Add(this.chkAuthorized);
             this.gpbFundEditing.Controls.Add(this.btnSave);
@@ -499,13 +500,13 @@
             this.label14.TabIndex = 15;
             this.label14.Text = "净值频率";
             // 
-            // cmbManagers
+            // cmbSubStrategy
             // 
-            this.cmbManagers.FormattingEnabled = true;
-            this.cmbManagers.Location = new System.Drawing.Point(651, 31);
-            this.cmbManagers.Name = "cmbManagers";
-            this.cmbManagers.Size = new System.Drawing.Size(105, 25);
-            this.cmbManagers.TabIndex = 13;
+            this.cmbSubStrategy.FormattingEnabled = true;
+            this.cmbSubStrategy.Location = new System.Drawing.Point(651, 31);
+            this.cmbSubStrategy.Name = "cmbSubStrategy";
+            this.cmbSubStrategy.Size = new System.Drawing.Size(105, 25);
+            this.cmbSubStrategy.TabIndex = 13;
             // 
             // cmbStrategy
             // 
@@ -514,6 +515,7 @@
             this.cmbStrategy.Name = "cmbStrategy";
             this.cmbStrategy.Size = new System.Drawing.Size(121, 25);
             this.cmbStrategy.TabIndex = 12;
+            this.cmbStrategy.SelectedIndexChanged += new System.EventHandler(this.cmbStrategy_SelectedIndexChanged);
             // 
             // chkAuthorized
             // 
@@ -528,7 +530,6 @@
             // 
             // btnSave
             // 
-            this.btnSave.Enabled = false;
             this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.btnSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
             this.btnSave.Location = new System.Drawing.Point(651, 165);
@@ -588,7 +589,7 @@
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(56, 17);
             this.label5.TabIndex = 2;
-            this.label5.Text = "基金经理";
+            this.label5.Text = "二级策略";
             // 
             // label4
             // 
@@ -834,7 +835,7 @@
         private System.Windows.Forms.TextBox txtRegisterCode;
         private System.Windows.Forms.TextBox txtFundId;
         private System.Windows.Forms.ComboBox cmbStrategy;
-        private System.Windows.Forms.ComboBox cmbManagers;
+        private System.Windows.Forms.ComboBox cmbSubStrategy;
         private System.Windows.Forms.Label lblNavFrequency;
         private System.Windows.Forms.ComboBox cmbAssetFrequency;
         private System.Windows.Forms.ComboBox cmbNavFrequency;

+ 113 - 17
UIFund.cs

@@ -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;
+        }
+
+
+        /// <summary>
+        /// 二级策略选项跟随改变
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        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)
         {
             //int rowIndex = e.RowIndex;
@@ -178,5 +272,7 @@ namespace DataManager
         {
 
         }
+
+
     }
 }