using AStation.HttpClient;
|
using SqlSugar;
|
|
namespace AStation.DAL
|
{
|
public class SoftSetting : BaseDAL<Entity.SoftSetting>
|
{
|
public override ConnectionConfig ConnectionConfig
|
{
|
get { return ConnectionFactory.BuildConnection(); }
|
}
|
|
/// <summary>
|
/// 通过 SetName 获取
|
/// </summary>
|
public Entity.SoftSetting GetBySetName(string Type, string SetName)
|
{
|
using (ISqlSugarClient db = Connection)
|
{
|
return db.Queryable<Entity.SoftSetting>().Single(x => x.Name == SetName && x.Type == Type);
|
}
|
}
|
|
/// <summary>
|
/// 更新 SetValue
|
/// </summary>
|
public bool UpdateSetValue(string Type, string Name, string SetValue)
|
{
|
using (ISqlSugarClient db = Connection)
|
{
|
var result = db.Updateable<Entity.SoftSetting>()
|
.SetColumns("Value", SetValue)
|
.Where(x => x.Type == Type && x.Name == Name).ExecuteCommandHasChange();
|
|
if (result && AStation.CorpConfig.Instance.RealTimeRemoteService.IsSynMainData)
|
{
|
var dtos = db.Queryable<Entity.SoftSetting>().Where(x => x.Type == Type && x.Name == Name);
|
HttpClientHelper.Build(this.TableName, "Updates@V1.0").Put<bool>(dtos);
|
}
|
return result;
|
}
|
}
|
}
|
}
|