private void tspUcAnalyDelete_Click(object sender, EventArgs e)
 {
     if (this.dgvCcAnalys1.SelectedRows.Count > 0)
     {
         AnalyResultBLL analyResultBLL = new AnalyResultBLL();
         string         sqlString      = "delete from tb_AnalysisResult where ProName=@ProName and RecordNumver=@RecordNumver;";
         SqlParameter[] pms            =
         {
             new SqlParameter("@ProName",      SqlDbType.VarChar),
             new SqlParameter("@RecordNumver", SqlDbType.VarChar),
         };
         pms[0].Value = InitialInterface.ProName;
         pms[1].Value = this.dgvCcAnalys1.SelectedRows[0].Cells[0].Value.ToString();
         SqlHelper.ExecuteNonQuery(sqlString, pms);
         List <AnalysResultTotal> analysResultTotals = new List <AnalysResultTotal>();
         analysResultTotals           = analyResultBLL.Get_All(InitialInterface.ProName, this.trvUcAnaly.SelectedNode.Text);
         this.dgvCcAnalys1.DataSource = analysResultTotals;
     }
 }
        private void AfterSaveBinding(object sender, TreeViewEventArgs e)
        {
            TreeView treeView = sender as TreeView;

            AnalyResultBLL analyResultBLL = new AnalyResultBLL();

            dgvCcAnalys1.AutoGenerateColumns = false;
            //记录选择节点的ID,如果是参数ID,在绑定引导词的时候会用到
            if (treeView.SelectedNode.Level > 0)
            {
                this.trvUcAnaly.Tag = treeView.SelectedNode.Tag;
            }
            string selectedParam = treeView.SelectedNode.Text;


            //选中项目名称则清空数据显示,且“参数”列不可见
            if (treeView.SelectedNode.Level == 0)
            {
                dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible = false;
                if (dgvCcAnalys1.AllowUserToAddRows == true)
                {
                    dgvCcAnalys1.AllowUserToAddRows = false;
                }
                //空数据源
                List <AnalysResultTotal> resultList = new List <AnalysResultTotal>();
                dgvCcAnalys1.DataSource = new BindingList <AnalysResultTotal>(resultList);
            }

            //选中节点 节点,绑定节点下所有参数引导词数据,且“参数”列可见
            //此时,“参数+引导词”列只读
            if (treeView.SelectedNode.Level == 1)
            {
                if (dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible == false)
                {
                    dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible = true;
                }
                if (dgvCcAnalys1.Columns["dgcCcAnalyParamsAndIntro"].ReadOnly == false)
                {
                    dgvCcAnalys1.Columns["dgcCcAnalyParamsAndIntro"].ReadOnly = true;
                }
                if (dgvCcAnalys1.AllowUserToAddRows == true)
                {
                    dgvCcAnalys1.AllowUserToAddRows = false;
                }
                List <AnalysResultTotal> resultList = analyResultBLL.Get_All(InitialInterface.ProName, this.trvUcAnaly.SelectedNode.Text);
                if (resultList == null)
                {
                    resultList = new List <AnalysResultTotal>();
                }
                dgvCcAnalys1.DataSource = new BindingList <AnalysResultTotal>(resultList);
                UcAnalysis_SLRColor();
            }

            //选中参数节点,绑定参数下所有引导词数据,且“参数”列不可见
            //此时,“参数+引导词”列才能选择,绑定数据源
            if (treeView.SelectedNode.Level == 2)
            {
                if (dgvCcAnalys1.Columns["dgcCcAnalyParamsAndIntro"].ReadOnly == true)
                {
                    dgvCcAnalys1.Columns["dgcCcAnalyParamsAndIntro"].ReadOnly = false;
                }
                if (dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible == true)
                {
                    dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible = false;
                }
                if (dgvCcAnalys1.AllowUserToAddRows == false)
                {
                    dgvCcAnalys1.AllowUserToAddRows = true;
                }
                List <AnalysResultTotal> resultList = analyResultBLL.Get_Params(InitialInterface.ProName, selectedParam, this.trvUcAnaly.SelectedNode.Parent.Text);
                if (resultList == null)
                {
                    resultList = new List <AnalysResultTotal>();
                }
                dgvCcAnalys1.DataSource = new BindingList <AnalysResultTotal>(resultList);
                UcAnalysis_SLRColor();
            }
            //选中叶子节点即引导词,绑定引导词数据,且“参数”列不可见
            if (treeView.SelectedNode.Level == 3)
            {
                if (dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible == true)
                {
                    dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible = false;
                }
                if (dgvCcAnalys1.AllowUserToAddRows == true)
                {
                    dgvCcAnalys1.AllowUserToAddRows = false;
                }
                dgvCcAnalys1.Columns["dgcCcAnalyParams"].Visible          = false;
                dgvCcAnalys1.Columns["dgcCcAnalyParamsAndIntro"].ReadOnly = true;
                List <AnalysResultTotal> resultList = analyResultBLL.Get_Introduces(InitialInterface.ProName, selectedParam, this.trvUcAnaly.SelectedNode.Parent.Parent.Text);
                if (resultList == null)
                {
                    resultList = new List <AnalysResultTotal>();
                }
                dgvCcAnalys1.DataSource = new BindingList <AnalysResultTotal>(resultList);
                UcAnalysis_SLRColor();
            }
        }