//公共方法 /// <summary> /// 批量设置一卡通账户金额 /// </summary> /// <param name="idcards"></param> /// <param name="money"></param> /// <param name="moneyType"></param> /// <param name="opt"></param> /// <returns></returns> public OptResult SetMoneyBatch(IEnumerable <string> idcards, decimal money, MoneyEnum moneyType, string opt) { var desc = moneyType.GetDescription() + "(批量)"; return(base.BatchProcess(idcards, opt, desc, (param) => { var p = (SetMoneySingleProcessParam)param; return SetMoneySingle(p); }, () => { return new SetMoneySingleProcessParam { money = money, moneyType = moneyType }; })); }
/// <summary> /// 设置单个一卡通账户的金额 /// </summary> /// <param name="idcard"></param> /// <param name="money"></param> /// <param name="moneyType"></param> /// <param name="@operator"></param> /// <returns></returns> public OptResult SetMoneySingle(string idcard, decimal money, MoneyEnum moneyType, string opt) { OptResult rst = null; //1、账户是否存在 var card = GetByIdcard(idcard); if (card == null) { var desc = moneyType.GetDescription() + "(单账户)"; rst = OptResult.Build(ResultCode.DataNotFound, string.Format("{0}——指定身份证号{1}的账户不存在!", desc, idcard)); return(rst); } return(SetMoneySingle(new SetMoneySingleProcessParam { card = card, money = money, moneyType = moneyType, opt = opt })); }