Files
BeWoPlaner/Service/Plugins/QueryService.cs

51 lines
1.6 KiB
C#

using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Access;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
namespace BeWo.Service.Plugins
{
public class QueryService : AbstractIDSpecificDefaultClass<QueryService>
{
public virtual List<QueryDC> GetAllQueriesOfType(QueryType pType)
{
return DAOFactory.SearchDAO.FindQuery(pType).Select(
q =>
{
QueryDC queryDC = new QueryDC
{
Oid = q.Oid.Value,
Title = q.Title,
ReportTypeName = q.ReportTypeName,
UserGroupOids = q.UserGroupOids,
Notice = q.Notice,
ExportTitle = q.ExportTitle,
FileName = q.FileName
};
queryDC.IsDirect = queryDC.Notice == "direct";
queryDC.IsImport = queryDC.Notice == "import";
List<QueryParamDC> parameter = new List<QueryParamDC>();
foreach (var item in q.Parameter)
{
QueryParamDC param = new QueryParamDC();
param.ParamType = item.Type;
param.Name = item.Name;
if (item.Type == QueryParameterType.Custom)
{
param.CustomValues = new List<string>();
}
parameter.Add(param);
}
queryDC.Parameter = parameter;
return queryDC;
}).ToList();
}
}
}