예제 #1
0
        /// <summary>
        ///     保存系统配置项信息
        /// </summary>
        /// <param name="doubleWays">系统配置项信息</param>
        /// <returns></returns>
        public async Task <OperateStatus> SaveConfig(IEnumerable <SystemConfigDoubleWay> doubleWays)
        {
            OperateStatus operateStatus = new OperateStatus();

            //更新
            try
            {
                foreach (var config in doubleWays)
                {
                    config.V = DEncryptUtil.HttpUtilityUrlEncode(config.V);
                    //更新对应值
                    var c = await GetByIdAsync(config.C);

                    c.Value = config.V;
                    if (await _configRepository.UpdateAsync(c) > 0)
                    {
                        GlobalParams.Set(c.Code, config.V);
                    }
                }
                operateStatus.Message    = Chs.Successful;
                operateStatus.ResultSign = ResultSign.Successful;
            }
            catch (Exception e)
            {
                LogWriter.WriteLog(FolderName.Exception, e);
            }
            return(operateStatus);
        }