Пример #1
0
		public void Save(AniDB_Review obj)
		{
			using (var session = JMMService.SessionFactory.OpenSession())
			{
				// populate the database
				using (var transaction = session.BeginTransaction())
				{
					session.SaveOrUpdate(obj);
					transaction.Commit();
				}
			}
		}
Пример #2
0
		public AniDB_Review GetReviewUDP(int reviewID)
		{
			if (!Login()) return null;

			enHelperActivityType ev = enHelperActivityType.NoSuchReview;
			AniDBCommand_GetReview cmd = null;

			lock (lockAniDBConnections)
			{
				Pause();

				cmd = new AniDBCommand_GetReview();
				cmd.Init(reviewID);
				SetWaitingOnResponse(true);
				ev = cmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
				SetWaitingOnResponse(false);
			}

			AniDB_Review review = null;
			if (ev == enHelperActivityType.GotReview && cmd.ReviewInfo != null)
			{
				AniDB_ReviewRepository repReview = new AniDB_ReviewRepository();
				review = repReview.GetByReviewID(reviewID);
				if (review == null) review = new AniDB_Review();

				review.Populate(cmd.ReviewInfo);
				repReview.Save(review);
			}

			return review;
		}