Beispiel #1
0
        private void bunifuImageButton1_Click(object sender, EventArgs e)
        {
            main       mainn = new main();
            Search     s     = new Search();
            movieClass m     = new movieClass();

            m.deleteMovie(movieName.Text, "E:\\MovieGuide\\MovieGuide\\bin\\Debug\\Allmovies.xml");

            XmlDocument filedoc = new XmlDocument();

            filedoc.Load("E:\\MovieGuide\\MovieGuide\\bin\\Debug\\Files.xml");
            foreach (XmlNode node in filedoc.SelectNodes("Files/File"))
            {
                XmlDocument file = new XmlDocument();
                file.Load(node.SelectSingleNode("path").InnerText);
                foreach (XmlNode filenode in file.SelectNodes("Movies/Movie"))
                {
                    if (movieName.Text == filenode.SelectSingleNode("Title").InnerText)
                    {
                        m.deleteMovie(movieName.Text, node.SelectSingleNode("path").InnerText);
                        this.Hide();
                        MessageBox.Show("movie deleted successfully");
                    }
                }
            }
        }
        public Search()
        {
            InitializeComponent();
            movieClass m = new movieClass();

            m.viewAllMovieinSearch(flowLayoutPanel1);
        }
Beispiel #3
0
        private void bunifuFlatButton2_Click_1(object sender, EventArgs e)
        {
            string geners   = "";
            string filename = comboBox3.SelectedItem + ".xml";

            movieClass mm = new movieClass();

            mm.deleteMovie(bunifuMaterialTextbox2.Text, "E:\\MovieGuide\\MovieGuide\\bin\\Debug\\Allmovies.xml");

            XmlDocument filedoc = new XmlDocument();

            filedoc.Load("E:\\MovieGuide\\MovieGuide\\bin\\Debug\\Files.xml");
            foreach (XmlNode node in filedoc.SelectNodes("Files/File"))
            {
                XmlDocument file = new XmlDocument();
                file.Load(node.SelectSingleNode("path").InnerText);
                foreach (XmlNode filenode in file.SelectNodes("Movies/Movie"))
                {
                    if (bunifuMaterialTextbox2.Text == filenode.SelectSingleNode("Title").InnerText)
                    {
                        mm.deleteMovie(bunifuMaterialTextbox2.Text, node.SelectSingleNode("path").InnerText);
                    }
                }
            }

            if (File.Exists(filename))
            {
                if (load_newM(bunifuMaterialTextbox2.Text, filename))
                {
                    XmlDocument doc   = new XmlDocument();
                    XmlElement  movie = doc.CreateElement("Movie");

                    XmlElement node = doc.CreateElement("Id");
                    node.InnerText = bunifuMaterialTextbox3.Text;
                    movie.AppendChild(node);

                    node           = doc.CreateElement("Title");
                    node.InnerText = bunifuMaterialTextbox2.Text;
                    movie.AppendChild(node);

                    node           = doc.CreateElement("Director");
                    node.InnerText = bunifuMaterialTextbox1.Text;
                    movie.AppendChild(node);

                    node           = doc.CreateElement("Year");
                    node.InnerText = comboBox1.SelectedItem.ToString();
                    movie.AppendChild(node);
                    node = doc.CreateElement("Genres");
                    for (int i = 0; i < checkedListBox1.Items.Count; i++)
                    {
                        if (checkedListBox1.GetItemChecked(i))
                        {
                            geners += (string)checkedListBox1.Items[i] + ",";
                        }
                    }
                    node.InnerText = geners;
                    movie.AppendChild(node);


                    node           = doc.CreateElement("Rate");
                    node.InnerText = comboBox2.SelectedItem.ToString();
                    movie.AppendChild(node);

                    node           = doc.CreateElement("Poster");
                    node.InnerText = photo;
                    movie.AppendChild(node);


                    doc.Load(comboBox3.SelectedItem + ".xml");
                    XmlElement root = doc.DocumentElement;
                    root.AppendChild(movie);

                    doc.Save(comboBox3.SelectedItem + ".xml");
                    MessageBox.Show("Movie is added successfully");

                    load_directors(bunifuMaterialTextbox1.Text);
                    load_directors_movies(bunifuMaterialTextbox1.Text, bunifuMaterialTextbox2.Text);
                    load_directors_rate(bunifuMaterialTextbox1.Text, comboBox2.SelectedItem.ToString());
                    doc.Load("Allmovies.xml");
                    XmlElement root2 = doc.DocumentElement;
                    root2.AppendChild(movie);
                    doc.Save("Allmovies.xml");
                }
                else
                {
                    MessageBox.Show("the movie already exists you can update it");
                    Update_files();
                }
            }
            else
            {
                MessageBox.Show("this file do not exist");
            }
        }
 public void updateMovie(movieClass movie, string path)
 {
 }
 public void addMovie(movieClass movie, string path)
 {
 }