Esempio n. 1
0
 private void Update()
 {
     countChecked = 0;
     for (int i = films.Length - 1; i > -1; i--)
     {
         Film film = films.GetFilm(i);
         title = films.GetFilmDisplayedName(i);
         UpdateStatus();
         if (film.code == "")
         {
             continue;
         }
         DateTime dtPremiere = Convert.ToDateTime(films.GetFilmReleaseDate(i));
         DateTime dtNow      = DateTime.Now;
         DateTime dtCheck    = Convert.ToDateTime(film.dataCheck);
         TimeSpan ts1        = dtNow - dtPremiere;
         TimeSpan ts2        = dtNow - dtCheck;
         if (ts1.TotalDays / 10.0 > ts2.TotalDays)
         {
             continue;
         }
         countChecked++;
         FilmInfo filmInfo;
         try
         {
             filmInfo = ParsingService.GetFilmInfo(film.code);
         }
         catch
         {
             continue;
         }
         if (filmInfo.originalTitle != film.originalTitle ||
             filmInfo.year != film.year ||
             filmInfo.country != film.country ||
             filmInfo.director != film.director ||
             filmInfo.genre != film.genre ||
             filmInfo.actors != film.actors ||
             filmInfo.worldPremiere != film.worldDate ||
             filmInfo.russianPremiere != film.russianDate ||
             filmInfo.discPremiere != film.discDate)
         {
             LogUnit logUnit = new LogUnit
             {
                 filmInfo = filmInfo,
                 film     = film
             };
             log.Add(logUnit);
         }
         else
         {
             film.dataCheck = DateTime.Now.ToString();
             films.Edit(film, i);
         }
     }
     title = "";
     UpdateStatus();
 }
Esempio n. 2
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            if (lbInfo.SelectedIndex == -1)
            {
                return;
            }
            LogUnit logUnit = (LogUnit)updateService.GetLog()[lbInfo.SelectedIndex];
            Film    film    = logUnit.film;
            int     index   = films.GetFilmIndex(film);

            if (index == -1)
            {
                MessageBox.Show(@"Данный фильм не найден в базе!");
                return;
            }
            film.russianTitle  = tbRusTitle.Text;
            film.originalTitle = tbOrigTitle.Text;
            film.year          = tbY.Text;
            film.country       = tbC.Text;
            film.genre         = tbG.Text;
            film.director      = tbD.Text;
            film.actors        = rtbA.Text;
            film.worldDate     = tbWDate.Text;
            film.russianDate   = tbRDate.Text;
            film.discDate      = tbDDate.Text;
            film.dataCheck     = DateTime.Now.ToString();
            films.Edit(film, index);
            updateService.GetLog().RemoveAt(lbInfo.SelectedIndex);
            frMain.UpdateEvent();
            frMain.FilmUpdateEvent(index);
            lbInfo.Items.RemoveAt(lbInfo.SelectedIndex);
            tbRussianTitle.Clear();
            tbOriginalTitle.Clear();
            tbYear.Clear();
            tbCountry.Clear();
            tbGenre.Clear();
            tbDirector.Clear();
            rtbActors.Clear();
            tbWorldDate.Clear();
            tbRussianDate.Clear();
            tbDiscDate.Clear();
            tbRusTitle.Clear();
            tbOrigTitle.Clear();
            tbY.Clear();
            tbC.Clear();
            tbG.Clear();
            tbD.Clear();
            rtbA.Clear();
            tbWDate.Clear();
            tbRDate.Clear();
            tbDDate.Clear();
        }