/// <summary> /// Действие при выборе/снятия выбора с мультсериала /// </summary> public void CheckedValidation() { if (CvDbContext.ChangeTracker.HasChanges()) { CvDbContext.SaveChanges(); } CheckedEpisodes = new List <CartoonEpisode>( CvDbContext.CartoonEpisodes .Include(ce => ce.CartoonVoiceOver) .Include(ce => ce.CartoonSeason) .Include(ce => ce.EpisodeOptions) .Include(ce => ce.Cartoon) .Where(ce => ce.Cartoon.Checked && ce.CartoonSeason.Checked && ce.Checked)); if (CheckedEpisodes.Count > 0) { FilterCheckedEpisodes(); } GeneralSettings.AvailableEpisodesCount = CheckedEpisodes.Count; WriteClassInFile(GeneralSettings, SavedGeneralSettingsFileName, GeneralSettingsFileExtension, AppDataPath); NotifyOfPropertyChange(() => GeneralSettings); NotifyOfPropertyChange(() => CanStart); }
public void VoiceOverCheck() { CvDbContext.ChangeTracker.DetectChanges(); if (CvDbContext.ChangeTracker.HasChanges()) { CvDbContext.SaveChanges(); } }
public void EpisodeCheckValidation() { CvDbContext.ChangeTracker.DetectChanges(); if (CvDbContext.ChangeTracker.HasChanges()) { CvDbContext.SaveChanges(); } }
private void PlayEpisode(CartoonEpisode episode) { var cartUrl = episode.Cartoon.CartoonUrls.First(cu => cu.Checked); var webSite = CvDbContext.CartoonWebSites .Include(cws => cws.ElementValues) .First(cws => cws.CartoonWebSiteId == cartUrl.CartoonWebSiteId); var urlString = $"{cartUrl.Url}{episode.FullNumber}/{episode.CartoonVoiceOver.UrlParameter}"; var elementValue = webSite.ElementValues.First(); CurrentOptionId = episode.EpisodeOptions .First(eo => eo.CartoonEpisodeId == episode.CartoonEpisodeId && eo.CartoonVoiceOverId == episode.CartoonVoiceOver.CartoonVoiceOverId).EpisodeOptionId; //Попытки перейти на указанный url при нестабильном интернет соединении for (var i = 0; i < 10; i++) { try { Helper.Browser.Navigate().GoToUrl(urlString); break; } catch { Helper.Browser.Navigate().Refresh(); } } var option = CvDbContext.EpisodeOptions .Include(eo => eo.Jumpers) .First(eo => eo.EpisodeOptionId == CurrentOptionId); CurrentDuration = option.Duration; option.LastDateViewed = DateTime.Now; CvDbContext.SaveChanges(); Jumpers = new List <Jumper>(option.Jumpers); CurrentJumper = Jumpers[jumperCount++]; WebElement = Helper.Browser.FindElement(By.CssSelector(elementValue.CssSelector)); StartVideoPlayer(); Helper.Timer.Restart(); LaunchMonitoring(); if (GeneralSettings.WatchingInRow) { GeneralSettings.LastWatchedEpisodeInRowFullNumber = episode.FullNumber; WriteClassInFile(GeneralSettings, SavedGeneralSettingsFileName, GeneralSettingsFileExtension, AppDataPath); } }
public void OnException(ExceptionContext filterContext) { var area = "";//todo.... var controller = (filterContext.RouteData.Values["controller"] ?? "").ToString(); var action = (filterContext.RouteData.Values["action"] ?? "").ToString(); //səbəbkar erroru tapmaq while (filterContext.Exception.InnerException != null) { filterContext.Exception = filterContext.Exception.InnerException; } var model = new HandleErrorInfo(filterContext.Exception, controller, action); try { using (var db = new CvDbContext()) { var entity = new ErrorHistory(); if (!string.IsNullOrWhiteSpace(area)) { entity.AreaName = area; } if (!string.IsNullOrWhiteSpace(controller)) { entity.ControllerName = controller; } if (!string.IsNullOrWhiteSpace(action)) { entity.ActionName = action; } if (filterContext.Exception is HttpException) { entity.ErrorCode = (filterContext.Exception as HttpException).GetHttpCode(); } else if (filterContext.Exception is SqlException) { entity.ErrorCode = (filterContext.Exception as SqlException).Number; entity.ErrorMessage = filterContext.Exception.Message; } else { entity.ErrorMessage = filterContext.Exception.Message; } logger.Fatal(entity.ErrorMessage); entity.CreatedDate = DateTime.Now; db.ErrorHistories.Add(entity); db.SaveChanges(); } } catch (Exception) { //logger.Fatal(ex) } filterContext.Result = new ViewResult { ViewName = "~/Views/Home/ErrorPage.cshtml", //MasterName = "~/Views/Shared/_Layout.cshtml", ViewData = new ViewDataDictionary <HandleErrorInfo>(model), TempData = filterContext.Controller.TempData }; filterContext.ExceptionHandled = true; }
public UsersController(CvDbContext context, IOptions <JwtSettings> jwtSettings) { this.context = context; this.jwtSettings = jwtSettings.Value; }