本文整理汇总了C#中JMMServer.Repositories.AniDB_AnimeRepository.GetForDate方法的典型用法代码示例。如果您正苦于以下问题:C# AniDB_AnimeRepository.GetForDate方法的具体用法?C# AniDB_AnimeRepository.GetForDate怎么用?C# AniDB_AnimeRepository.GetForDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.AniDB_AnimeRepository
的用法示例。
在下文中一共展示了AniDB_AnimeRepository.GetForDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAnimeForMonth
public List<Contract_AniDBAnime> GetAnimeForMonth(int jmmuserID, int month, int year)
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
JMMUserRepository repUsers = new JMMUserRepository();
// get all the series
List<Contract_AniDBAnime> animeList = new List<Contract_AniDBAnime>();
try
{
JMMUser user = repUsers.GetByID(jmmuserID);
if (user == null) return animeList;
DateTime startDate = new DateTime(year, month, 1, 0, 0, 0);
DateTime endDate = startDate.AddMonths(1);
endDate = endDate.AddMinutes(-10);
List<AniDB_Anime> animes = repAnime.GetForDate(startDate, endDate);
foreach (AniDB_Anime anime in animes)
{
bool useAnime = true;
string[] cats = user.HideCategories.ToLower().Split(',');
string[] animeCats = anime.AllCategories.ToLower().Split('|');
foreach (string cat in cats)
{
if (!string.IsNullOrEmpty(cat) && animeCats.Contains(cat))
{
useAnime = false;
break;
}
}
if (useAnime)
animeList.Add(anime.ToContract());
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return animeList;
}
示例2: GetMiniCalendar
public List<Contract_AniDBAnime> GetMiniCalendar(int jmmuserID, int numberOfDays)
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
JMMUserRepository repUsers = new JMMUserRepository();
// get all the series
List<Contract_AniDBAnime> animeList = new List<Contract_AniDBAnime>();
try
{
JMMUser user = repUsers.GetByID(jmmuserID);
if (user == null) return animeList;
List<AniDB_Anime> animes = repAnime.GetForDate(DateTime.Today.AddDays(0 - numberOfDays), DateTime.Today.AddDays(numberOfDays));
foreach (AniDB_Anime anime in animes)
{
bool useAnime = true;
string[] cats = user.HideCategories.ToLower().Split(',');
string[] animeCats = anime.AllCategories.ToLower().Split('|');
foreach (string cat in cats)
{
if (!string.IsNullOrEmpty(cat) && animeCats.Contains(cat))
{
useAnime = false;
break;
}
}
if (useAnime)
animeList.Add(anime.ToContract());
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return animeList;
}
示例3: GetAnimeCalendar
public List<MetroContract_Anime_Summary> GetAnimeCalendar(int jmmuserID, int startDateSecs, int endDateSecs, int maxRecords)
{
List<MetroContract_Anime_Summary> retAnime = new List<MetroContract_Anime_Summary>();
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
JMMUserRepository repUsers = new JMMUserRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
JMMUser user = repUsers.GetByID(session, jmmuserID);
if (user == null) return retAnime;
DateTime? startDate = Utils.GetAniDBDateAsDate(startDateSecs);
DateTime? endDate = Utils.GetAniDBDateAsDate(endDateSecs);
List<AniDB_Anime> animes = repAnime.GetForDate(session, startDate.Value, endDate.Value);
foreach (AniDB_Anime anidb_anime in animes)
{
if (!user.AllowedAnime(anidb_anime)) continue;
AnimeSeries ser = repSeries.GetByAnimeID(anidb_anime.AnimeID);
MetroContract_Anime_Summary summ = new MetroContract_Anime_Summary();
summ.AirDateAsSeconds = anidb_anime.AirDateAsSeconds;
summ.AnimeID = anidb_anime.AnimeID;
if (ser != null)
{
summ.AnimeName = ser.GetSeriesName(session);
summ.AnimeSeriesID = ser.AnimeSeriesID;
}
else
{
summ.AnimeName = anidb_anime.MainTitle;
summ.AnimeSeriesID = 0;
}
summ.BeginYear = anidb_anime.BeginYear;
summ.EndYear = anidb_anime.EndYear;
summ.PosterName = anidb_anime.GetDefaultPosterPathNoBlanks(session);
ImageDetails imgDet = anidb_anime.GetDefaultPosterDetailsNoBlanks(session);
summ.ImageType = (int)imgDet.ImageType;
summ.ImageID = imgDet.ImageID;
retAnime.Add(summ);
if (retAnime.Count == maxRecords) break;
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return retAnime;
}