Example #1
0
        public JsonResult GetWxOtherConfigData(string companyId)
        {
            JsonResult json = new JsonResult();

            try
            {
                List <WX_OtherConfig> configs = WXOtherConfigServices.QueryAll(companyId);
                List <WX_OtherConfig> models  = new List <WX_OtherConfig>();
                foreach (object o in Enum.GetValues(typeof(ConfigType)))
                {
                    ConfigType     type  = (ConfigType)o;
                    WX_OtherConfig model = new WX_OtherConfig();
                    model.ConfigType = type;
                    WX_OtherConfig config = configs.FirstOrDefault(p => p.ConfigType == type);
                    if (config != null)
                    {
                        model.ConfigValue = config.ConfigValue;
                    }
                    model.CompanyID          = companyId;
                    model.Description        = type.GetDescription();
                    model.DefaultDescription = type.GetEnumDefaultValue();
                    models.Add(model);
                }
                json.Data = models;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取微信其他配置信息失败");
            }
            return(json);
        }