首次提交:添加src文件夹代码

This commit is contained in:
2026-02-27 14:02:43 +08:00
commit d330cfbca7
4184 changed files with 5546478 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unity;
using Cowain.Bake.Model;
using Cowain.Bake.Common.Enums;
using System.Collections.Concurrent;
namespace Cowain.Bake.BLL
{
public class SysSetupService : ServiceBase
{
public ConcurrentDictionary<string, string> ParaDic = new ConcurrentDictionary<string, string>();
public SysSetupService(IUnityContainer unityContainer) : base(unityContainer)
{
GetAllPara();
}
public List<TSysSetup> GetAll()
{
using (var Context = new BakingEntities())
{
return Context.Set<TSysSetup>().OrderBy(item => item.Id).ToList();
}
}
public void GetAllPara()
{
ParaDic.Clear();
using (var Context = new BakingEntities())
{
var list = Context.Set<TSysSetup>().OrderBy(item => item.Id).ToList();
foreach (var item in list)
{
ParaDic.TryAdd(item.ParamCode, item.ParamValue);
}
}
}
public string GetValueByParaID(string paraID)
{
return ParaDic[paraID];
}
public string GetValueByID(long ID)
{
using (var Context = new BakingEntities())
{
var pi = (from ts in Context.Set<TSysSetup>()
where ts.Id == ID
select ts).FirstOrDefault();
return pi.ParamValue;
}
}
public bool UpdateValue(long ID, string value)
{
using (var Context = new BakingEntities())
{
var pi = (from ts in Context.Set<TSysSetup>()
where ts.Id == ID
select ts).FirstOrDefault();
pi.ParamValue = value;
var result = Context.SaveChanges() != 0;
GetAllPara();
return result;
}
}
public bool UpdateValue(string paramCode, string value)
{
using (var Context = new BakingEntities())
{
var pi = (from ts in Context.Set<TSysSetup>()
where ts.ParamCode == paramCode
select ts).FirstOrDefault();
pi.ParamValue = value;
var result = Context.SaveChanges() != 0;
GetAllPara();
return result;
}
}
public List<TSysSetup> GetShowParam()
{
using (var Context = new BakingEntities())
{
return Context.Set<TSysSetup>().Where(x=>x.Type == (int)EParamType.Sys).OrderBy(item => item.Id).ToList();
}
}
}
}