Joey 1 місяць тому
батько
коміт
56a69fbe08
5 змінених файлів з 963 додано та 0 видалено
  1. 315 0
      UICollectionTask.Designer.cs
  2. 301 0
      UICollectionTask.cs
  3. 120 0
      UICollectionTask.resx
  4. 215 0
      UIContactTask.cs
  5. 12 0
      packages.config

+ 315 - 0
UICollectionTask.Designer.cs

@@ -0,0 +1,315 @@
+namespace DataManager
+{
+    partial class UICollectionTask
+    {
+        /// <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()
+        {
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.grdEntity = new System.Windows.Forms.DataGridView();
+            this.grdCompany = new System.Windows.Forms.DataGridView();
+            this.btnEntitySearch = new System.Windows.Forms.Button();
+            this.lblEntityTypeName = new System.Windows.Forms.Label();
+            this.txtEntityName = new System.Windows.Forms.TextBox();
+            this.btnCompanySearch = new System.Windows.Forms.Button();
+            this.dtpTaskDate = new System.Windows.Forms.DateTimePicker();
+            this.txtMemo = new System.Windows.Forms.TextBox();
+            this.label7 = new System.Windows.Forms.Label();
+            this.cmbIsValid = new System.Windows.Forms.ComboBox();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.cmbTaskType = new System.Windows.Forms.ComboBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.txtCompanyShortName = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.btnDelTask = new System.Windows.Forms.Button();
+            this.btnSaveTask = new System.Windows.Forms.Button();
+            this.panel1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.grdEntity)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.grdCompany)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // panel1
+            // 
+            this.panel1.BackColor = System.Drawing.SystemColors.ControlLight;
+            this.panel1.Controls.Add(this.grdEntity);
+            this.panel1.Controls.Add(this.grdCompany);
+            this.panel1.Controls.Add(this.btnEntitySearch);
+            this.panel1.Controls.Add(this.lblEntityTypeName);
+            this.panel1.Controls.Add(this.txtEntityName);
+            this.panel1.Controls.Add(this.btnCompanySearch);
+            this.panel1.Controls.Add(this.dtpTaskDate);
+            this.panel1.Controls.Add(this.txtMemo);
+            this.panel1.Controls.Add(this.label7);
+            this.panel1.Controls.Add(this.cmbIsValid);
+            this.panel1.Controls.Add(this.label4);
+            this.panel1.Controls.Add(this.label3);
+            this.panel1.Controls.Add(this.cmbTaskType);
+            this.panel1.Controls.Add(this.label2);
+            this.panel1.Controls.Add(this.txtCompanyShortName);
+            this.panel1.Controls.Add(this.label1);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
+            this.panel1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            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(643, 311);
+            this.panel1.TabIndex = 0;
+            // 
+            // grdEntity
+            // 
+            this.grdEntity.AllowUserToAddRows = false;
+            this.grdEntity.AllowUserToDeleteRows = false;
+            this.grdEntity.AllowUserToResizeRows = false;
+            this.grdEntity.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.grdEntity.ColumnHeadersVisible = false;
+            this.grdEntity.ImeMode = System.Windows.Forms.ImeMode.Off;
+            this.grdEntity.Location = new System.Drawing.Point(100, 155);
+            this.grdEntity.Name = "grdEntity";
+            this.grdEntity.ReadOnly = true;
+            this.grdEntity.RowHeadersVisible = false;
+            this.grdEntity.RowTemplate.Height = 23;
+            this.grdEntity.Size = new System.Drawing.Size(415, 150);
+            this.grdEntity.TabIndex = 34;
+            this.grdEntity.Visible = false;
+            this.grdEntity.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdEntity_CellContentClick);
+            // 
+            // grdCompany
+            // 
+            this.grdCompany.AllowUserToAddRows = false;
+            this.grdCompany.AllowUserToDeleteRows = false;
+            this.grdCompany.AllowUserToResizeRows = false;
+            this.grdCompany.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.grdCompany.ColumnHeadersVisible = false;
+            this.grdCompany.ImeMode = System.Windows.Forms.ImeMode.Off;
+            this.grdCompany.Location = new System.Drawing.Point(100, 105);
+            this.grdCompany.Name = "grdCompany";
+            this.grdCompany.ReadOnly = true;
+            this.grdCompany.RowHeadersVisible = false;
+            this.grdCompany.RowTemplate.Height = 23;
+            this.grdCompany.Size = new System.Drawing.Size(240, 150);
+            this.grdCompany.TabIndex = 17;
+            this.grdCompany.Visible = false;
+            this.grdCompany.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdCompany_CellContentClick);
+            // 
+            // btnEntitySearch
+            // 
+            this.btnEntitySearch.BackColor = System.Drawing.Color.SkyBlue;
+            this.btnEntitySearch.Location = new System.Drawing.Point(296, 124);
+            this.btnEntitySearch.Margin = new System.Windows.Forms.Padding(4);
+            this.btnEntitySearch.Name = "btnEntitySearch";
+            this.btnEntitySearch.Size = new System.Drawing.Size(60, 25);
+            this.btnEntitySearch.TabIndex = 33;
+            this.btnEntitySearch.Text = "搜";
+            this.btnEntitySearch.UseVisualStyleBackColor = false;
+            this.btnEntitySearch.Click += new System.EventHandler(this.btnEntitySearch_Click);
+            // 
+            // lblEntityTypeName
+            // 
+            this.lblEntityTypeName.AutoSize = true;
+            this.lblEntityTypeName.Location = new System.Drawing.Point(33, 129);
+            this.lblEntityTypeName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblEntityTypeName.Name = "lblEntityTypeName";
+            this.lblEntityTypeName.Size = new System.Drawing.Size(32, 17);
+            this.lblEntityTypeName.TabIndex = 32;
+            this.lblEntityTypeName.Text = "主题";
+            // 
+            // txtEntityName
+            // 
+            this.txtEntityName.Location = new System.Drawing.Point(100, 125);
+            this.txtEntityName.Margin = new System.Windows.Forms.Padding(4);
+            this.txtEntityName.Name = "txtEntityName";
+            this.txtEntityName.Size = new System.Drawing.Size(197, 23);
+            this.txtEntityName.TabIndex = 31;
+            // 
+            // btnCompanySearch
+            // 
+            this.btnCompanySearch.BackColor = System.Drawing.Color.SkyBlue;
+            this.btnCompanySearch.Location = new System.Drawing.Point(296, 74);
+            this.btnCompanySearch.Margin = new System.Windows.Forms.Padding(4);
+            this.btnCompanySearch.Name = "btnCompanySearch";
+            this.btnCompanySearch.Size = new System.Drawing.Size(60, 25);
+            this.btnCompanySearch.TabIndex = 21;
+            this.btnCompanySearch.Text = "搜";
+            this.btnCompanySearch.UseVisualStyleBackColor = false;
+            this.btnCompanySearch.Click += new System.EventHandler(this.btnCompanySearch_Click);
+            // 
+            // dtpTaskDate
+            // 
+            this.dtpTaskDate.Location = new System.Drawing.Point(483, 25);
+            this.dtpTaskDate.Margin = new System.Windows.Forms.Padding(4);
+            this.dtpTaskDate.Name = "dtpTaskDate";
+            this.dtpTaskDate.Size = new System.Drawing.Size(121, 23);
+            this.dtpTaskDate.TabIndex = 30;
+            // 
+            // txtMemo
+            // 
+            this.txtMemo.Location = new System.Drawing.Point(100, 175);
+            this.txtMemo.Margin = new System.Windows.Forms.Padding(4);
+            this.txtMemo.Multiline = true;
+            this.txtMemo.Name = "txtMemo";
+            this.txtMemo.Size = new System.Drawing.Size(504, 90);
+            this.txtMemo.TabIndex = 29;
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(33, 178);
+            this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(32, 17);
+            this.label7.TabIndex = 28;
+            this.label7.Text = "备注";
+            // 
+            // cmbIsValid
+            // 
+            this.cmbIsValid.FormattingEnabled = true;
+            this.cmbIsValid.Location = new System.Drawing.Point(483, 75);
+            this.cmbIsValid.Margin = new System.Windows.Forms.Padding(4);
+            this.cmbIsValid.Name = "cmbIsValid";
+            this.cmbIsValid.Size = new System.Drawing.Size(121, 25);
+            this.cmbIsValid.TabIndex = 26;
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(411, 78);
+            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(32, 17);
+            this.label4.TabIndex = 23;
+            this.label4.Text = "状态";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(411, 29);
+            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(32, 17);
+            this.label3.TabIndex = 22;
+            this.label3.Text = "日期";
+            // 
+            // cmbTaskType
+            // 
+            this.cmbTaskType.FormattingEnabled = true;
+            this.cmbTaskType.Location = new System.Drawing.Point(100, 25);
+            this.cmbTaskType.Margin = new System.Windows.Forms.Padding(4);
+            this.cmbTaskType.Name = "cmbTaskType";
+            this.cmbTaskType.Size = new System.Drawing.Size(121, 25);
+            this.cmbTaskType.TabIndex = 20;
+            this.cmbTaskType.SelectedIndexChanged += new System.EventHandler(this.cmbTaskType_SelectedIndexChanged);
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(33, 78);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(44, 17);
+            this.label2.TabIndex = 19;
+            this.label2.Text = "数据源";
+            // 
+            // txtCompanyShortName
+            // 
+            this.txtCompanyShortName.Location = new System.Drawing.Point(100, 75);
+            this.txtCompanyShortName.Margin = new System.Windows.Forms.Padding(4);
+            this.txtCompanyShortName.Name = "txtCompanyShortName";
+            this.txtCompanyShortName.Size = new System.Drawing.Size(197, 23);
+            this.txtCompanyShortName.TabIndex = 18;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(33, 29);
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(32, 17);
+            this.label1.TabIndex = 17;
+            this.label1.Text = "任务";
+            // 
+            // btnDelTask
+            // 
+            this.btnDelTask.Location = new System.Drawing.Point(36, 324);
+            this.btnDelTask.Name = "btnDelTask";
+            this.btnDelTask.Size = new System.Drawing.Size(75, 28);
+            this.btnDelTask.TabIndex = 5;
+            this.btnDelTask.Text = "删 除";
+            this.btnDelTask.UseVisualStyleBackColor = true;
+            // 
+            // btnSaveTask
+            // 
+            this.btnSaveTask.Location = new System.Drawing.Point(529, 324);
+            this.btnSaveTask.Name = "btnSaveTask";
+            this.btnSaveTask.Size = new System.Drawing.Size(75, 28);
+            this.btnSaveTask.TabIndex = 4;
+            this.btnSaveTask.Text = "保 存";
+            this.btnSaveTask.UseVisualStyleBackColor = true;
+            this.btnSaveTask.Click += new System.EventHandler(this.btnSaveTask_Click);
+            // 
+            // UICollectionTask
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(643, 362);
+            this.Controls.Add(this.btnDelTask);
+            this.Controls.Add(this.btnSaveTask);
+            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 = "UICollectionTask";
+            this.Text = "采集任务";
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.grdEntity)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.grdCompany)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Panel panel1;
+        private System.Windows.Forms.Button btnCompanySearch;
+        private System.Windows.Forms.DateTimePicker dtpTaskDate;
+        private System.Windows.Forms.TextBox txtMemo;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.ComboBox cmbIsValid;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.ComboBox cmbTaskType;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox txtCompanyShortName;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Button btnEntitySearch;
+        private System.Windows.Forms.Label lblEntityTypeName;
+        private System.Windows.Forms.TextBox txtEntityName;
+        private System.Windows.Forms.Button btnDelTask;
+        private System.Windows.Forms.Button btnSaveTask;
+        private System.Windows.Forms.DataGridView grdCompany;
+        private System.Windows.Forms.DataGridView grdEntity;
+    }
+}

