public void DeleteRuleOfEty(BaseEntity Ety) { List <KindIdent> KindIdents; Int32 RulesIdx; if (Find(Ety, out KindIdents, out RulesIdx)) { KindIdents.RemoveAt(RulesIdx); } ThisModule.OleDB.ExecuteNonQuery("Delete from TRule " + " where FKind = '" + Ety.GetType().Name + "'" + " and FId = " + Ety.Id); }
public IList <VcRuleCell> GetRules(BaseEntity Ety) { IList <VcRuleCell> Result = new List <VcRuleCell>(); List <KindIdent> KindIdents; Int32 RulesIdx; if (Find(Ety, out KindIdents, out RulesIdx)) { ExIList.Append <VcRuleCell>(KindIdents[RulesIdx].Rules, Result); return(Result); } else { KindIdent ki = new KindIdent(Ety.GetType().Name); foreach (OleDbDataReader Reader in ThisModule.OleDB.EachRows("select FRule, FTime from TRule " + " where FKind = '" + ki.Kind + "'" + " and FId = " + Ety.Id)) { VcRuleCell rt = new VcRuleCell(); //rt.Rule = (eRule)ExMath.Bound(Convert.ToInt32(Reader[0]), (Int32)eRule.crisscross, (Int32)eRule.excellent, (Int32)eRule.common); var rd = ExConvert.TryToInt32(Reader[0], 0); rt.Rule = rd <(Int32)eRule.crisscross || rd> (Int32) eRule.excellent ? eRule.common : (eRule)rd; rt.Time = VcTimeLogic.GetTimeFromInt32(Convert.ToInt32(Reader[1])); ki.Rules.Add(rt); } if (KindIdents == null) { KindIdents = new List <KindIdent>(); KindIdents.Add(ki); RuleBuf.Add(Ety.Id, KindIdents); } else { KindIdents.Add(ki); } ExIList.Append <VcRuleCell>(ki.Rules, Result); return(Result); } }