コード例 #1
0
ファイル: CurrencyService.cs プロジェクト: robin88/wojilu
        //---------------------------------- (中心货币的)收入规则操作 ---------------------------------------------
        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;
        }
コード例 #2
0
ファイル: CurrencyService.cs プロジェクト: robin88/wojilu
        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();
        }