//---------------------------------- (中心货币的)收入规则操作 --------------------------------------------- public virtual KeyIncomeRule GetKeyIncomeRulesByAction( int actionId ) { List<KeyIncomeRule> savedRules = cdb.findAll<KeyIncomeRule>(); foreach (KeyIncomeRule r in savedRules) { if (r.ActionId == actionId) return r; } KeyIncomeRule rule = new KeyIncomeRule(); rule.ActionId = actionId; rule.insert(); return rule; }
public virtual void Save( KeyIncomeRule rule ) { if (rule == null) return; List<KeyIncomeRule> list = cdb.findAll<KeyIncomeRule>(); foreach (KeyIncomeRule savedRule in list) { if (rule.ActionId == savedRule.ActionId) { if (rule.Income != savedRule.Income) { savedRule.Income = rule.Income; savedRule.update(); } return; } } rule.insert(); }