Пример #1
0
        public Bet(long battleId, long teamId, long userId, string title, double amount, double coefficient, string url, bool isPrivate) : this()
        {
            BattleId = battleId;
            TeamId = teamId;
            UserId = userId;
            Title = title;
            Amount = amount;
            Coefficient = coefficient;
            Url = url;
            OpenDateTime = DateTime.UtcNow;
            IsPrivate = isPrivate;
            StatusEnum = BetStatus.NotFinished;

            OpenBetScreenshot = new BetScreenshot();
        }
Пример #2
0
 private DateAndScreenshotViewModel GetDateAndScreenshot(BetScreenshot betScreenshot, bool screenshotIsVisible)
 {
     var dateAndScreenshot = new DateAndScreenshotViewModel
                                 {
                                     DateTime = betScreenshot.CreationDateTime.ToShortDateLongTimeString(),
                                     ScreenshotIsVisible = screenshotIsVisible
                                 };
     if (screenshotIsVisible)
     {
         dateAndScreenshot.ScreenshotStatusClass = GetBetScreenshotStatusClass(betScreenshot.StatusEnum);
         dateAndScreenshot.ScreenshotStatusString = GetBetScreenshotStatusString(betScreenshot.StatusEnum);
         if (betScreenshot.StatusEnum == BetScreenshotStatus.Succeeded)
             dateAndScreenshot.ScreenshotUrl = _betScreenshotPathService.GetUrl(betScreenshot.FileName);
     }
     
     return dateAndScreenshot;
 }
Пример #3
0
        private Stream GetScreenshot(string battleBetUrl, BetScreenshot betScreenshot, SynchronizationContext synchronizationContext, out ImageFormat imageFormat)
        {
            betScreenshot.StartedScreenshotRetrievalDateTime = DateTime.UtcNow;

            var screenShotMaker = _screenshotMakerFactory.Create();
            var screenshotEncodedStream = screenShotMaker.GetScreenshotEncodedStream(battleBetUrl, synchronizationContext, out imageFormat);

            betScreenshot.FinishedScreenshotRetrievalDateTime = DateTime.UtcNow;

            return screenshotEncodedStream;
        }
Пример #4
0
        private void PutScreenshot(Amazon.S3.AmazonS3 amazonS3Client, Stream screenshotJpegStream, BetScreenshot betScreenshot, ImageFormat imageFormat)
        {
            betScreenshot.StartedScreenshotSavingDateTime = DateTime.UtcNow;

            var path = _betScreenshotPathService.GetPath(betScreenshot.Id, imageFormat);
            _screenshotAmazonS3Putter.PutScreenshot(amazonS3Client, AppSettings.AmazonBucketName, path, screenshotJpegStream);

            betScreenshot.FinishedScreenshotSavingDateTime = DateTime.UtcNow;

            betScreenshot.FileName = _betScreenshotPathService.GetFileName(betScreenshot.Id, imageFormat);
        }