Beispiel #1
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            flowLayoutPanel1.Controls.Clear();
            panel6.BringToFront();
            panel6.Show();
            recommendation1.Hide();
            remove1.Hide();
            update1.Hide();
            search1.Hide();
            add1.Hide();

            movie       mvv = new movie();
            XmlDocument doc = new XmlDocument();

            if (File.Exists("movie.xml"))
            {
                doc.Load("movie.xml");
            }
            else
            {
                return;
            }
            XmlNodeList list = doc.GetElementsByTagName("Movie");

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList children = list[i].ChildNodes;

                mvv.id = children[0].InnerText;

                mvv.title = children[1].InnerText;

                mvv.director = children[2].InnerText;

                mvv.poster = children[3].InnerText;

                mvv.year = children[4].InnerText;

                mvv.genres = children[5].InnerText;

                mvv.rating = children[6].InnerText;

                Show1 sh = new Show1(mvv);
                flowLayoutPanel1.Controls.Add(sh);
            }
            doc.Save("movie.xml");
        }
Beispiel #2
0
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            flowLayoutPanel1.Controls.Clear();


            movie       newmovie = new movie();
            XmlDocument doc      = new XmlDocument();

            doc.Load("movie.xml");
            XmlNodeList list    = doc.GetElementsByTagName("Movie");
            bool        flag    = bunifuiOSSwitch1.Value;
            bool        entered = false;
            int         combo2  = 0;

            if (comboBox2.Text != "")
            {
                combo2 = Int32.Parse(comboBox2.Text);
            }
            for (int rate = 10; rate > 0; rate--)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    XmlNodeList children = list[i].ChildNodes;

                    string id     = children[0].Name;
                    string ivalue = children[0].InnerText;

                    string title  = children[1].Name;
                    string tvalue = children[1].InnerText;

                    string director = children[2].Name;
                    string dvalue   = children[2].InnerText;

                    string poster = children[3].Name;
                    string pvalue = children[3].InnerText;

                    string year   = children[4].Name;
                    string yvalue = children[4].InnerText;

                    string genres = children[5].Name;
                    string gvalue = children[5].InnerText;

                    string rating = children[6].InnerText;
                    int    rvalue = Int32.Parse(children[6].InnerText);
                    if (flag)
                    {
                        if ((tvalue == bunifuMetroTextbox1.Text || bunifuMetroTextbox1.Text == "") &&
                            (yvalue == comboBox1.Text || comboBox1.Text == "") &&
                            (rvalue >= combo2 && rvalue == rate))
                        {
                            newmovie.id       = ivalue;
                            newmovie.title    = tvalue;
                            newmovie.poster   = pvalue;
                            newmovie.director = dvalue;
                            newmovie.genres   = gvalue;
                            newmovie.rating   = rating;
                            newmovie.year     = yvalue;
                            Show1 sh = new Show1(newmovie);
                            flowLayoutPanel1.Controls.Add(sh);
                            entered = true;
                        }
                    }
                    else
                    {
                        if ((tvalue == bunifuMetroTextbox1.Text || bunifuMetroTextbox1.Text == "") &&
                            (yvalue == comboBox1.Text || comboBox1.Text == "") &&
                            (rvalue <= combo2 && rvalue == rate))
                        {
                            newmovie.id       = ivalue;
                            newmovie.title    = tvalue;
                            newmovie.poster   = pvalue;
                            newmovie.director = dvalue;
                            newmovie.genres   = gvalue;
                            newmovie.rating   = rating;
                            newmovie.year     = yvalue;
                            Show1 sh = new Show1(newmovie);
                            flowLayoutPanel1.Controls.Add(sh);
                            entered = true;
                        }
                    }
                }
            }
            if (!entered)
            {
                alert.AlertPob("No Thing Match Your request", alert.AlertType.info);
            }
            doc.Save("movie.xml");
        }
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            //string genre="";
            flowLayoutPanel1.Controls.Clear();
            movie       newmovie = new movie();
            XmlDocument doc      = new XmlDocument();
            bool        entered  = false;

            if (File.Exists("movie.xml"))
            {
                doc.Load("movie.xml");
            }
            else
            {
                return;
            }
            XmlNodeList   list   = doc.GetElementsByTagName("Movie");
            List <string> genres = new List <string>();

            foreach (string item in checkedListBox1.CheckedItems)
            {
                genres.Add(item);
            }
            for (int rate = 10; rate > 0; rate--)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    XmlNodeList children = list[i].ChildNodes;

                    string[] movieGenres = children[5].InnerText.Split(',');
                    string   rating      = children[6].InnerText;
                    int      rvalue      = Int32.Parse(children[6].InnerText);
                    if (rate == rvalue)
                    {
                        int counter = 0;
                        for (int j = 0; j < genres.Count; j++)
                        {
                            for (int k = 0; k < movieGenres.Length; k++)
                            {
                                if (movieGenres[k] == genres[j])
                                {
                                    counter++;
                                }
                            }
                            if (counter >= genres.Count)
                            {
                                newmovie.id       = children[0].InnerText;
                                newmovie.title    = children[1].InnerText;
                                newmovie.director = children[2].InnerText;
                                newmovie.poster   = children[3].InnerText;
                                newmovie.year     = children[4].InnerText;
                                newmovie.genres   = children[5].InnerText;
                                newmovie.rating   = children[6].InnerText;

                                Show1 sh = new Show1(newmovie);

                                flowLayoutPanel1.Controls.Add(sh);
                                entered = true;

                                break;
                            }
                        }
                    }
                }
            }
            if (!entered)
            {
                alert.AlertPob("No Thing Match Your request", alert.AlertType.info);
            }
            doc.Save("movie.xml");
        }