34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Kreta.Core.ConnectionType;
|
|
using Kreta.DataAccessManual;
|
|
|
|
namespace Kreta.BusinessLogic.Helpers
|
|
{
|
|
public class ElearningElerhetosegHelper : LogicBase
|
|
{
|
|
public ElearningElerhetosegHelper(IConnectionType connectionType) : base(connectionType) { }
|
|
|
|
public IEnumerable<string> GetElearningElerhetosegList(bool isGondviselo, bool isTanulo, int role, List<string> packages, int? gondviseloId)
|
|
{
|
|
var ds = Dal.CustomConnection.Run(ConnectionType, h => h.ElearningElerhetosegDal().GetElearningElerhetosegDataSet(role, packages, TanevId, IntezmenyId, isGondviselo, isTanulo, FelhasznaloId, gondviseloId));
|
|
|
|
var courseIdList = new List<string>();
|
|
var now = DateTime.Now;
|
|
foreach (var course in ds.Tables[0].AsEnumerable())
|
|
{
|
|
var availabilityStartDate = course.Field<DateTime?>("elerhetosegKezdete");
|
|
var availabilityEndDate = course.Field<DateTime?>("elerhetosegVege") ?? now.AddYears(1);
|
|
|
|
if (availabilityStartDate <= now.Date && availabilityEndDate >= now.Date)
|
|
{
|
|
courseIdList.Add(course.Field<string>("azonosito"));
|
|
}
|
|
}
|
|
|
|
return courseIdList.Distinct();
|
|
}
|
|
}
|
|
}
|