+ 301 - 0
UICollectionTask.cs

@@ -0,0 +1,301 @@
+using System;
+using System.CodeDom;
+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 UICollectionTask : Form
+    {
+
+
+        private CollectionTask task = null;
+        private string memo = string.Empty;
+
+        // 模式:0-新任务,1-编辑已有任务
+        private int mode = 0;
+
+
+        public UICollectionTask(int userId)
+        {
+            task = new CollectionTask();
+
+            task.UserId = userId;
+            task.TaskType = 6; // 净值缺失
+            task.TaskDate = DateTime.Now;
+            task.Isvalid = 3; // 等待回复
+
+            InitializeComponent();
+
+            this.mode = 0;
+            InitializeData();
+        }
+
+        public UICollectionTask(CollectionTask task)
+        {
+            this.task = task;
+
+            InitializeComponent();
+
+            this.mode = 1;
+            InitializeData();
+
+            memo = GetTaskMemo();
+        }
+
+        private void InitializeData()
+        {
+            this.Text = this.Text + "  " + (mode == 0 ? "新任务" : task.TaskId.ToString());
+
+            BindingSource bs1 = new BindingSource();
+            bs1.DataSource = UIConstants.CollectionTaskType;
+            this.cmbTaskType.DataSource = bs1;
+            this.cmbTaskType.DisplayMember = "Value";
+            this.cmbTaskType.ValueMember = "Key";
+            this.cmbTaskType.SelectedValue = (int)task.TaskType;
+            // 已有任务不可以改变任务类型
+            cmbTaskType.Enabled = (mode == 0 ? true : false);
+
+            this.dtpTaskDate.Text = task.TaskDate.ToString();
+
+            this.txtCompanyShortName.Text = task.ProviderName;
+
+            if (mode == 1)
+            {
+                this.cmbTaskType.Enabled = false;
+                this.dtpTaskDate.Enabled = false;
+                this.txtCompanyShortName.ReadOnly = true;
+                this.btnCompanySearch.Enabled = false;
+                this.txtEntityName.ReadOnly = true;
+                this.txtEntityName.Text = task.EntityName;
+
+            }
+            else
+            {
+                this.btnDelTask.Visible = false;
+            }
+
+            BindingSource bs2 = new BindingSource();
+            bs2.DataSource = UIConstants.CollectionTaskStatus;;
+            this.cmbIsValid.DataSource = bs2;
+            this.cmbIsValid.DisplayMember = "Value";
+            this.cmbIsValid.ValueMember = "Key";
+            this.cmbIsValid.SelectedValue = (int)task.Isvalid;
+
+        }
+
+        private string GetTaskMemo()
+        {
+            string memo = string.Empty;
+
+            if (task != null && task.TaskId > 0)
+            {
+                DataTable dt = DataAccess.Get_dm_memo((sbyte)UIConstants.JobType.Collection, task.TaskId);
+
+                if (dt != null && dt.Rows.Count > 0)
+                {
+                    memo = dt.Rows[0]["memo"].ToString().Trim();
+                }
+            }
+
+            txtMemo.Text = memo;
+
+            return memo;
+        }
+
+        private void SaveTaskMemo()
+        {
+            string newMemo = txtMemo.Text.Trim();
+
+            if (memo != newMemo)
+            {
+                DataAccess.Set_dm_memo((sbyte)UIConstants.JobType.Collection, task.TaskId, newMemo, int.Parse(task.UserId.ToString()));
+            }
+
+            return;
+        }
+
+        private void btnSaveTask_Click(object sender, EventArgs e)
+        {
+
+            if (task.TaskId <= 0)
+            {
+                // need generate a new task id
+            };
+
+            if (task.ProviderId == null || task.ProviderId.Length != 10)
+            {
+                MessageBox.Show("还没输入公司呢...");
+                txtCompanyShortName.Focus();
+                return;
+            }
+
+            task.TaskType = Int16.Parse(cmbTaskType.SelectedValue.ToString());
+            task.TaskDate = DateTime.Parse(dtpTaskDate.Text);
+            task.Isvalid = SByte.Parse(cmbIsValid.SelectedValue.ToString());
+
+
+            // 写回数据库时,新记录会INSERT记录并产生一个自增长的task_id
+            task.TaskId = task.SaveToSQL(int.Parse(task.UserId.ToString()));
+            
+            SaveTaskMemo();
+
+            this.DialogResult = DialogResult.OK;
+            this.Close();
+
+        }
+
+        private void btnCompanySearch_Click(object sender, EventArgs e)
+        {
+            if (txtCompanyShortName.TextLength < 2)
+            {
+                MessageBox.Show("请输入至少两个字,不然结果太多看不过来 @@");
+                txtCompanyShortName.Focus();
+                return;
+            }
+
+            // 只搜私募
+            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("- - 没有找到结果,换个关键字试试?");
+                txtCompanyShortName.Focus();
+                return;
+
+            }
+
+            grdCompany.DataSource = companys;
+            grdCompany.Columns["company_id"].Visible = false;
+            grdCompany.Columns["company_name"].Visible = false;
+            grdCompany.Columns["company_asset_size"].Visible = false;
+            grdCompany.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+            grdCompany.Columns["company_short_name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
+            grdCompany.Visible = true;
+
+        }
+
+        private void grdCompany_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            int rowIndex = e.RowIndex;
+            int columnIndex = e.ColumnIndex;
+
+            if (columnIndex < 0 || rowIndex < 0) return;
+
+            task.ProviderId = grdCompany.Rows[rowIndex].Cells["company_id"].Value.ToString();
+
+            txtCompanyShortName.Text = grdCompany.Rows[rowIndex].Cells["company_short_name"].Value.ToString().Trim();
+
+            grdCompany.Visible = false;
+
+            return;
+        }
+
+        private void cmbTaskType_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            string taskType = cmbTaskType.Text;
+            bool isSaveable = false;
+
+            switch (taskType)
+            {
+                case "净值校验":
+                case "资产校验":
+                case "新基金":
+                case "净值缺失":
+                case "资产缺失":
+                case "历史净值":
+                case "历史资产":
+                    lblEntityTypeName.Text = "基金";
+                    isSaveable = true;
+                    break;
+                case "邮件处理":
+                    lblEntityTypeName.Text = "邮件";
+                    txtEntityName.Text = "暂不支持";
+                    isSaveable = false;
+                    break;
+                case "文件解析":
+                    lblEntityTypeName.Text = "文件";
+                    txtEntityName.Text = "暂不支持";
+                    isSaveable = false;
+                    break;
+                default:
+                    lblEntityTypeName.Text = "未知";
+                    break;
+            }
+
+            if (isSaveable == false)
+            {
+                txtEntityName.Enabled = false;
+                btnEntitySearch.Enabled = false;
+                btnSaveTask.Enabled = false;
+            }
+            else
+            {
+                txtCompanyShortName.Enabled = false;
+                btnCompanySearch.Enabled = false;
+                txtEntityName.Enabled = true;
+                btnEntitySearch.Enabled = true;
+                btnSaveTask.Enabled = true;
+            }
+        }
+
+        private void btnEntitySearch_Click(object sender, EventArgs e)
+        {
+            if (txtEntityName.TextLength < 3)
+            {
+                MessageBox.Show("请输入至少三个字,不然结果太多看不过来 @@");
+                txtEntityName.Focus();
+                return;
+            }
+
+            // 只搜私募
+            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("- - 没有找到结果,换个关键字试试?");
+                txtEntityName.Focus();
+                return;
+
+            }
+
+            grdEntity.DataSource = funds;
+            grdEntity.Columns["fund_id"].Visible = false;
+            grdEntity.Columns["fund_name"].Visible = false;
+            grdEntity.Columns["company_id"].Visible = false;
+            grdEntity.Columns["company_short_name"].Visible = false;
+            grdEntity.Columns["strategy"].Visible = false;
+            grdEntity.Columns["substrategy"].Visible = false;
+            //grdEntity.Columns["max_price_date"].Visible = false;
+            grdEntity.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+            grdEntity.Columns["fund_short_name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
+            grdEntity.Visible = true;
+
+        }
+
+        private void grdEntity_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            int rowIndex = e.RowIndex;
+            int columnIndex = e.ColumnIndex;
+
+            if (columnIndex < 0 || rowIndex < 0) return;
+
+            task.EntityId = grdEntity.Rows[rowIndex].Cells["fund_id"].Value.ToString();
+            task.ProviderId = grdEntity.Rows[rowIndex].Cells["company_id"].Value.ToString();
+
+            txtEntityName.Text = grdEntity.Rows[rowIndex].Cells["fund_short_name"].Value.ToString();
+
+            txtCompanyShortName.Text = grdEntity.Rows[rowIndex].Cells["company_short_name"].Value.ToString();
+            
+
+            grdEntity.Visible = false;
+
+            return;
+        }
+    }
+}
+

