Ejemplo n.º 1
0
		public void Save(AniDB_MylistStats obj)
		{
			using (var session = JMMService.SessionFactory.OpenSession())
			{
				// populate the database
				using (var transaction = session.BeginTransaction())
				{
					session.SaveOrUpdate(obj);
					transaction.Commit();
				}
			}
		}
Ejemplo n.º 2
0
		public void UpdateMyListStats()
		{
			if (!Login()) return;

			lock (lockAniDBConnections)
			{
				Pause();

				AniDBCommand_GetMyListStats cmdGetMylistStats = new AniDBCommand_GetMyListStats();
				cmdGetMylistStats.Init();
				SetWaitingOnResponse(true);
				enHelperActivityType ev = cmdGetMylistStats.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
				SetWaitingOnResponse(false);
				if (ev == enHelperActivityType.GotMyListStats && cmdGetMylistStats.MyListStats != null)
				{
					AniDB_MylistStatsRepository repStats = new AniDB_MylistStatsRepository();
					AniDB_MylistStats stat = null;
					List<AniDB_MylistStats> allStats = repStats.GetAll();
					if (allStats.Count == 0)
						stat = new AniDB_MylistStats();
					else
						stat = allStats[0];

					stat.Populate(cmdGetMylistStats.MyListStats);
					repStats.Save(stat);
				}
			}
		}