示例#1
0
        /// <summary>
        /// 删除收款账户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool DeleteGatherAccount(GatherAccountModel model)
        {
            redisoperate.model = model;
            bool flag = databaseoperate.DeleteInDataBase(model);

            if (!flag)
            {
                return(false);       //数据库不成功就不要往下执行了
            }
            return(redisoperate.DeleteInRedis());
        }
示例#2
0
        /// <summary>
        /// 添加收款账户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddGatherAccount(GatherAccountModel model)
        {
            redisoperate.model = model;
            bool flag = databaseoperate.SaveToDataBase(model);

            if (!flag)
            {
                return(false);       //数据库不成功就不要往下执行了
            }
            return(redisoperate.SaveToRedis());
        }
示例#3
0
        /// <summary>
        /// 修改收款账户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool ModifyGatherAccount(GatherAccountModel model)
        {
            redisoperate.model = model;
            bool flag = databaseoperate.SaveToDataBase(model);

            if (!flag)
            {
                return(false);
            }
            //此时不需要判断redis是否成功,因为修改时redis一定会返回false
            redisoperate.SaveToRedis();
            return(true);
        }
示例#4
0
        /// <summary>
        /// 获取微信账户
        /// </summary>
        /// <param name="guid">该账户guid</param>
        /// <returns></returns>
        public WeChatAccountModel GetWeChatAccount(string guid)
        {
            GatherAccountModel model = GetGatherAccount(guid);

            if (model != null)
            {
                //List<IBaseModel> isvlist = _model.paymentISV;
                //foreach (var item in isvlist)
                //{
                //    var isv = item as WeChatAccountModel;
                //    if (isv != null) return isv; //成功转换 表示有账户存在
                //}
                return(model.WechatAccount);
            }
            return(null);
        }
示例#5
0
        /// <summary>
        /// 获取某收款账户
        /// </summary>
        /// <param name="guid">该账户guid</param>
        /// <returns></returns>
        public GatherAccountModel GetGatherAccount(string guid)
        {
            GatherAccountModel model = null;

            redisoperate.model = new GatherAccountModel()
            {
                Guid = guid
            };
            model = redisoperate.GetFromRedis();

            //从数据库读
            if (model == null)
            {
                model = databaseoperate.GetFromDataBase(guid);
                //缓存到redis
                if (model != null)
                {
                    redisoperate.model = model;
                    redisoperate.SaveToRedis();
                }
            }

            return(model);
        }