public void ChangePriority(RulesetInfoDataMaintain highPriority, RulesetInfoDataMaintain lowPriority) { highPriority.Priority = highPriority.Priority + 1; lowPriority.Priority = lowPriority.Priority - 1; UnitOfWork uow = new UnitOfWork(); ProcessRuleSet ruleset1 = new ProcessRuleSet(); ruleset1.Cdt = highPriority.Cdt; ruleset1.Condition1 = highPriority.Condition1; ruleset1.Condition2 = highPriority.Condition2; ruleset1.Condition3 = highPriority.Condition3; ruleset1.Condition4 = highPriority.Condition4; ruleset1.Condition5 = highPriority.Condition5; ruleset1.Condition6 = highPriority.Condition6; ruleset1.Editor = highPriority.Editor; ruleset1.ID = highPriority.Id; ruleset1.Priority = highPriority.Priority; ruleset1.Udt = highPriority.Udt; ProcessRuleSet ruleset2 = new ProcessRuleSet(); ruleset2.Cdt = lowPriority.Cdt; ruleset2.Condition1 = lowPriority.Condition1; ruleset2.Condition2 = lowPriority.Condition2; ruleset2.Condition3 = lowPriority.Condition3; ruleset2.Condition4 = lowPriority.Condition4; ruleset2.Condition5 = lowPriority.Condition5; ruleset2.Condition6 = lowPriority.Condition6; ruleset2.Editor = lowPriority.Editor; ruleset2.ID = lowPriority.Id; ruleset2.Priority = lowPriority.Priority; ruleset2.Udt = lowPriority.Udt; //若有应用Rule Set List表格中的当前选项或其上一个选项的Rule存在,则删除Model_Process数据表中的所有记录。 if ((processRepository.GetAllRuleByRuleSetID(highPriority.Id) != null && processRepository.GetAllRuleByRuleSetID(highPriority.Id).Count > 0) || (processRepository.GetAllRuleByRuleSetID(lowPriority.Id) != null && processRepository.GetAllRuleByRuleSetID(lowPriority.Id).Count > 0)) { processRepository.DeleteAllModelProcessDefered(uow); } ProcessRuleSet tempRuleSet1 = processRepository.GetRuleSetById(ruleset1.ID); ProcessRuleSet tempRuleSet2 = processRepository.GetRuleSetById(ruleset2.ID); ruleset1.Priority = tempRuleSet2.Priority; ruleset2.Priority = tempRuleSet1.Priority; processRepository.UpdateRuleSetPriorityDefered(uow, ruleset1); processRepository.UpdateRuleSetPriorityDefered(uow, ruleset2); uow.Commit(); }
public IList<RulesetInfoDataMaintain> GetProcessRuleSetList() { IList<ProcessRuleSet> result = processRepository.GetAllProcessRuleset(); IList<RulesetInfoDataMaintain> rulesetInfoList = new List<RulesetInfoDataMaintain>(); foreach (ProcessRuleSet ruleset in result) { RulesetInfoDataMaintain rulesetInfo = new RulesetInfoDataMaintain(); rulesetInfo.Cdt = ruleset.Cdt; rulesetInfo.Condition1 = ruleset.Condition1; rulesetInfo.Condition2 = ruleset.Condition2; rulesetInfo.Condition3 = ruleset.Condition3; rulesetInfo.Condition4 = ruleset.Condition4; rulesetInfo.Condition5 = ruleset.Condition5; rulesetInfo.Condition6 = ruleset.Condition6; rulesetInfo.Editor = ruleset.Editor; rulesetInfo.Id = ruleset.ID; rulesetInfo.Priority = ruleset.Priority; rulesetInfo.Udt = ruleset.Udt; rulesetInfoList.Add(rulesetInfo); } return rulesetInfoList; }
public void EditAddProcessRuleSet(RulesetInfoDataMaintain singleRuleSet) { //若Rule Set CheckList框中所有被选项与Rule Set List中某个栏位组合完全对应相同,则警示用户,放弃后续操作 //若已有应用当前被选Rule Set的Rule存在,则删除这些Rule,同时删除Model_Process数据表中的所有记录。 ProcessRuleSet ruleset = new ProcessRuleSet(); ruleset.ID = singleRuleSet.Id; ruleset.Priority = singleRuleSet.Id; ruleset.Condition1 = singleRuleSet.Condition1; ruleset.Condition2 = singleRuleSet.Condition2; ruleset.Condition3 = singleRuleSet.Condition3; ruleset.Condition4 = singleRuleSet.Condition4; ruleset.Condition5 = singleRuleSet.Condition5; ruleset.Condition6 = singleRuleSet.Condition6; ruleset.Udt = DateTime.Now; ruleset.Editor = singleRuleSet.Editor; if(processRepository.IFRuleSetIsExists(ruleset)) { List<string> erpara = new List<string>(); FisException ex = new FisException("DMT031", erpara); throw ex; } UnitOfWork uow = new UnitOfWork(); //mantis 1406 //检查是否该Rule已经被使用,若被使用,则警示用户,放弃后续操作。 IList<ProcessRule> list = new List<ProcessRule>(); list = processRepository.GetAllRuleByRuleSetID(singleRuleSet.Id); if (list != null && list.Count > 0) { List<string> erpara = new List<string>(); FisException ex = new FisException("DMT157", erpara); throw ex; } /*if (processRepository.GetAllRuleByRuleSetID(singleRuleSet.Id) != null && processRepository.GetAllRuleByRuleSetID(singleRuleSet.Id).Count > 0) { processRepository.DeleteRuleByRuleSetIDDefered(uow,singleRuleSet.Id); processRepository.DeleteAllModelProcessDefered(uow); }*/ //mantis 1406 processRepository.UpdateProcessRuleSetDefered(uow,ruleset); uow.Commit(); }
public string AddProcessRuleSet(RulesetInfoDataMaintain singleRuleSet) { //若Rule Set CheckList框中所有被选项与Rule Set List中某个栏位组合完全对应相同,则警示用户,放弃后续操作 ProcessRuleSet ruleset = new ProcessRuleSet(); UnitOfWork uow = new UnitOfWork(); ruleset.ID = singleRuleSet.Id; ruleset.Priority = singleRuleSet.Id; ruleset.Condition1 = singleRuleSet.Condition1; ruleset.Condition2 = singleRuleSet.Condition2; ruleset.Condition3 = singleRuleSet.Condition3; ruleset.Condition4 = singleRuleSet.Condition4; ruleset.Condition5 = singleRuleSet.Condition5; ruleset.Condition6 = singleRuleSet.Condition6; ruleset.Cdt = DateTime.Now; ruleset.Udt = DateTime.Now; ruleset.Editor = singleRuleSet.Editor; if (processRepository.IFRuleSetIsExists(ruleset)) { List<string> erpara = new List<string>(); FisException ex = new FisException("DMT031", erpara); throw ex; } processRepository.AddProcessRuleSet(ruleset); processRepository.DeleteAllModelProcessDefered(uow); uow.Commit(); return ruleset.ID.ToString(); }
private void processCondition(RulesetInfoDataMaintain priorityObj, string condition) { string[] columns = null; int columnLength = -1; if (!string.IsNullOrEmpty(condition)) { columns = condition.Split('+'); } columnLength = columns.Length; for (int i = 0; i < columnLength; i++) { priorityObj.GetType().GetProperty(("Condition" + (i + 1))).SetValue(priorityObj, columns[i], null); } }
protected void btnSave_ServerClick(Object sender, EventArgs e) { try { string condition = hidFld1.Value; string conditionID = hidConditionID.Value; RulesetInfoDataMaintain rulesetInfo = new RulesetInfoDataMaintain(); IList<ProcessRule> lstProcessRule = null; rulesetInfo.Editor = UserId; processCondition(rulesetInfo, condition); rulesetInfo.Id = int.Parse(conditionID); gCurrentID = rulesetInfo.Id; iModelProcess.EditAddProcessRuleSet(rulesetInfo); initRuleSetList(); initRuleSet(); checkedCheckBoxList(condition, lstChkRuleSet); if (gHasHightRow) { lstProcessRule = iModelProcess.GetRuleListByCondition(gCurrentID); } this.updatePanel2.Update(); this.updatePanel1.Update(); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); } catch (Exception ex) { showErrorMessage(ex.Message); } finally { hideWait(); } }
protected void btnAdd_ServerClick(Object sender, EventArgs e) { try { string condition = hidFld1.Value; RulesetInfoDataMaintain rulesetInfo = new RulesetInfoDataMaintain(); rulesetInfo.Editor = UserId; processCondition(rulesetInfo, condition); string ruleId = iModelProcess.AddProcessRuleSet(rulesetInfo); gCurrentID = int.Parse(ruleId); initRuleSetList(); initRuleSet(); checkedCheckBoxList(condition, lstChkRuleSet); this.updatePanel2.Update(); this.updatePanel1.Update(); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); } catch (Exception ex) { showErrorMessage(ex.Message); } finally { hideWait(); } }
protected void btnUpDown_ServerClick(Object sender, EventArgs e) { string highPriorityID = this.hidConditionID.Value; string lowPriorityID = this.hidConditionID2.Value; string highPriorityCondition = this.hidFld1.Value; string lowPriorityCondition = this.hidFld2.Value; RulesetInfoDataMaintain highPriority = new RulesetInfoDataMaintain(); RulesetInfoDataMaintain lowPriority = new RulesetInfoDataMaintain(); highPriority.Id = int.Parse(highPriorityID); processCondition(highPriority, highPriorityCondition); lowPriority.Id = int.Parse(lowPriorityID); processCondition(lowPriority, lowPriorityCondition); highPriority.Editor = UserId; lowPriority.Editor = UserId; try { HtmlInputButton btn = (HtmlInputButton)sender; if (string.Compare(btn.ID, "btnUp") == 0) { gCurrentID = int.Parse(highPriorityID); } else { gCurrentID = int.Parse(lowPriorityID); } iModelProcess.ChangePriority(highPriority, lowPriority); initRuleSetList(); initRuleSet(); //checkedCheckList(highPriorityCondition, highPriorityID, lstRuleSet); if (string.Compare(btn.ID, "btnUp") == 0) { checkedCheckBoxList(highPriorityCondition, lstChkRuleSet); } else { checkedCheckBoxList(lowPriorityCondition, lstChkRuleSet); } this.updatePanel2.Update(); this.updatePanel1.Update(); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); } catch (Exception ex) { showErrorMessage(ex.Message); } finally { hideWait(); } }