Exemple #1
0
        /// <summary>
        /// 获取N,P对照值

        /// </summary>
        public void AnalysisData(out string message)
        {
            message = string.Empty;
            clsSTConstract constractRule = new clsSTConstract();

            if (m_isSelfConstractValue)
            {
                constractRule = this.m_constract;
            }
            else
            {
                constractRule.Analysis(m_lstBoardItems);
                this.m_constract = constractRule;
            }

            string formula = this.m_checkProject.Formula;

            formula = formula.Replace("N", constractRule.NegativeValue.ToString());
            formula = formula.Replace("P", constractRule.PositiveValue.ToString());
            formula = formula.Replace("B", constractRule.BlankValue.ToString());

            ExpressionEval eval = new ExpressionEval();

            foreach (clsSTBoardItem boardItem in m_lstBoardItems)
            {
                if (boardItem.BoardStyle.SampleStyle == enmSTSampleStyle.NONE)
                {
                    continue;
                }

                string evalExpression = formula.Replace("V", boardItem.DataNum);
                eval.Expression = evalExpression;
                bool result = false;
                try
                {
                    result = eval.EvaluateBool();
                }
                catch (Exception ex)
                {
                    message = "公式配置不对或者数据不正确! 系统消息:" + ex.Message;
                    return;
                }

                boardItem.IsPositive = result;
            }

            if (DataChanged != null)
            {
                DataChanged(this, new DataChangedEventArgs(enmSTTextBoxShowStatus.ResultText));
            }
        }
Exemple #2
0
        /// <summary>
        /// 确认修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_cmdSubmitModi_Click(object sender, EventArgs e)
        {
            manager.IsSelfConstractValue = true;
            clsSTConstract constract = new clsSTConstract();

            try { constract.NegativeValue = float.Parse(m_txtNegative.Text); }
            catch { constract.NegativeValue = 0; }

            try { constract.PositiveValue = float.Parse(m_txtPositive.Text); }
            catch { constract.PositiveValue = 0; }

            try { constract.BlankValue = float.Parse(m_txtBlank.Text); }
            catch { constract.BlankValue = 0; }

            manager.ConstractValue = constract;

            this.m_txtNegative.Enabled = false;
            this.m_txtPositive.Enabled = false;
            this.m_txtBlank.Enabled    = false;

            this.m_cmdModfifyConstract.Visible = true;
            this.m_cmdSubmitModi.Visible       = false;
        }
Exemple #3
0
        private void m_cmdAnalysis_Click(object sender, EventArgs e)
        {
            if (m_selectProject == null || m_selectProject.Name == string.Empty)
            {
                MessageBox.Show("请选择检验项目!");
                return;
            }

            if (m_selectTemplate == null || m_selectTemplate.TemplateName == string.Empty)
            {
                MessageBox.Show("请选择模板!");
                return;
            }

            if (m_lstCheckResults == null || m_lstCheckResults.Count == 0)
            {
                MessageBox.Show("没有酶标检验项目结果!");
                return;
            }

            clsSTConstract constractRule = new clsSTConstract();
            float          fltNegative   = 0;
            float          fltPositive   = 0;


            try { fltNegative = float.Parse(this.m_txtNegative.Text); }
            catch { fltNegative = -1; }

            try { fltPositive = float.Parse(this.m_txtPositive.Text); }
            catch { fltPositive = -1; }

            if (fltNegative == -1 || fltPositive == -1)
            {
                constractRule.Analysis(m_lstBoard);

                this.m_txtNegative.Text = constractRule.NegativeValue.ToString();
                this.m_txtPositive.Text = constractRule.PositiveValue.ToString();

                fltNegative = constractRule.NegativeValue;
                fltPositive = constractRule.PositiveValue;
            }

            string formula = this.m_selectProject.Formula;

            formula = formula.Replace("N", fltNegative.ToString());
            formula = formula.Replace("P", fltPositive.ToString());

            ExpressionEval eval = new ExpressionEval();


            foreach (clsSTBoardItem boardItem in m_lstBoard)
            {
                formula         = formula.Replace("V", boardItem.DataNum);
                eval.Expression = formula;
                if (eval.EvaluateBool())
                {
                    boardItem.IsPositive = true;
                }
                else
                {
                    boardItem.IsPositive = false;
                }
            }

            DisplayCheckResult(enmSTTextBoxShowStatus.ResultText);
        }