init commit
This commit is contained in:
77
20220330_Vote/Ewide.RoadFlow/Data/AppLibary/AppLibrary.cs
Normal file
77
20220330_Vote/Ewide.RoadFlow/Data/AppLibary/AppLibrary.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
41
20220330_Vote/Ewide.RoadFlow/Data/AppLibary/IApplibrary.cs
Normal file
41
20220330_Vote/Ewide.RoadFlow/Data/AppLibary/IApplibrary.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RoadFlow.Data
|
||||
{
|
||||
public interface IApplibrary : IRoadFlowRepository<RoadFlow.Model.rf_applibrary>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 根据Code得到实体
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public Model.rf_applibrary GetByCode(string code);
|
||||
/// <summary>
|
||||
/// 删除应用
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public int Delete(string id);
|
||||
|
||||
/// <summary>
|
||||
/// 得到对应语言的标题
|
||||
/// </summary>
|
||||
/// <param name="appLibrary"></param>
|
||||
/// <param name="language">语言</param>
|
||||
/// <returns></returns>
|
||||
public string GetLanguageTitle(Model.rf_applibrary appLibrary, string language = "");
|
||||
/// <summary>
|
||||
/// 得到一个类别的应用
|
||||
/// </summary>
|
||||
/// <param name="typeId">类别ID</param>
|
||||
/// <returns></returns>
|
||||
public List<Model.rf_applibrary> GetListByType(string typeId);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user