Ejemplo n.º 1
0
 private void EditArticleWithID(string _id)
 {
     try
     {
         int         id       = Convert.ToInt32(_id);
         ArticleFile existArt = Program.currentProject.FindArticleWithID(id);
         // find all additional data for the given announcement id
         Dictionary <string, ArticleFile> nonEngData = Program.currentProject.ReadArticleNonEnglishData(id);
         frmAddArticle existArtDlg = new frmAddArticle(existArt, false, nonEngData);
         existArtDlg.Text = "Edit Article";
         if (existArtDlg.ShowDialog(this) == DialogResult.OK)
         {
             if (existArtDlg.nonEngAdditionalData.Count > 0)
             {
                 Program.currentProject.SaveArticlesNonEnglishData(existArtDlg.nonEngAdditionalData);
             }
             this.ApplyChangesOnHardDrive();
         }
         this.UpdateTreesPresentation();
     }
     catch (Exception exp)
     {
         Program.ShowExceptionData(exp);
     }
 }
Ejemplo n.º 2
0
 private void textBox4_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (textBox4.Text != "")
         {
             foreach (TreeNode node in treeArticle.Nodes[0].Nodes)
             {
                 ArticleFile toSearch = Program.currentProject.FindArticleWithID(Convert.ToInt32(ExtractIDFromNodeLabel(node.Text)));
                 if (toSearch.description.ToLower().Contains(textBox1.Text.ToLower()) ||
                     toSearch.id.ToString().ToLower().Contains(textBox1.Text.ToLower()) ||
                     toSearch.title.ToLower().Contains(textBox1.Text.ToLower()))
                 {
                     treeArticle.Nodes[0].Nodes.Clear();
                     treeArticle.Nodes[0].Nodes.Add(node);
                     return;
                 }
             }
         }
         UpdateTreesPresentation();
         return;
     }
     catch (Exception exp)
     {
         Program.ShowExceptionData(exp);
     }
 }
Ejemplo n.º 3
0
 private void btnAddArticle_Click(object sender, EventArgs e)
 {
     try
     {
         int           id         = Program.currentProject.FindLastArticleID();
         ArticleFile   newArticle = new ArticleFile(id);
         frmAddArticle newArtDlg  = new frmAddArticle(newArticle, true, null);
         newArtDlg.Text = "Add Article";
         if (newArtDlg.ShowDialog(this) == DialogResult.OK)
         {
             //newPlaylist.id = Program.currentProject.FindLastPlaylistID();
             Program.currentProject.AddArticle(newArticle);
             if (newArtDlg.nonEngAdditionalData.Count > 0)
             {
                 Program.currentProject.SaveArticlesNonEnglishData(newArtDlg.nonEngAdditionalData);
             }
             this.ApplyChangesOnHardDrive();
         }
         this.UpdateTreesPresentation();
     }
     catch (Exception exp)
     {
         Program.ShowExceptionData(exp);
     }
 }
Ejemplo n.º 4
0
 internal void CopyTo(ArticleFile _p)
 {
     _p.id          = this.id;
     _p.file        = this.file;
     _p.cover       = this.cover;
     _p.language    = this.language;
     _p.ageCategory = this.ageCategory;
     _p.genre       = this.genre;
     _p.title       = this.title;
     _p.writer      = this.writer;
     _p.description = this.description;
     return;
 }
Ejemplo n.º 5
0
        private ArticleFile FindArticleWithID(int _id)
        {
            ArticleFile retval = null;

            foreach (ArticleFile x in this.library)
            {
                if (x.id == _id)
                {
                    retval = x;
                    break;
                }
            }
            return(retval);
        }
Ejemplo n.º 6
0
 private void additionalLangRecord_EditButton_Click(object sender, LabelEditEventArgs e)
 {
     try
     {
         ArticleFile       temp      = nonEngAdditionalData[e.Label];
         frmAddNewLanguage frmNewDlg = new frmAddNewLanguage(e.Label, temp.title, temp.writer, temp.description);
         if (frmNewDlg.ShowDialog(this) == DialogResult.OK)
         {
             temp.title       = frmNewDlg.InsertedTitle;
             temp.writer      = frmNewDlg.InsertedArtists;
             temp.description = frmNewDlg.InsertedDescription;
         }
         UpdateLangsPanel();
     }
     catch (Exception exp)
     {
         Program.ShowExceptionData(exp);
     }
 }
Ejemplo n.º 7
0
 public frmAddArticle(ArticleFile _artToComplete, bool _isNew, Dictionary <string, ArticleFile> _nonEngData)
 {
     InitializeComponent();
     articleToComplete = _artToComplete;
     if (_nonEngData == null)
     {
         nonEngAdditionalData = new Dictionary <string, ArticleFile>();
     }
     else
     {
         nonEngAdditionalData = _nonEngData;
     }
     isNewArticle = _isNew;
     cmbLanguage.Items.Clear();
     foreach (var item in Enum.GetValues(typeof(Languages)))
     {
         cmbLanguage.Items.Add(item.ToString());
     }
 }
Ejemplo n.º 8
0
 private void btnNewLang_Click(object sender, EventArgs e)
 {
     try
     {
         // fetch which additional langs already filled for current playlist
         string[] existlangs = new string[nonEngAdditionalData.Count];
         int      i          = 0;
         foreach (var item in nonEngAdditionalData)
         {
             existlangs[i++] = item.Key;
         }
         // if all additional langs already filled, no action occurred
         if (existlangs.Length == Enum.GetValues(typeof(Languages)).Length)
         {
             return;
         }
         frmAddNewLanguage newDlg = new frmAddNewLanguage(!EnglishMoreDataExist(), existlangs);
         if (newDlg.ShowDialog(this) == DialogResult.OK)
         {
             ArticleFile p = new ArticleFile(articleToComplete.id);
             p.title       = newDlg.InsertedTitle;
             p.writer      = newDlg.InsertedArtists;
             p.description = newDlg.InsertedDescription;
             if (nonEngAdditionalData.ContainsKey(newDlg.SelectedLanguage))
             {
                 nonEngAdditionalData.Remove(newDlg.SelectedLanguage);
             }
             nonEngAdditionalData.Add(newDlg.SelectedLanguage, p);
         }
         UpdateLangsPanel();
     }
     catch (Exception exp)
     {
         Program.ShowExceptionData(exp);
     }
 }
Ejemplo n.º 9
0
 internal ArticleFile[] GetArticlesCollection()
 {
     ArticleFile[] retVal = new ArticleFile[this.articles.library.Count];
     this.articles.library.CopyTo(retVal);
     return(retVal);
 }
Ejemplo n.º 10
0
 internal void AddArticle(ArticleFile _newArticle)
 {
     this.articles.library.Add(_newArticle);
 }