init commit

This commit is contained in:
路 范
2022-03-30 17:54:33 +08:00
parent df01841625
commit 904bdd16cd
500 changed files with 217251 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
using Furion.DependencyInjection;
using RoadFlow.Utility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RoadFlow.Data
{
public class Applibrary:RoadFlowRepository<RoadFlow.Model.rf_applibrary>,IApplibrary, ITransient
{
/// <summary>
/// 根据Code得到实体
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public Model.rf_applibrary GetByCode(string code)
{
List<Model.rf_applibrary> appLibraries = GetAll();
return appLibraries.Find(p => p.Code.EqualsIgnoreCase(code));
}
/// <summary>
/// 删除应用
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public int Delete(string id)
{
var app = GetOneById(id);
return null == app ? 0 : Delete(app);
}
/// <summary>
/// 得到对应语言的标题
/// </summary>
/// <param name="appLibrary"></param>
/// <param name="language">语言</param>
/// <returns></returns>
public string GetLanguageTitle(Model.rf_applibrary appLibrary, string language = "")
{
if (null == appLibrary)
{
return string.Empty;
}
string lang = language.IsNullOrWhiteSpace() ? Tools.GetCurrentLanguage() : language;
switch (lang)
{
case "en-US":
return appLibrary.Title_en;
case "zh":
return appLibrary.Title_zh;
default:
return appLibrary.Title;
}
}
/// <summary>
/// 得到一个类别的应用
/// </summary>
/// <param name="typeId">类别ID</param>
/// <returns></returns>
public List<Model.rf_applibrary> GetListByType(string typeId)
{
List<Model.rf_applibrary> appLibraries = new List<Model.rf_applibrary>();
var all = GetAll();
var typeIds = new Dictionary().GetAllChildsId(typeId);
foreach (var id in typeIds)
{
appLibraries.AddRange(all.FindAll(p => p.Type == id));
}
return appLibraries.OrderBy(p => p.Title).ToList();
}
}
}