59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using BeWo.Data.Entities;
|
|
using BS.Shared;
|
|
using DevExpress.XtraPrinting;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.Data.Access
|
|
{
|
|
public class ScriptDAO : AbstractBaseDAO
|
|
{
|
|
private string LoadSQLStatement(string statementName)
|
|
{
|
|
string sqlStatement = string.Empty;
|
|
|
|
string namespacePart = "BeWo.Data.Access.Scripts";
|
|
string resourceName = namespacePart + "." + statementName;
|
|
|
|
using (Stream stm = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
|
|
{
|
|
if (stm != null)
|
|
{
|
|
sqlStatement = new StreamReader(stm).ReadToEnd();
|
|
}
|
|
}
|
|
|
|
return sqlStatement;
|
|
}
|
|
|
|
public decimal? GetGkvSumByDateRange(DateTime? start, DateTime? end)
|
|
{
|
|
var sql = LoadSQLStatement("GetGkvSumByDateRange.sql");
|
|
|
|
var rtn = Session.CreateSQLQuery(sql)
|
|
.SetParameter(0, start ?? DateTime.MinValue)
|
|
.SetParameter(1, end ?? DateTime.MaxValue)
|
|
.UniqueResult<decimal>();
|
|
|
|
return rtn;
|
|
}
|
|
|
|
public IEnumerable<long> GetGkvSumByDateRange2(DateTime? start, DateTime? end)
|
|
{
|
|
var sql = LoadSQLStatement("GetGkvSumByDateRange2.sql");
|
|
|
|
var rtn = Session.CreateSQLQuery(sql)
|
|
.SetParameter(0, start ?? DateTime.MinValue)
|
|
.SetParameter(1, end ?? DateTime.MaxValue)
|
|
.List<long>();
|
|
|
|
return rtn;
|
|
}
|
|
}
|
|
}
|