+ 120 - 0
UICollectionTask.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>

+ 215 - 0
UIContactTask.cs

@@ -0,0 +1,215 @@
+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.Xml.XPath;
+using static DataManager.UIConstants;
+
+
+namespace DataManager
+{
+    public partial class frmContactTask : Form
+    {
+
+        private ContactTask task = null;
+
+        private string memo = string.Empty;
+        
+        // 模式:0-新任务,1-编辑已有任务
+        private int mode = 0;
+
+        public frmContactTask(int userId)
+        {
+            task = new ContactTask();
+            task.UserId = userId;
+            task.TaskType = 1; // 建立联系
+            task.TaskDate = DateTime.Now;
+            task.Priority = 2; // 高
+            task.Isvalid = 3; // 等待答复
+            task.FollowUpDate = DateTime.Now.AddDays(3); // 缺省3天之后跟进
+
+            InitializeComponent();
+
+            this.mode = 0;
+            InitializeData();
+
+        }
+
+        public frmContactTask(ContactTask contactTask)
+        {
+            this.task = contactTask;
+            
+            InitializeComponent();
+            
+            this.mode = 1;
+            InitializeData();
+
+            memo = GetTaskMemo();
+        }
+
+        private void InitializeData()
+        {
+            this.Text = this.Text + "  " + (mode == 0 ? "新任务" : task.TaskId.ToString());
+
+            BindingSource bs1 = new BindingSource();
+            bs1.DataSource = UIConstants.ContactTaskType;
+            this.cmbTaskType.DataSource = bs1;
+            this.cmbTaskType.DisplayMember = "Value";
+            this.cmbTaskType.ValueMember = "Key";
+            this.cmbTaskType.SelectedValue = (int)task.TaskType;
+            // 已有任务不可以改变任务类型
+            cmbTaskType.Enabled = (mode == 0 ? true : false);
+
+            this.dtpTaskDate.Text = task.TaskDate.ToString();
+
+            this.txtCompanyShortName.Text = task.CompanyShortName;
+            
+            if (mode == 1) 
+            {
+                this.cmbTaskType.Enabled = false;
+                this.dtpTaskDate.Enabled = false;
+                this.txtCompanyShortName.ReadOnly = true;
+                this.btnCompanySearch.Enabled = false;
+
+            }
+
+            BindingSource bs = new BindingSource();
+            bs.DataSource = UIConstants.TaskPriority;
+            this.cmbPriority.DataSource = bs;
+            this.cmbPriority.DisplayMember = "Value";
+            this.cmbPriority.ValueMember = "Key";
+            this.cmbPriority.SelectedValue = (int)task.Priority;
+
+            BindingSource bs2 = new BindingSource();
+            bs2.DataSource = UIConstants.ContactTaskStatus;
+            this.cmbIsValid.DataSource = bs2;
+            this.cmbIsValid.DisplayMember = "Value";
+            this.cmbIsValid.ValueMember = "Key";
+            this.cmbIsValid.SelectedValue = (int)task.Isvalid;
+
+            this.dtpFollowUpDate.ShowCheckBox = true;
+            if (task.FollowUpDate != null)
+            {
+                this.dtpFollowUpDate.Text = task.FollowUpDate.ToString();
+                this.dtpFollowUpDate.Checked = true;
+            }
+            else
+                this.dtpFollowUpDate.Checked = false;
+
+
+        }
+
+        private string GetTaskMemo()
+        {
+            string memo = string.Empty;
+
+            if (task != null && task.TaskId > 0)
+            {
+                DataTable dt = DataAccess.Get_dm_memo((sbyte)UIConstants.JobType.Contact, task.TaskId);
+
+                if (dt != null && dt.Rows.Count > 0)
+                {
+                    memo = dt.Rows[0]["memo"].ToString().Trim();
+                }
+            }
+
+            txtMemo.Text = memo;
+
+            return memo;
+        }
+
+        private void SaveTaskMemo()
+        {
+            string newMemo = txtMemo.Text.Trim();
+
+            if (memo != newMemo)
+            {
+                DataAccess.Set_dm_memo((sbyte)UIConstants.JobType.Contact, task.TaskId, newMemo, task.UserId);
+            }
+
+            return;
+        }
+
+
+        private void btnSaveTask_Click(object sender, EventArgs e)
+        {
+
+            if (task.CompanyId == null || task.CompanyId.Length != 10)
+            {
+                MessageBox.Show("还没输入公司呢...");
+                txtCompanyShortName.Focus();
+                return;
+            }
+
+            task.TaskType = Int16.Parse(cmbTaskType.SelectedValue.ToString());
+            task.TaskDate = DateTime.Parse(dtpTaskDate.Text);
+            task.Priority = SByte.Parse(cmbPriority.SelectedValue.ToString());
+            task.Isvalid = SByte.Parse(cmbIsValid.SelectedValue.ToString());
+
+            if (dtpFollowUpDate.Checked == false)
+                task.FollowUpDate = null;
+            else
+                task.FollowUpDate = DateTime.Parse(dtpFollowUpDate.Text);
+
+            // 写回数据库时,新记录会INSERT记录并产生一个自增长的task_id
+            task.TaskId = task.SaveToSQL(task.UserId);
+
+            SaveTaskMemo();
+
+            this.DialogResult = DialogResult.OK;
+            this.Close();
+            
+        }
+
+        private void btnCompanySearch_Click(object sender, EventArgs e)
+        {
+            if(txtCompanyShortName.TextLength < 2)
+            {
+                MessageBox.Show("请输入至少两个字,不然结果太多看不过来 @@");
+                txtCompanyShortName.Focus();
+                return;
+            }
+
+            // 只搜索私募公司
+            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("- - 没有找到结果,换个关键字试试?");
+                txtCompanyShortName.Focus();
+                return;
+
+            }
+            
+            grdCompany.DataSource = companys;
+            grdCompany.Columns["company_id"].Visible = false;
+            grdCompany.Columns["company_name"].Visible = false;
+            grdCompany.Columns["company_asset_size"].Visible = false;
+            grdCompany.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+            grdCompany.Columns["company_short_name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
+            grdCompany.Visible = true; 
+
+        }
+
+        private void grdCompany_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            int rowIndex = e.RowIndex;
+            int columnIndex = e.ColumnIndex;
+
+            if (columnIndex < 0 || rowIndex < 0) return;
+
+            task.CompanyId = grdCompany.Rows[rowIndex].Cells["company_id"].Value.ToString();
+
+            txtCompanyShortName.Text = grdCompany.Rows[rowIndex].Cells["company_short_name"].Value.ToString().Trim();
+
+            grdCompany.Visible = false;
+
+            return;
+        }
+
+    }
+}

+ 12 - 0
packages.config

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net472" />
+  <package id="System.Memory" version="4.5.5" targetFramework="net472" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
+  <package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
+  <package id="System.Text.Json" version="8.0.4" targetFramework="net472" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
+  <package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
+</packages>