Exemplo n.º 1
0
 void GetRelateRules(QCRule rule, string relateIds, IList <QCCondition> allconditions, IList <QCResult> allresults)
 {
     rule.ClearRelateRules();
     string[] ruleIds = relateIds.Split(',');
     for (int i = 0; i < ruleIds.Length; i++)
     {
         string ruleId = ruleIds[i].Trim();
         if (string.IsNullOrEmpty(ruleId))
         {
             continue;
         }
         QCRule relaterule = null;
         if (allconditions == null || allresults == null)
         {
             relaterule = GetQCRuleById(ruleId);
         }
         else
         {
             relaterule = GetQCRuleById(ruleId, allconditions, allresults);
         }
         if (relaterule != null)
         {
             rule.AddRelateRule(relaterule);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Clone
        /// </summary>
        /// <returns></returns>
        public QCRule Clone()
        {
            QCRule qcrc = new QCRule(_id, _name, _dutylevel);

            qcrc.Timelimit        = _timelimit;
            qcrc.TipInfo          = _tipInfo;
            qcrc.WarnInfo         = _warnInfo;
            qcrc.RelateDealType   = _relateDealType;
            qcrc.DealType         = _dealType;
            qcrc.LoopTimes        = _looptimes;
            qcrc.LoopTimeInterVal = _looptimeinterval;
            qcrc.Invalid          = _invalid;
            if (_condition != null)
            {
                qcrc.Condition = _condition.Clone();
            }
            if (_result != null)
            {
                qcrc.Result = _result.Clone();
            }
            if (_group != null)
            {
                qcrc.Group = _group.Clone();
            }
            return(qcrc);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 构造已有记录
 /// </summary>
 /// <param name="xh"></param>
 /// <param name="patid"></param>
 /// <param name="eprid"></param>
 /// <param name="rule"></param>
 public QCRuleRecord(decimal xh, int patid, int eprid, QCRule rule)
 {
     _patId = patid;
     _eprId = eprid;
     _rule  = rule;
     _xh    = xh;
 }
Exemplo n.º 4
0
        /// <summary>
        /// 增加规则纪录
        /// </summary>
        /// <param name="patid">病人Id</param>
        /// <param name="eprid">病历Id</param>
        /// <param name="opdoctor">操作医生</param>
        /// <param name="conditionType">时限规则条件类别</param>
        /// <param name="conditionObject">条件对象,用来定位具体的条件</param>
        /// <param name="conditionTime">条件发生时间</param>
        public void AddRuleRecord(int patid, int eprid, string opdoctor, QCConditionType conditionType, object conditionObject, DateTime conditionTime)
        {
            DoctorManagerPatient dmp = _patientdal.SelectDoctorManagerPatient(patid);

            if (dmp == null)
            {
                return;
            }

            QCCondition qcc = QCCondition.SelectQCCondition(conditionType, conditionObject);

            if (qcc == null)
            {
                return;
            }

            IList <QCRule> rules = QCRule.GetRulesByCondition(qcc);

            foreach (QCRule rule in rules)
            {
                QCRuleRecord qcrr = new QCRuleRecord(patid, eprid, rule);
                qcrr.ConditionTime  = conditionTime;
                qcrr.ConditionState = CompleteType.Completed;
                qcrr.RuleState      = RuleRecordState.UndoIntime;
                qcrr.CreateDoctor   = opdoctor;
                SetQcRuleRecordState(rule, qcrr);
                _rulerecorddal.InsertPatientRuleRecord(dmp, qcrr);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 数据行 -> 时限
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        public QCRule DataRow2QCRule(DataRow row)
        {
            QCRule rule = DataRow2QCRuleBase(row);

            QCConditionDal qccd = new QCConditionDal();

            rule.Condition = qccd.GetConditionById(row[col_ConditionCode].ToString());
            QCResultDal qcrd = new QCResultDal();

            rule.Result = qcrd.GetResultById(row[col_ResultCode].ToString());
            if (row[col_fldm] != DBNull.Value)
            {
                QCRuleGroupDal qcrgd = new QCRuleGroupDal();
                rule.Group = qcrgd.GetRuleGroupById(row[col_fldm].ToString());
            }

            string relaterules = row[col_RelatedRule].ToString();

            if (!string.IsNullOrEmpty(relaterules))
            {
                GetRelateRules(rule, relaterules);
            }

            return(rule);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 构造新的记录
 /// </summary>
 public QCRuleRecord(int patid, int eprid, QCRule rule)
 {
     _patId = patid;
     _eprId = eprid;
     _rule  = rule;
     _xh    = -1;
 }
Exemplo n.º 7
0
 void NewRule()
 {
     if (_currentRule != null && _needSave)
     {
         // tip for save
     }
     _currentRule = new QCRule();
 }
Exemplo n.º 8
0
 void InitRules()
 {
     _conditions    = QCCondition.AllConditions;
     _results       = QCResult.AllResults;
     _groups        = QCRuleGroup.AllRuleGroups;
     _rules         = QCRule.GetAllRules(_conditions, _results);
     _rulerecorddal = new QCRuleRecordDal();
     _patientdal    = new DoctorManagerPatientInfoDal();
 }
Exemplo n.º 9
0
 void gridViewRules_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     if (e.FocusedRowHandle >= 0)
     {
         _currentRule = null;   //防止清空编辑控件时改动对象相关属性
         ClearEditInterface();
         _currentRule = gridViewRules.GetRow(e.FocusedRowHandle) as QCRule;
         ShowARule(_currentRule);
     }
 }
Exemplo n.º 10
0
 bool CheckRelateNoContain(QCRule rule)
 {
     foreach (QCRule subrule in _relateRules)
     {
         if (subrule.Id == rule.Id)
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 11
0
        /// <summary>
        /// 数据库删除规则
        /// </summary>
        /// <param name="rule"></param>
        public void DeleteQCRule(QCRule rule)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }
            SqlParameter paramGzdm = new SqlParameter(param_RuleCode, SqlDbType.VarChar, 64);

            paramGzdm.Value = rule.Id;
            _sqlHelper.ExecuteNoneQuery(SQL_DeleteRule,
                                        new SqlParameter[] { paramGzdm });
        }
Exemplo n.º 12
0
 /// <summary>
 /// 增加相关规则
 /// </summary>
 /// <returns></returns>
 public bool AddRelateRule(QCRule rule)
 {
     if (!CheckRelateNoLoop(rule))
     {
         return(false);
     }
     if (!CheckRelateNoContain(rule))
     {
         return(false);
     }
     this._relateRules.Add(rule.Clone());
     return(true);
 }
Exemplo n.º 13
0
 void gridViewRules_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
 {
     if (e.RowHandle >= 0)
     {
         QCRule rule = gridViewRules.GetRow(e.RowHandle) as QCRule;
         if (rule != null)
         {
             if (rule.Invalid)
             {
                 e.Appearance.ForeColor = Color.Red;
             }
         }
     }
 }
Exemplo n.º 14
0
        void buttonDelRule_Click(object sender, EventArgs e)
        {
            if (_currentRule == null)
            {
                return;
            }
            DialogResult dlgr = app.CustomMessageBox.MessageShow(ConstRes.cstConfirmDelete, CustomMessageBoxKind.QuestionYesNo);

            if (dlgr == DialogResult.Yes)
            {
                QCRule.DeleteQCRule(_currentRule);
                ReloadRules();
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// 保存时限规则条件到数据库
 /// </summary>
 /// <param name="rule"></param>
 public void SaveRule(QCRule rule)
 {
     if (rule == null)
     {
         throw new ArgumentNullException("rule");
     }
     SqlParameter[] sqlparams = InitQCRuleParams(rule);
     if (rule.IsNew)
     {
         _sqlHelper.ExecuteNoneQuery(SQL_InsertRule, sqlparams);
     }
     else
     {
         _sqlHelper.ExecuteNoneQuery(SQL_UpdateRule, sqlparams);
     }
 }
Exemplo n.º 16
0
        void ReloadRules()
        {
            ReloadConditions();
            ReloadResults();
            ReloadRuleGroups();
            _rules = QCRule.GetAllRules(_conditions, _results);

            if (_conditions == null || _results == null || _rules == null)
            {
                return;
            }

            gridRules.DataSource = _rules;
            SetGridViewRule();
            SetEditState(EditState.None);
        }
Exemplo n.º 17
0
        SqlParameter[] InitQCRuleParams(QCRule rule)
        {
            SqlParameter paramGzdm = new SqlParameter(param_RuleCode, SqlDbType.VarChar, 64);
            SqlParameter paramTjdm = new SqlParameter(param_ConditionCode, SqlDbType.VarChar, 64);
            SqlParameter paramJgdm = new SqlParameter(param_ResultCode, SqlDbType.VarChar, 64);
            SqlParameter paramGzms = new SqlParameter(param_Description, SqlDbType.VarChar, 64);
            SqlParameter paramTsxx = new SqlParameter(param_Reminder, SqlDbType.VarChar, 255);
            SqlParameter paramWgxx = new SqlParameter(param_FoulMessage, SqlDbType.VarChar, 255);
            SqlParameter paramGzsx = new SqlParameter(param_TimeLimit, SqlDbType.Float);
            SqlParameter paramXggz = new SqlParameter(param_RelatedRule, SqlDbType.VarChar, 1024);
            SqlParameter paramXgcl = new SqlParameter(param_RelatedMark, SqlDbType.Int);
            SqlParameter paramClbz = new SqlParameter(param_Mark, SqlDbType.Int);
            SqlParameter paramXhcs = new SqlParameter(param_xhcs, SqlDbType.Int);
            SqlParameter paramXhjg = new SqlParameter(param_xhjg, SqlDbType.Float);
            SqlParameter paramYsjb = new SqlParameter(param_ysjb, SqlDbType.Int);
            SqlParameter paramFldm = new SqlParameter(param_fldm, SqlDbType.VarChar, 64);
            SqlParameter paramYxjl = new SqlParameter(param_Valid, SqlDbType.Int);
            SqlParameter paramMemo = new SqlParameter(param_Memo, SqlDbType.VarChar, 64);

            paramGzdm.Value = rule.Id;
            paramTjdm.Value = rule.Condition.Id;
            paramJgdm.Value = rule.Result.Id;
            paramGzms.Value = rule.Name;
            paramTsxx.Value = rule.TipInfo;
            paramWgxx.Value = rule.WarnInfo;
            paramGzsx.Value = rule.Timelimit.TotalSeconds;
            paramXggz.Value = rule.RelateRuleIds;
            paramXgcl.Value = (int)rule.RelateDealType;
            paramClbz.Value = (int)rule.DealType;
            paramXhcs.Value = rule.LoopTimes;
            paramXhjg.Value = rule.LoopTimeInterVal.TotalSeconds;
            paramYsjb.Value = (int)rule.Dutylevel + ConstRes.cstDoctorLevelNo;
            if (rule.Group != null)
            {
                paramFldm.Value = rule.Group.Id;
            }
            paramYxjl.Value = rule.Invalid?0:1;
            paramMemo.Value = string.Empty;

            return(new SqlParameter[] {
                paramGzdm, paramTjdm, paramJgdm, paramGzms, paramTsxx,
                paramWgxx, paramGzsx, paramXggz, paramXgcl, paramClbz,
                paramXhcs, paramXhjg,
                paramYsjb, paramFldm, paramYxjl, paramMemo
            });
        }
Exemplo n.º 18
0
        QCRule DataRow2QCRuleBase(DataRow row)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            string    ruleId          = row[col_RuleCode].ToString();
            string    ruleDescription = row[col_Description].ToString();
            DutyLevel dutyLevel       = DutyLevel.All;

            if (row[col_ysjb] != DBNull.Value)
            {
                dutyLevel = (DutyLevel)(int.Parse(row[col_ysjb].ToString()) - ConstRes.cstDoctorLevelNo);
            }

            QCRule qcr = new QCRule(ruleId, ruleDescription, dutyLevel);

            qcr.TipInfo   = row[col_Reminder].ToString();
            qcr.WarnInfo  = row[col_FoulMessage].ToString();
            qcr.Timelimit = new TimeSpan(0, 0, Convert.ToInt32(double.Parse(row[col_TimeLimit].ToString())));
            if (row[col_RelatedMark] != DBNull.Value)
            {
                qcr.RelateDealType = (RelateRuleDealType)int.Parse(row[col_RelatedMark].ToString());
            }
            if (row[col_Mark] != DBNull.Value)
            {
                qcr.DealType = (RuleDealType)int.Parse(row[col_Mark].ToString());
            }
            if (qcr.DealType == RuleDealType.Loop)
            {
                qcr.LoopTimes        = int.Parse(row[col_xhcs].ToString());
                qcr.LoopTimeInterVal = new TimeSpan(0, 0, Convert.ToInt32(double.Parse(row[col_xhjg].ToString())));
            }
            if (int.Parse(row[col_Valid].ToString()) == 1)
            {
                qcr.Invalid = false;
            }
            else
            {
                qcr.Invalid = true;
            }

            return(qcr);
        }
Exemplo n.º 19
0
 bool CheckRelateNoLoop(QCRule rule)
 {
     if (rule.Id == this.Id)
     {
         return(false);
     }
     if (rule.RelateRules != null)
     {
         foreach (QCRule subrule in rule.RelateRules)
         {
             if (!CheckRelateNoLoop(subrule))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Exemplo n.º 20
0
        /// <summary>
        /// 由于条件取消导致规则记录取消
        /// </summary>
        /// <param name="patid"></param>
        /// <param name="eprid"></param>
        /// <param name="opdoctor"></param>
        /// <param name="conditionType"></param>
        /// <param name="conditionObject"></param>
        /// <param name="conditionTime"></param>
        public void CancelRuleRecord(int patid, int eprid, string opdoctor, QCConditionType conditionType, object conditionObject, DateTime conditionTime)
        {
            DoctorManagerPatient dmp = _patientdal.SelectDoctorManagerPatient(patid);

            if (dmp == null)
            {
                return;
            }

            QCCondition qcc = QCCondition.SelectQCCondition(conditionType, conditionObject);

            if (qcc == null)
            {
                return;
            }

            IList <QCRule> rules = QCRule.GetRulesByCondition(qcc);

            if (rules == null || rules.Count == 0)
            {
                return;
            }

            DataTable dtrulerecords = SelectPatientRuleRecords(patid, false);
            Collection <QCRuleRecord> rulerecords = GetRuleRecordsCollection(dtrulerecords);

            for (int i = 0; i < rulerecords.Count; i++)
            {
                QCRuleRecord qcrr = rulerecords[i];
                if (qcrr.ResultState == CompleteType.Completed)
                {
                    continue;
                }
                QCRule existsrule = ((List <QCRule>) rules).Find(delegate(QCRule rule)
                {
                    return(rule.Id == qcrr.Rule.Id);
                });
                qcrr.RecordState = RecordState.Invalid;
                _rulerecorddal.UpdatePatientRuleRecord(dmp, qcrr);
            }
        }
Exemplo n.º 21
0
 void listBoxRelateRules_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Insert)
     {
         string codevalue = _currentRule.RelateRuleIds;
         _showlistwindow.CallLookUpWindow(_rulewordbook, WordbookKind.Sql, codevalue,
                                          ShowListFormMode.Full, textEditRelateRules.PointToScreen(textEditRelateRules.Location),
                                          new Size(100, 25), this.Bounds);
         _currentRule.ClearRelateRules();
         if (!string.IsNullOrEmpty(_showlistwindow.CodeValue))
         {
             string[] ruleids = _showlistwindow.CodeValue.Split(',');
             foreach (string ruleid in ruleids)
             {
                 QCRule qcr = QCRule.SelectQCRule(ruleid).Clone();
                 _currentRule.AddRelateRule(qcr);
             }
         }
         textEditRelateRules.Text = _currentRule.RelateRuleIds;
     }
 }
Exemplo n.º 22
0
        void SetQcRuleRecordState(QCRule rule, QCRuleRecord qcrr)
        {
            switch (rule.DealType)
            {
            case RuleDealType.Once:
            case RuleDealType.Loop:
                qcrr.RecordState = RecordState.Valid;
                break;

            case RuleDealType.NeedTrigger:
                qcrr.RecordState = RecordState.ValidWait;
                break;

            case RuleDealType.InnerForTrigger:
                qcrr.RecordState = RecordState.ValidNonVisible;
                break;

            default:
                break;
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 数据行 -> 时限纪录
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        public QCRuleRecord DataRow2QCRuleRecord(DataRow row)
        {
            decimal      xh     = decimal.Parse(row[col_xh].ToString());
            int          patid  = int.Parse(row[col_syxh].ToString());
            int          eprid  = int.Parse(row[col_blxh].ToString());
            QCRule       rule   = QCRule.SelectQCRule(row[col_gzdm].ToString());
            QCRuleRecord record = new QCRuleRecord(xh, patid, eprid, rule);

            record.CreateDoctor   = row[col_cjzgdm].ToString();
            record.CreateTime     = DateTime.Parse(row[col_czsj].ToString());
            record.DutyDoctor     = row[col_zgdm].ToString();
            record.ConditionTime  = DateTime.Parse(row[col_tjsj].ToString());
            record.ConditionState = (CompleteType)int.Parse(row[col_tjzt].ToString());
            record.ResultTime     = DateTime.Parse(row[col_jgsj].ToString());
            record.ResultState    = (CompleteType)int.Parse(row[col_jgzt].ToString());
            record.RuleState      = (RuleRecordState)int.Parse(row[col_wgzt].ToString());
            if (row[col_xhjs] != DBNull.Value)
            {
                record.LoopCount = int.Parse(row[col_xhjs].ToString());
            }
            return(record);
        }
Exemplo n.º 24
0
        void ShowARule(QCRule rule)
        {
            if (rule == null)
            {
                return;
            }

            textBoxConditionId.Text             = rule.Condition.Id;
            textBoxConditionName.Text           = rule.Condition.Name;
            textBoxConditionParams.Text         = rule.Condition.JudgeSetting;
            comboBoxConditionType.SelectedIndex = ((int)rule.Condition.ConditionType) - 1;

            textBoxResultId.Text             = rule.Result.Id;
            textBoxResultName.Text           = rule.Result.Name;
            textBoxResultParams.Text         = rule.Result.JudgeSetting;
            comboBoxResultType.SelectedIndex = ((int)rule.Result.ResultType) - 1;

            textBoxRuleId.Text              = rule.Id;
            textBoxRuleName.Text            = rule.Name;
            comboBoxDutyLevel.SelectedIndex = (int)rule.Dutylevel;
            textBoxRuleTime.Text            = QCRule.TimeSpan2LimitString(rule.Timelimit);
            textBoxTipInfo.Text             = rule.TipInfo;
            textBoxWarningInfo.Text         = rule.WarnInfo;
            checkEditValid.Checked          = !rule.Invalid;
            comboBoxOpMode.SelectedIndex    = (int)rule.DealType;
            if (rule.DealType == RuleDealType.Loop)
            {
                textEditLooptimes.Text    = rule.LoopTimes.ToString();
                textEditLoopinterval.Text = QCRule.TimeSpan2LimitString(rule.LoopTimeInterVal);
            }
            comboBoxRelateRuleOpMode.SelectedIndex = (int)rule.RelateDealType;
            textEditRelateRules.Text = rule.RelateRuleIds;

            if (_currentRule.Group != null)
            {
                lookUpEditRuleGroup.EditValue = _currentRule.Group.Id;
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 数据行 -> 时限
        /// </summary>
        /// <param name="row">数据</param>
        /// <param name="allconditions">所有规则条件</param>
        /// <param name="allresults">所有规则结果</param>
        /// <param name="loadRelated">是否加载相关规则</param>
        /// <returns></returns>
        public QCRule DataRow2QCRule(DataRow row, IList <QCCondition> allconditions, IList <QCResult> allresults, bool loadRelated)
        {
            QCRule rule = DataRow2QCRuleBase(row);

            string conditionId = row[col_ConditionCode].ToString();
            string resultId    = row[col_ResultCode].ToString();
            string groupId     = string.Empty;

            if (row[col_fldm] != DBNull.Value)
            {
                groupId = row[col_fldm].ToString();
            }
            QCCondition qcc  = QCCondition.SelectQCCondition(conditionId);
            QCResult    qcr  = QCResult.SelectQCResult(resultId);
            QCRuleGroup qcrg = QCRuleGroup.SelectQCRuleGroup(groupId);

            rule.Condition = qcc;
            rule.Result    = qcr;
            rule.Group     = qcrg;

            string relaterules = row[col_RelatedRule].ToString();

            if (!string.IsNullOrEmpty(relaterules))
            {
                if (loadRelated)
                {
                    GetRelateRules(rule, relaterules, allconditions, allresults);
                }
                else
                {
                    rule.PreRelateRuleIds = relaterules;
                }
            }

            return(rule);
        }
Exemplo n.º 26
0
 void GetRelateRules(QCRule rule, string relateIds)
 {
     GetRelateRules(rule, relateIds, null, null);
 }
Exemplo n.º 27
0
 /// <summary>
 /// 保存时限规则条件
 /// </summary>
 /// <param name="rule"></param>
 public static void SaveQCRule(QCRule rule)
 {
     dal.SaveRule(rule);
 }
Exemplo n.º 28
0
        /// <summary>
        /// 更新规则纪录(根据发生的结果更新已经存在的规则纪录)
        /// </summary>
        /// <param name="patid"></param>
        /// <param name="eprid"></param>
        /// <param name="opdoctor"></param>
        /// <param name="resultType"></param>
        /// <param name="resultObject"></param>
        /// <param name="resultTime"></param>
        public void UpdateRuleRecord(int patid, int eprid, string opdoctor, QCResultType resultType, object resultObject, DateTime resultTime)
        {
            DoctorManagerPatient dmp = _patientdal.SelectDoctorManagerPatient(patid);

            if (dmp == null)
            {
                return;
            }

            QCResult qcr = QCResult.SelectQCResult(resultType, resultObject);

            if (qcr == null)
            {
                return;
            }

            IList <QCRule> rules = QCRule.GetRulesByResult(qcr);

            if (rules == null || rules.Count == 0)
            {
                return;
            }

            DataTable dtrulerecords = SelectPatientRuleRecords(patid, false);
            Collection <QCRuleRecord> rulerecords = GetRuleRecordsCollection(dtrulerecords);
            Collection <decimal>      dealedXhs   = new Collection <decimal>();

            for (int i = 0; i < rulerecords.Count; i++)
            {
                QCRuleRecord qcrr = rulerecords[i];
                if (qcrr.ResultState == CompleteType.Completed)
                {
                    continue;
                }
                if (((List <QCRule>) rules).Find(
                        delegate(QCRule rule)
                {
                    return(rule.Id == qcrr.Rule.Id);
                }
                        ) == null
                    )
                {
                    continue;
                }
                if (dealedXhs.IndexOf(qcrr.Xh) != -1)
                {
                    continue;
                }
                qcrr.ResultTime  = resultTime;
                qcrr.ResultState = CompleteType.Completed;
                TimeSpan timelimit = qcrr.ResultTime - qcrr.ConditionTime;
                if (timelimit <= qcrr.Rule.Timelimit)
                {
                    qcrr.RuleState = RuleRecordState.DoIntime;
                }
                else
                {
                    qcrr.RuleState = RuleRecordState.DoOuttime;
                }

                _rulerecorddal.UpdatePatientRuleRecord(dmp, qcrr);

                Collection <QCRuleRecord> dealeds = DealRelateRuleRecords(rulerecords, patid, eprid, qcrr, dmp, resultTime, opdoctor);
                foreach (QCRuleRecord dealrecord in dealeds)
                {
                    dealedXhs.Add(dealrecord.Xh);
                }
            }
        }
Exemplo n.º 29
0
 /// <summary>
 /// 删除规则
 /// </summary>
 /// <param name="rule"></param>
 public static void DeleteQCRule(QCRule rule)
 {
     dal.DeleteQCRule(rule);
 }
Exemplo n.º 30
0
        void SaveCurrentRule()
        {
            if (_currentRule == null)
            {
                return;
            }

            string newId   = textBoxRuleId.Text;
            string newName = textBoxRuleName.Text;

            if (string.IsNullOrEmpty(newId))
            {
                app.CustomMessageBox.MessageShow(ConstRes.cstSaveCheckNeedQcRuleId);
                textBoxRuleId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(newName))
            {
                app.CustomMessageBox.MessageShow(ConstRes.cstSaveCheckNeedQcRuleName);
                textBoxRuleName.Focus();
                return;
            }
            if (_currentRule.IsNew)
            {
                if (QCRule.IdIsExisted(newId))
                {
                    app.CustomMessageBox.MessageShow(ConstRes.cstSaveCheckExistSameRuleId);
                    textBoxRuleId.Focus();
                    return;
                }
                _currentRule.Id   = newId;
                _currentRule.Name = newName;
            }

            if (comboBoxDutyLevel.SelectedIndex >= 0)
            {
                _currentRule.Dutylevel = (DutyLevel)(comboBoxDutyLevel.SelectedIndex);
            }
            else
            {
                _currentRule.Dutylevel = DutyLevel.All;
            }
            _currentRule.Timelimit = QCRule.LimitString2TimeSpan(textBoxRuleTime.Text);
            _currentRule.TipInfo   = textBoxTipInfo.Text;
            _currentRule.WarnInfo  = textBoxWarningInfo.Text;
            if (comboBoxOpMode.SelectedIndex >= 0)
            {
                _currentRule.DealType = (RuleDealType)((Enum2Chinese.ChineseEnum)comboBoxOpMode.SelectedItem).Value;
            }
            if (_currentRule.DealType == RuleDealType.Loop)
            {
                _currentRule.LoopTimes        = int.Parse(textEditLooptimes.Text);
                _currentRule.LoopTimeInterVal = QCRule.LimitString2TimeSpan(textEditLoopinterval.Text);
            }
            if (comboBoxRelateRuleOpMode.SelectedIndex >= 0)
            {
                _currentRule.RelateDealType = (RelateRuleDealType)((Enum2Chinese.ChineseEnum)comboBoxRelateRuleOpMode.SelectedItem).Value;
            }

            QCRule.SaveQCRule(_currentRule);
            app.CustomMessageBox.MessageShow(ConstRes.cstSaveSuccess);
            ReloadRules();
        }