Beispiel #1
0
        private List <Fisier> CreareListaFisiere(Director _Director)
        {
            List <Fisier>          listaFisiere           = new List <Fisier>();
            DelegateExtrageFisiere delegateExtrageFisiere = new DelegateExtrageFisiere(ExtrageNumeFisiere);

            string[] fisiere = delegateExtrageFisiere(_Director.GetLocatieDirector(), "*.mp3|*.avi|*.flv|*.mp4|*.xvid|*.divx", SearchOption.AllDirectories);
            for (int Index = 0; Index < fisiere.Length; Index++)
            {
                FileInfo fileInfo = new FileInfo(fisiere[Index]);
                SchimbaAtributeleFisierelor(fileInfo.FullName);
                Fisier fisier = new Fisier();
                fisier.SetNumeFisier(fileInfo.Name);
                fisier.SetNumeComplet(fileInfo.FullName);
                fisier.SetExtensieFisier(fileInfo.Extension);
                fisier.SetDimensiuneFisier((fileInfo.Length) / 1024);
                List <string> rating = DatabaseHelper.SelectareInregistrare(fisier);
                if (rating.Count > 0)
                {
                    fisier.SetGen(rating[0]);
                    fisier.SetRecenzie(rating[1]);
                    if ((rating[2].ToLower()) == "true")
                    {
                        fisier.SetVizualizat(true);
                    }
                    else
                    {
                        fisier.SetVizualizat(false);
                    }
                }
                else
                {
                    fisier.SetGen("");
                    fisier.SetRecenzie("");
                    fisier.SetVizualizat(false);
                    DatabaseHelper.InserareInregistrare(fisier);
                }
                listaFisiere.Add(fisier);
            }
            return(listaFisiere);
        }
Beispiel #2
0
 private void AdaugaRecenzieButton_click(object sender, EventArgs e)
 {
     if (AdaugaRatingTextBoxGen.Text == "")
     {
         AdaugaRatingErrorProvider.SetError(AdaugaRatingTextBoxGen, "Whitespace Nu Este Permis");
         AdaugaRatingTextBoxGen.Text      = "";
         AdaugaRatingTextBoxRecenzie.Text = "";
     }
     else if (AdaugaRatingTextBoxRecenzie.Text == "")
     {
         AdaugaRatingErrorProvider.Clear();
         AdaugaRatingErrorProvider.SetError(AdaugaRatingTextBoxRecenzie, "Whitespace Nu Este Permis");
         AdaugaRatingTextBoxGen.Text      = "";
         AdaugaRatingTextBoxRecenzie.Text = "";
     }
     else if (AdaugaRatingTextBoxRecenzie.Text.Length > 25)
     {
         AdaugaRatingErrorProvider.Clear();
         AdaugaRatingErrorProvider.SetError(AdaugaRatingTextBoxRecenzie, "Recenzia Max 25 Caractere");
         AdaugaRatingTextBoxRecenzie.Text = "";
         AdaugaRatingTextBoxGen.Text      = "";
     }
     else
     {
         fisier.SetGen(AdaugaRatingTextBoxGen.Text);
         fisier.SetRecenzie(AdaugaRatingTextBoxRecenzie.Text);
         if (AdaugaRatingComboBox.Text == "true")
         {
             fisier.SetVizualizat(true);
         }
         else
         {
             fisier.SetVizualizat(false);
         }
         dataBaseHelper.ActualizareInregistrare(NumeVechiFisier, fisier);
         this.Close();
     }
 }