コード例 #1
0
        public static bool UpdatePayConfig(WX_ApiConfig model)
        {
            IWXApiConfig factory = WXApiConfigFactory.GetFactory();
            bool         result  = factory.UpdatePayConfig(model);

            if (result)
            {
                RefreshCache();
                OperateLogServices.AddOperateLog <WX_ApiConfig>(model, OperateType.Update);
            }
            return(result);
        }
コード例 #2
0
        public static bool AddOrUpdate(WX_ApiConfig model)
        {
            if (string.IsNullOrWhiteSpace(model.CompanyID))
            {
                throw new MyException("获取单位编号失败");
            }

            IWXApiConfig factory = WXApiConfigFactory.GetFactory();

            if (factory.QueryByCompanyID(model.CompanyID) == null)
            {
                WX_ApiConfig oldApiConfig = factory.QueryByToKen(model.Token);
                if (oldApiConfig != null)
                {
                    throw new MyException("Token重复");
                }
                bool result = factory.Create(model);
                if (result)
                {
                    RefreshCache();
                    OperateLogServices.AddOperateLog <WX_ApiConfig>(model, OperateType.Add);
                }
                return(result);
            }
            else
            {
                WX_ApiConfig oldApiConfig = factory.QueryByToKen(model.Token);
                if (oldApiConfig != null && oldApiConfig.CompanyID != model.CompanyID)
                {
                    throw new MyException("Token重复");
                }

                bool result = factory.Update(model);
                if (result)
                {
                    RefreshCache();
                    OperateLogServices.AddOperateLog <WX_ApiConfig>(model, OperateType.Update);
                }
                return(result);
            }
        }
コード例 #3
0
        private static void RefreshCache()
        {
            IWXApiConfig factory = WXApiConfigFactory.GetFactory();

            staticConfigs = factory.QueryAll();
        }
コード例 #4
0
        /// <summary>
        /// 获取当前单位的配置信息
        /// </summary>
        /// <param name="companyId"></param>
        /// <returns></returns>
        public static WX_ApiConfig QueryByCompanyId(string companyId)
        {
            IWXApiConfig factory = WXApiConfigFactory.GetFactory();

            return(factory.QueryByCompanyID(companyId));
        }
コード例 #5
0
        static WXApiConfigServices()
        {
            IWXApiConfig factory = WXApiConfigFactory.GetFactory();

            staticConfigs = factory.QueryAll();
        }