コード例 #1
0
        public void getFinancials(int manager_id, int type, Bunifu.Framework.UI.BunifuCustomDataGrid grid)
        {
            try
            {
                com.CommandText = "exec getFinancialsOfmanager @manager_id,@financialtype";
                com.Parameters.Clear();
                com.Parameters.Add("@manager_id", SqlDbType.Int, 4).Value    = manager_id;
                com.Parameters.Add("@financialtype", SqlDbType.Int, 4).Value = type;

                com.Connection.Open();
                SqlDataReader reader = com.ExecuteReader();

                var dataTable = new DataTable();

                dataTable.Load(reader);

                dataView = new DataView(dataTable);

                grid.DataSource = dataView;
            }
            finally
            {
                com.Connection.Close();
            }
        }
コード例 #2
0
        void load_tab(String Query, Bunifu.Framework.UI.BunifuCustomDataGrid grid)//Load table method
        {
            try
            {
                //  string constring = "Sslmode=none;datasource=localhost;port=3306;username=root;password=  "******"select * from supermarket.vendor;";

                MySqlConnection MyConn2    = new MySqlConnection(constring);
                MySqlCommand    MyCommand2 = new MySqlCommand(Query, MyConn2);

                //For offline connection we weill use  MySqlDataAdapter class.
                MySqlDataAdapter MyAdapter = new MySqlDataAdapter();
                MyAdapter.SelectCommand = MyCommand2;
                DataTable dTable = new DataTable();
                MyAdapter.Fill(dTable);
                //bunifuCustomDataGrid1.DataSource = dTable;

                grid.DataSource = dTable;  // here i have assign dTable object to the dataGridView1 object to display data.
                // MyConn2.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
ファイル: Teacher_View.cs プロジェクト: Shamran-Gouse/Legend
        public Teacher_View()
        {
            InitializeComponent();

            grid = DataGrid_Teacher;
            Search();
        }
コード例 #4
0
 private void AutoSizeRows(Bunifu.Framework.UI.BunifuCustomDataGrid grid)
 {
     try
     {
         for (int i = 0; i < grid.Columns.Count; i++)
         {
             this.Invoke((MethodInvoker) delegate {
                 if (i == 0)
                 {
                     grid.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                 }
                 else
                 {
                     grid.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                 }
             });
         }
         this.Invoke((MethodInvoker) delegate
         {
             grid.Sort(grid.Columns[grid.Columns.Count - 1], ListSortDirection.Descending);
         });
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception: " + e.Message + "\nStacktrace: " + e.StackTrace);
     }
 }
コード例 #5
0
ファイル: Student_View.cs プロジェクト: Shamran-Gouse/Legend
        public Student_View()
        {
            InitializeComponent();

            grid = DataGrid_Student;
            Search();
        }
        private void frmExamMark_Load(object sender, EventArgs e)
        {
            var bunifuDataGrid = new Bunifu.Framework.UI.BunifuCustomDataGrid();

            this.Controls.Add(bunifuDataGrid);
            // rand();
        }
コード例 #7
0
        private void StudentDataTable_Load(object sender, EventArgs e)
        {
            // TODO: cette ligne de code charge les données dans la table 'schoolDatabaseDataSet.Student'. Vous pouvez la déplacer ou la supprimer selon les besoins.
            this.studentTableAdapter.Fill(this.schoolDatabaseDataSet.Student);
            var bunifuDataGrid = new Bunifu.Framework.UI.BunifuCustomDataGrid();

            this.Controls.Add(bunifuDataGrid);
        }
コード例 #8
0
        private void frmExamResult_Load(object sender, EventArgs e)
        {
            var bunifuDataGrid = new Bunifu.Framework.UI.BunifuCustomDataGrid();

            this.Controls.Add(bunifuDataGrid);
            cbxForm.Items.Add("1");
            cbxForm.Items.Add("2");
            cbxForm.Items.Add("3");
            cbxForm.Items.Add("4");
        }
コード例 #9
0
 static public void DataGridDoldur1(string query, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid)
 {
     using (SqlConnection connection = new SqlConnection(connectionString))
     {
         var dataAdapter  = new SqlDataAdapter(query, connection);
         var commandBuild = new SqlCommandBuilder(dataAdapter);
         var ds           = new DataSet();
         dataAdapter.Fill(ds);
         dataGrid.ReadOnly   = true;
         dataGrid.DataSource = ds.Tables[0];
     }
 }
コード例 #10
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //add new

            dgv = new Bunifu.Framework.UI.BunifuCustomDataGrid();
            CRUDfunkcije crud = new CRUDfunkcije();

            crud.UserMail(UserMail, UserID);
            crud.Insert(myProperty);
            PopulateGrid();
            //PopulateGrid(myProperty);
        }
        private void frmViewStudents_Load(object sender, EventArgs e)
        {
            var bunifuDataGrid = new Bunifu.Framework.UI.BunifuCustomDataGrid();

            this.Controls.Add(bunifuDataGrid);
            cbxForm12.Items.Add("1");
            cbxForm12.Items.Add("2");
            cbxForm12.Items.Add("3");
            cbxForm12.Items.Add("4");
            cbxGender12.Items.Add("Male");
            cbxGender12.Items.Add("Female");
        }
コード例 #12
0
        private static void dumpIntodb(Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, Anime anime)
        {
            MySqlConnection con     = new MySqlConnection("server=127.0.0.1;uid=root;pwd=;database=anime_db");
            string          idAnime = "";

            try
            {
                //---- dump anime info

                con.Open();
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = $"INSERT INTO animes (Uniq,Title,Type,Status,Aired,Summary,Image) values ('{anime.Unique.Trim()}','{anime.Title.Trim()}','{anime.Type.Trim()}','{anime.Status.Trim()}','{anime.Aired.Trim()}','{anime.Summary.Trim().Replace(@"'",@"\'")}','{anime.Image}')";
                cmd.ExecuteNonQuery();

                //--------- get Anime Id_anime
                cmd.CommandText = "SELECT id_anime FROM animes ORDER BY id_anime DESC LIMIT 1";
                idAnime         = cmd.ExecuteScalar().ToString();
                //--------- dump anime genres
                foreach (string item in anime.Genres)
                {
                    cmd.CommandText = $"select id_genre from genres where genre_desc = '{item}'";
                    string idGenre = cmd.ExecuteScalar().ToString();
                    //Console.WriteLine(cmd.CommandText);
                    cmd.CommandText = $"INSERT INTO anime_genre (id_anime,id_genre) values({idAnime},{idGenre})";
                    cmd.ExecuteNonQuery();
                }
                //------- dump animes episodes
                foreach (KeyValuePair <string, List <string> > item in anime.Streams)
                {
                    cmd.CommandText = $"INSERT INTO episodes (id_anime,ep_number,streams) values ({idAnime},{item.Key},'{string.Join(",", item.Value)}')";
                    cmd.ExecuteNonQuery();
                }

                dataGrid.Invoke(new Action(() => dataGrid.Rows.Add(anime.Title, anime.Type, anime.Aired, anime.Status)));
            }
            catch (MySqlException e) {
                Console.WriteLine(e.Message);
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = $"DELETE FROM animes WHERE id_anime = {idAnime}";
                cmd.ExecuteNonQuery();
                cmd.CommandText = $"DELETE FROM anime_genre WHERE id_anime = {idAnime}";
                cmd.ExecuteNonQuery();
                cmd.CommandText = $"DELETE FROM episodes WHERE id_anime = {idAnime}";
                cmd.ExecuteNonQuery();
            }
            finally
            {
                con.Close();
            }
        }
コード例 #13
0
        void first_order(List <Swimmer> swimmers, Bunifu.Framework.UI.BunifuCustomDataGrid CustomDataGridView)
        {
            DataTable second = new DataTable();

            second.Columns.Add("Full Name");
            second.Columns.Add("Age");
            second.Columns.Add("Sex");
            second.Columns.Add("Time");

            foreach (Swimmer a in swimmers)
            {
                rendering2(a, second, CustomDataGridView);
            }
        }
コード例 #14
0
        public void readAllmembers(int gym_id, Bunifu.Framework.UI.BunifuCustomDataGrid grid)
        {
            allmembersgrid = grid;
            try
            {
                com.CommandText = "exec readAllMembers @gym_id";
                com.Parameters.Clear();
                com.Parameters.Add("@gym_id", SqlDbType.NVarChar, 50).Value = gym_id;

                com.Connection.Open();
                SqlDataReader reader = com.ExecuteReader();

                var dataTable = new DataTable();

                dataTable.Load(reader);
                dataTable.Columns.Add("monghazi", typeof(string));
                dataView = new DataView(dataTable);

                grid.DataSource          = dataView;
                grid.Columns[11].Visible = false;
                grid.Columns[10].Visible = false;
                grid.Columns[7].Visible  = false;

                grid.Columns[0].HeaderText = "name";
                grid.Columns[1].HeaderText = "family";
                grid.Columns[2].HeaderText = "gender";
                grid.Columns[3].HeaderText = "DOB";
                grid.Columns[4].HeaderText = "melli code";
                grid.Columns[5].HeaderText = "address";
                grid.Columns[6].HeaderText = "telephone";


                line_member.Width = l1[0].Width;
                line_member.Left  = l1[0].Left;

                for (int i = 0; i < grid.RowCount - 1; i++)
                {
                    System.TimeSpan diffResult = (DateTime)grid.Rows[i].Cells[8].Value - (DateTime)DateTime.Now;

                    String s = diffResult.Days > 0?"valid":"invalid";

                    grid.Rows[i].Cells[12].Value = s;
                }
            }
            finally
            {
                com.Connection.Close();
            }
        }
        private void frmFeeBill_Load(object sender, EventArgs e)
        {
            // Forms
            cbxForm.Items.Add("1");
            cbxForm.Items.Add("2");
            cbxForm.Items.Add("3");
            cbxForm.Items.Add("4");
            // Current Term
            cbxTerm.Items.Add("1");
            cbxTerm.Items.Add("2");
            cbxTerm.Items.Add("3");
            // Billing Groups
            cbxBillGroup.Items.Add("Boarding");
            cbxBillGroup.Items.Add("Day");
            var bunifuDataGrid = new Bunifu.Framework.UI.BunifuCustomDataGrid();

            this.Controls.Add(bunifuDataGrid);
        }
コード例 #16
0
        //Search function
        public void searchVendor(String valueTosearch, String query, Bunifu.Framework.UI.BunifuCustomDataGrid tablee)
        {
            try
            {
                MySqlConnection MyConn2    = new MySqlConnection(constring);
                MySqlCommand    MyCommand2 = new MySqlCommand(query, MyConn2);

                //For offline connection we weill use  MySqlDataAdapter class.
                MySqlDataAdapter MyAdapter = new MySqlDataAdapter();
                MyAdapter.SelectCommand = MyCommand2;
                DataTable dTable = new DataTable();
                MyAdapter.Fill(dTable);
                //bunifuCustomDataGrid1.DataSource = dTable;
                tablee.DataSource = dTable;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #17
0
        //Ucitavanje zadate Property klase iz foldera IspisDGV
        private void PopuniDGV(DataTable dt, PropertyInterface property)
        {
            //Ciscenje panela za refresh
            panelPanelZaGV.Controls.Clear();

            //Restart DGV-a
            dgv = new Bunifu.Framework.UI.BunifuCustomDataGrid();

            //pozadina hedera
            panelPanelZaGV.Controls.Add(dgv);

            //Popunjavanje tabele sa vrijednostima
            dgv.DataSource = dt;

            //Poziv metode za dizajniranje DGV-a
            DGVDizajn();

            //izvuci display name
            var type       = property.GetType();
            var properties = type.GetProperties();

            //promijeniti nazive kolona
            if (property.GetType() != typeof(VoziloIspis))
            {
                foreach (DataGridViewColumn item in dgv.Columns)
                {
                    item.HeaderText = properties.Where(x => x.GetCustomAttributes <SqlNameAttribute>().FirstOrDefault().Name == item.HeaderText
                                                       ).FirstOrDefault().GetCustomAttributes <DisplayNameAttribute>().FirstOrDefault().DisplayName;
                }
            }

            //sakrij ID
            if (property.GetType() == typeof(VoziloIspis) ||
                property.GetType() == typeof(PropertyKlijent))
            {
                dgv.Columns[0].Visible = false;
            }
        }
コード例 #18
0
        private void PDFBtn_Click(object sender, EventArgs e)
        {
            Bunifu.UI.WinForms.BunifuButton.BunifuButton btn           = (Bunifu.UI.WinForms.BunifuButton.BunifuButton)sender;
            Bunifu.Framework.UI.BunifuCustomDataGrid     PDF_dataTable = this.Controls.Find($"{btn.Name.Split('_')[1]}", true).FirstOrDefault() as Bunifu.Framework.UI.BunifuCustomDataGrid;

            if (PDFSaveDialog.ShowDialog() == DialogResult.OK)
            {
                //create a pdf document
                PdfDocument pdf = new PdfDocument();
                //add a page
                PdfPageBase page = pdf.Pages.Add();

                //create a table
                PdfTable table = new PdfTable();

                //export datagridview to table
                table.DataSource = PDF_dataTable.DataSource;

                //show header
                table.Style.ShowHeader = true;

                //set cell padding
                table.Style.CellPadding = 2;

                //set table layout
                PdfTableLayoutFormat tableLayout = new PdfTableLayoutFormat();
                tableLayout.Break     = PdfLayoutBreakType.FitElement;
                tableLayout.Layout    = PdfLayoutType.Paginate;
                table.BeginRowLayout += new BeginRowLayoutEventHandler(table_BeginRowLayout);

                //draw table to pdf page
                table.Draw(page, new RectangleF(10, 50, 500, 500), tableLayout);

                pdf.SaveToFile(PDFSaveDialog.FileName);
            }
        }
コード例 #19
0
        public void rendering2(Swimmer s, DataTable second, Bunifu.Framework.UI.BunifuCustomDataGrid CustomdataGridView)
        {
            second.Clear();

            DataRow row2 = second.NewRow();

            row2["Full Name"] = s.fullName;
            row2["Age"]       = s.age;
            row2["Sex"]       = s.sex;
            row2["Time"]      = s.time;

            second.Rows.Add(row2);



            foreach (DataRow Drow in second.Rows)
            {
                int num = CustomdataGridView.Rows.Add();
                CustomdataGridView.Rows[num].Cells[0].Value = Drow["Full Name"].ToString();
                CustomdataGridView.Rows[num].Cells[1].Value = Drow["Age"].ToString();
                CustomdataGridView.Rows[num].Cells[2].Value = Drow["Sex"].ToString();
                CustomdataGridView.Rows[num].Cells[3].Value = Drow["Time"].ToString();
            }
        }
コード例 #20
0
 private void HomeControl_Load(object sender, EventArgs e)
 {
     var dataGrid = new Bunifu.Framework.UI.BunifuCustomDataGrid();
 }
コード例 #21
0
        public static async Task ByChannelDescription(Int64 Min, Int64 Max, Bunifu.Framework.UI.BunifuCustomDataGrid Grid, String Keyword, Bunifu.Framework.UI.BunifuCustomLabel Total)
        {
            Console.WriteLine(Form1.browser.IsBrowserInitialized);
            Console.WriteLine("Access");
            Int64  total     = 0;
            String PageToken = "";

            try
            {
                var youtubeService = new YouTubeService(new BaseClientService.Initializer()
                {
                    ApiKey          = "AIzaSyC3E-CwcboQuhV5qhAukGdYnFlONzmkJJw",
                    ApplicationName = "_Youtube"
                });
                var searchListRequest = youtubeService.Search.List("snippet");
                searchListRequest.Q          = Keyword; // Replace with your search term.
                searchListRequest.MaxResults = 50;
                searchListRequest.Order      = SearchResource.ListRequest.OrderEnum.ViewCount;

                Boolean exist = false;


                while (PageToken != "null")
                {
                    searchListRequest.PageToken = PageToken;
                    var searchListResponse = await searchListRequest.ExecuteAsync();

                    foreach (var searchResult in searchListResponse.Items)
                    {
                        if (!Form1.isSearching)
                        {
                            return;
                        }
                        //---------getting channel description---------------
                        var searchDescription = youtubeService.Channels.List("snippet");
                        searchDescription.Id = searchResult.Snippet.ChannelId;
                        var searchDEscResponse = await searchDescription.ExecuteAsync();

                        foreach (string k in Keyword.Split(' '))
                        {
                            if (searchDEscResponse.Items[0].Snippet.Description.Contains(k))
                            {
                                exist = true; break;
                            }
                        }
                        if (!exist)
                        {
                            continue;
                        }
                        exist = false;
                        //---------getting channel description--------------

                        using (var Webclient = new HttpClient())
                        {
                            Uri    tempUrl     = new Uri($"https://www.googleapis.com/youtube/v3/channels?part=statistics&id={searchResult.Snippet.ChannelId}&key=AIzaSyC3E-CwcboQuhV5qhAukGdYnFlONzmkJJw");
                            String Subscribers = await Webclient.GetStringAsync(tempUrl);

                            if (Subscribers.Split('\n')[16].Contains("true"))
                            {
                                continue;
                            }


                            if (Form1.isSub)
                            {
                                if (Int64.Parse(Subscribers.Split('\n')[15].Split(':')[1].Substring(1).Split('"')[1]) > Max || Int64.Parse(Subscribers.Split('\n')[15].Split(':')[1].Substring(1).Split('"')[1]) < Min)
                                {
                                    continue;
                                }
                            }

                            //-------------------Fetching Email-------------------
                            Console.WriteLine("Fetching");
                            Form1.browser.Load($"www.youtube.com/channel/{searchResult.Snippet.ChannelId}/about");
                            // Form1.browser.LoadingStateChanged += getEmail;

                            await _PageLoad(60);

                            Console.WriteLine($"Skiped PageLoad");
                            //-------------------Fetching Email-------------------

                            if (_email == "")
                            {
                                continue;
                            }

                            String[] tempX = { searchResult.Snippet.ChannelTitle, Subscribers.Split('\n')[15].Split(':')[1].Substring(1).Split('"')[1], "https://www.youtube.com/channel/" + searchResult.Snippet.ChannelId + "/about", _email };
                            Grid.Rows.Add(tempX);
                            total++;
                            Total.Text = total.ToString();
                            _email     = "";
                        }
                    }
                    PageToken = searchListResponse.NextPageToken;
                }
            }
            catch (Exception z)
            {
                // MessageBox.Show(z.Message);
            }
            Form1.isSearching = false;
        }
コード例 #22
0
 public static void dumpMovie_db(Bunifu.Framework.UI.BunifuCheckbox UpdateCheck, Movie movie, List <string> streams, string table_db, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid)
 {
     if (!DataExist_db(movie.id.ToString(), table_db))
     {
         //---- insertion
         Console.WriteLine("insert");
         insertMovie(movie, table_db, streams);
         if (dataGrid.InvokeRequired)
         {
             dataGrid.Invoke(new Action(() => dataGrid.Rows.Add(movie.title, "INSERTED")));
         }
     }
     else
     {
         if (UpdateCheck.Checked)
         {
             //---- update
             Console.WriteLine("update");
             UpdateMovie(streams, movie.id, table_db);
             if (dataGrid.InvokeRequired)
             {
                 dataGrid.Invoke(new Action(() => dataGrid.Rows.Add(movie.title, "UPDATED")));
             }
         }
     }
 }
コード例 #23
0
        static void getMoviesPerPage(Bunifu.Framework.UI.BunifuCheckbox UpdateCheck, System.Windows.Forms.PictureBox preview, List <string> URLs, string table_db, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid)
        {
            foreach (string URL in URLs)
            {
                HtmlWeb browser = new HtmlWeb();
                try
                {
                    Console.WriteLine(URL);
                    HtmlDocument doc      = browser.Load(URL);
                    Regex        pattern0 = new Regex(@"\(.*\)");
                    string       title    = doc.DocumentNode.SelectSingleNode("//h2[@class='heading']").InnerText.Trim();
                    title = pattern0.Replace(title, "").Trim();
                    Movie movie = Information.getTMDB_Movie(Information.getTMDBId_movie(title), "fr-FR");
                    if (movie == null)
                    {
                        continue;
                    }

                    preview.ImageLocation = "https://image.tmdb.org/t/p/w300_and_h450_bestv2" + movie.poster_path;
                    // ---- get streams ------
                    List <string> streams = getMovieStreams(doc, browser, URL);
                    // ---- save into db ------
                    Information.dumpMovie_db(UpdateCheck, movie, streams, table_db, dataGrid);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
コード例 #24
0
        public static Task getAllTV(Bunifu.Framework.UI.BunifuCheckbox UpdateCheck, System.Windows.Forms.PictureBox preview, Bunifu.Framework.UI.BunifuFlatButton Start, Bunifu.Framework.UI.BunifuFlatButton Stop, Bunifu.Framework.UI.BunifuCircleProgressbar Progress, Stream_Scraper.Form1.StopWatch Watch, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, System.Windows.Forms.Label Total, System.Windows.Forms.Label Scraped, string url, string table_db, string seasons_db, string stream_db)
        {
            int PagesCount = getPagesCount(url);

            Total.Invoke(new Action(() => Total.Text = PagesCount.ToString()));
            for (int i = 1; i <= PagesCount; i++)
            {
                List <string> TVURLs = null;


                if (i == 1)
                {
                    TVURLs = getTVsURLs($"https://libertyvf.co/series/");
                }
                else
                {
                    TVURLs = getTVsURLs($"https://libertyvf.co/series/page-{i}.html");
                }
                getTVPerPage(preview, TVURLs, table_db, seasons_db, stream_db, dataGrid, UpdateCheck);
                Scraped.Invoke(new Action(() => Scraped.Text = i.ToString()));
            }
            Start.Invoke(new Action(() => Start.Enabled        = true));
            Stop.Invoke(new Action(() => Stop.Enabled          = false));
            Progress.Invoke(new Action(() => Progress.animated = false));
            Progress.Invoke(new Action(() => Progress.Visible  = false));
            return(null);
        }
コード例 #25
0
 static void getTVPerPage(System.Windows.Forms.PictureBox preview, List <string> URLs, string table_db, string seasons_db, string stream_db, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, Bunifu.Framework.UI.BunifuCheckbox UpdateCheck)
 {
     foreach (string URL in URLs)
     {
         HtmlWeb browser = new HtmlWeb();
         try
         {
             Console.WriteLine(URL);
             HtmlDocument doc      = browser.Load(URL);
             Regex        pattern0 = new Regex(@"\(.*\)");
             string       title    = doc.DocumentNode.SelectSingleNode("//h2[@class='heading']").InnerText.Trim();
             title = pattern0.Replace(title, "").Trim();
             TV tv = Information.getTMDB_TV(Information.getTMDBId_TV(title), "fr-FR");
             if (tv == null)
             {
                 continue;
             }
             if (!Information.DataExist_db(tv.id.ToString(), table_db))
             {
                 Information.insertTV(tv, table_db);
             }
             if (dataGrid.InvokeRequired)
             {
                 dataGrid.Invoke(new Action(() => dataGrid.Rows.Add(title, "UPDATED")));
             }
             preview.ImageLocation = "https://image.tmdb.org/t/p/w300_and_h450_bestv2" + tv.poster_path;
             //-- get seasons episodes <Season,<Episode,Streams>>
             Dictionary <int, Dictionary <int, List <string> > > tvData = getTVData(URL);
             // ---- save into db ------
             Information.dumpSeasonsEpisodes_db(tv, tvData, seasons_db, stream_db, "fr-FR", UpdateCheck);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }
コード例 #26
0
        public static Task getAnimes(System.Windows.Forms.PictureBox preview, Bunifu.Framework.UI.BunifuFlatButton Start, Bunifu.Framework.UI.BunifuFlatButton Stop, Bunifu.Framework.UI.BunifuCircleProgressbar Progress, Stream_Scraper.Form1.StopWatch Watch, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, System.Windows.Forms.Label Total, System.Windows.Forms.Label Scraped, string url)
        {
            int PageCount = 45;


            Total.Invoke(new Action(() => Total.Text = PageCount.ToString()));
            try
            {
                for (int i = 1; i < PageCount; i++)
                {
                    List <string> AnimeList = getAnimeList(url + $"?page={i}");
                    List <Anime>  animes    = getAnimesPerPage(dataGrid, preview, AnimeList);
                    Scraped.Invoke(new Action(() => Scraped.Text = (i).ToString()));
                }
            }
            catch
            {
            }
            finally
            {
                Start.Invoke(new Action(() => Start.Enabled        = true));
                Stop.Invoke(new Action(() => Stop.Enabled          = false));
                Progress.Invoke(new Action(() => Progress.animated = false));
                Progress.Invoke(new Action(() => Progress.Visible  = false));
            }


            return(null);
        }
コード例 #27
0
        private static List <Anime> getAnimesPerPage(Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, System.Windows.Forms.PictureBox preview, List <string> Links)
        {
            List <Anime> animes  = new List <Anime>();
            HtmlWeb      browser = new HtmlWeb();


            foreach (string link in Links)
            {
                try {
                    //Console.WriteLine(link);
                    HtmlDocument       document = browser.Load(link);
                    Anime              anime    = new Anime();
                    HtmlNodeCollection info     = document.DocumentNode.SelectSingleNode("//div[@class='anime_info_body_bg']").SelectNodes("p[@class='type']");
                    anime.Title = document.DocumentNode.SelectSingleNode("//div[@class='anime_info_body_bg']").SelectSingleNode("h1").InnerText;
                    anime.Image = document.DocumentNode.SelectSingleNode("//div[@class='anime_info_body_bg']").SelectSingleNode("img").Attributes["src"].Value;
                    preview.Invoke(new Action(() => preview.ImageLocation = anime.Image));
                    foreach (HtmlNode item in info)
                    {
                        string choice = item.FirstChild.InnerText.Trim();
                        item.FirstChild.Remove();
                        switch (choice)
                        {
                        case "Type:":
                            anime.Type = item.SelectSingleNode("a").Attributes["title"].Value;
                            break;

                        case "Status:":
                            anime.Status = item.InnerText;
                            break;

                        case "Released:":
                            anime.Aired = item.InnerText;
                            break;

                        case "Genre:":
                            foreach (HtmlNode genre in item.SelectNodes("a"))
                            {
                                anime.Genres.Add(genre.Attributes["title"].Value);
                            }
                            break;

                        case "Plot Summary:":
                            anime.Summary = item.InnerText;
                            break;

                        default: break;
                        }
                    }
                    //------get Episodes

                    int numEpisodes = int.Parse(document.DocumentNode.SelectSingleNode("//ul[@id='episode_page']")
                                                .SelectNodes("li")
                                                .Last()
                                                .SelectSingleNode("a")
                                                .Attributes["ep_end"].Value);
                    string unq = link.Split(new[] { "category/" }, StringSplitOptions.None)[1];
                    anime.Streams = getEpisodesPerAnime(unq, numEpisodes);
                    anime.Unique  = unq;
                    dumpIntodb(dataGrid, anime);
                    //dumpScrapedAnimeGrid(dataGrid,anime);
                    //Console.WriteLine(anime.ToString());
                    animes.Add(anime);
                }
                catch
                {
                }
            }



            return(animes);
        }
        private void frmViewPayments_Load(object sender, EventArgs e)
        {
            var bunifuDataGrid = new Bunifu.Framework.UI.BunifuCustomDataGrid();

            this.Controls.Add(bunifuDataGrid);
        }
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Emp_CustomerInfo));
     System.Windows.Forms.DataGridViewCellStyle     dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
     System.Windows.Forms.DataGridViewCellStyle     dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
     System.Windows.Forms.DataGridViewCellStyle     dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
     this.tableLayoutPanel1  = new System.Windows.Forms.TableLayoutPanel();
     this.tableLayoutPanel2  = new System.Windows.Forms.TableLayoutPanel();
     this.bunifuImageButton1 = new Bunifu.Framework.UI.BunifuImageButton();
     this.label1             = new System.Windows.Forms.Label();
     this.tableLayoutPanel3  = new System.Windows.Forms.TableLayoutPanel();
     this.dgvCustomerInfo    = new Bunifu.Framework.UI.BunifuCustomDataGrid();
     this.tableLayoutPanel4  = new System.Windows.Forms.TableLayoutPanel();
     this.btnSearch          = new Bunifu.Framework.UI.BunifuThinButton2();
     this.txtSearch          = new Bunifu.Framework.UI.BunifuTextbox();
     this.bunifuImageButton2 = new Bunifu.Framework.UI.BunifuImageButton();
     this.tableLayoutPanel1.SuspendLayout();
     this.tableLayoutPanel2.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.bunifuImageButton1)).BeginInit();
     this.tableLayoutPanel3.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dgvCustomerInfo)).BeginInit();
     this.tableLayoutPanel4.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.bunifuImageButton2)).BeginInit();
     this.SuspendLayout();
     //
     // tableLayoutPanel1
     //
     this.tableLayoutPanel1.ColumnCount = 1;
     this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0);
     this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 1);
     this.tableLayoutPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
     this.tableLayoutPanel1.Name     = "tableLayoutPanel1";
     this.tableLayoutPanel1.RowCount = 2;
     this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.13616F));
     this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 89.86385F));
     this.tableLayoutPanel1.Size     = new System.Drawing.Size(1184, 661);
     this.tableLayoutPanel1.TabIndex = 0;
     //
     // tableLayoutPanel2
     //
     this.tableLayoutPanel2.ColumnCount = 2;
     this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tableLayoutPanel2.Controls.Add(this.bunifuImageButton1, 0, 0);
     this.tableLayoutPanel2.Controls.Add(this.label1, 1, 0);
     this.tableLayoutPanel2.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
     this.tableLayoutPanel2.Name     = "tableLayoutPanel2";
     this.tableLayoutPanel2.RowCount = 1;
     this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tableLayoutPanel2.Size     = new System.Drawing.Size(1178, 61);
     this.tableLayoutPanel2.TabIndex = 0;
     //
     // bunifuImageButton1
     //
     this.bunifuImageButton1.Anchor      = System.Windows.Forms.AnchorStyles.Right;
     this.bunifuImageButton1.BackColor   = System.Drawing.Color.Transparent;
     this.bunifuImageButton1.Image       = ((System.Drawing.Image)(resources.GetObject("bunifuImageButton1.Image")));
     this.bunifuImageButton1.ImageActive = null;
     this.bunifuImageButton1.Location    = new System.Drawing.Point(515, 5);
     this.bunifuImageButton1.Name        = "bunifuImageButton1";
     this.bunifuImageButton1.Size        = new System.Drawing.Size(71, 50);
     this.bunifuImageButton1.SizeMode    = System.Windows.Forms.PictureBoxSizeMode.Zoom;
     this.bunifuImageButton1.TabIndex    = 2;
     this.bunifuImageButton1.TabStop     = false;
     this.bunifuImageButton1.Zoom        = 10;
     //
     // label1
     //
     this.label1.Anchor   = System.Windows.Forms.AnchorStyles.Left;
     this.label1.AutoSize = true;
     this.label1.Font     = new System.Drawing.Font("Sitka Small", 14.25F, ((System.Drawing.FontStyle)(((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic)
                                                                                                        | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label1.Location = new System.Drawing.Point(592, 16);
     this.label1.Name     = "label1";
     this.label1.Size     = new System.Drawing.Size(239, 28);
     this.label1.TabIndex = 3;
     this.label1.Text     = "Customer Information";
     //
     // tableLayoutPanel3
     //
     this.tableLayoutPanel3.ColumnCount = 1;
     this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tableLayoutPanel3.Controls.Add(this.dgvCustomerInfo, 0, 1);
     this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel4, 0, 0);
     this.tableLayoutPanel3.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 70);
     this.tableLayoutPanel3.Name     = "tableLayoutPanel3";
     this.tableLayoutPanel3.RowCount = 2;
     this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.58234F));
     this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 86.41766F));
     this.tableLayoutPanel3.Size     = new System.Drawing.Size(1178, 588);
     this.tableLayoutPanel3.TabIndex = 1;
     //
     // dgvCustomerInfo
     //
     this.dgvCustomerInfo.AllowUserToAddRows              = false;
     this.dgvCustomerInfo.AllowUserToDeleteRows           = false;
     dataGridViewCellStyle1.BackColor                     = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
     this.dgvCustomerInfo.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
     this.dgvCustomerInfo.AutoSizeColumnsMode             = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
     this.dgvCustomerInfo.BackgroundColor                 = System.Drawing.Color.White;
     this.dgvCustomerInfo.BorderStyle                     = System.Windows.Forms.BorderStyle.None;
     this.dgvCustomerInfo.CellBorderStyle                 = System.Windows.Forms.DataGridViewCellBorderStyle.RaisedHorizontal;
     this.dgvCustomerInfo.ColumnHeadersBorderStyle        = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
     dataGridViewCellStyle2.Alignment                     = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
     dataGridViewCellStyle2.BackColor                     = System.Drawing.Color.DarkSlateGray;
     dataGridViewCellStyle2.Font                        = new System.Drawing.Font("Segoe Print", 11F);
     dataGridViewCellStyle2.ForeColor                   = System.Drawing.Color.White;
     dataGridViewCellStyle2.SelectionBackColor          = System.Drawing.SystemColors.Highlight;
     dataGridViewCellStyle2.SelectionForeColor          = System.Drawing.SystemColors.HighlightText;
     dataGridViewCellStyle2.WrapMode                    = System.Windows.Forms.DataGridViewTriState.True;
     this.dgvCustomerInfo.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
     this.dgvCustomerInfo.ColumnHeadersHeightSizeMode   = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this.dgvCustomerInfo.Dock                      = System.Windows.Forms.DockStyle.Fill;
     this.dgvCustomerInfo.DoubleBuffered            = true;
     this.dgvCustomerInfo.EnableHeadersVisualStyles = false;
     this.dgvCustomerInfo.GridColor                 = System.Drawing.SystemColors.ActiveCaption;
     this.dgvCustomerInfo.HeaderBgColor             = System.Drawing.Color.DarkSlateGray;
     this.dgvCustomerInfo.HeaderForeColor           = System.Drawing.Color.White;
     this.dgvCustomerInfo.Location                  = new System.Drawing.Point(3, 82);
     this.dgvCustomerInfo.Name                      = "dgvCustomerInfo";
     this.dgvCustomerInfo.ReadOnly                  = true;
     this.dgvCustomerInfo.RowHeadersBorderStyle     = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
     this.dgvCustomerInfo.RowHeadersWidth           = 48;
     dataGridViewCellStyle3.Alignment               = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
     dataGridViewCellStyle3.Font                    = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     dataGridViewCellStyle3.SelectionBackColor      = System.Drawing.Color.Blue;
     dataGridViewCellStyle3.SelectionForeColor      = System.Drawing.Color.White;
     this.dgvCustomerInfo.RowsDefaultCellStyle      = dataGridViewCellStyle3;
     this.dgvCustomerInfo.Size                      = new System.Drawing.Size(1172, 503);
     this.dgvCustomerInfo.TabIndex                  = 1;
     //
     // tableLayoutPanel4
     //
     this.tableLayoutPanel4.ColumnCount = 3;
     this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 49.82935F));
     this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.12628F));
     this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34.12969F));
     this.tableLayoutPanel4.Controls.Add(this.btnSearch, 0, 0);
     this.tableLayoutPanel4.Controls.Add(this.txtSearch, 0, 0);
     this.tableLayoutPanel4.Controls.Add(this.bunifuImageButton2, 2, 0);
     this.tableLayoutPanel4.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 3);
     this.tableLayoutPanel4.Name     = "tableLayoutPanel4";
     this.tableLayoutPanel4.RowCount = 1;
     this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.tableLayoutPanel4.Size     = new System.Drawing.Size(1172, 73);
     this.tableLayoutPanel4.TabIndex = 2;
     //
     // btnSearch
     //
     this.btnSearch.ActiveBorderThickness = 1;
     this.btnSearch.ActiveCornerRadius    = 20;
     this.btnSearch.ActiveFillColor       = System.Drawing.Color.SeaGreen;
     this.btnSearch.ActiveForecolor       = System.Drawing.Color.White;
     this.btnSearch.ActiveLineColor       = System.Drawing.Color.SeaGreen;
     this.btnSearch.Anchor              = System.Windows.Forms.AnchorStyles.Left;
     this.btnSearch.BackColor           = System.Drawing.SystemColors.Control;
     this.btnSearch.BackgroundImage     = ((System.Drawing.Image)(resources.GetObject("btnSearch.BackgroundImage")));
     this.btnSearch.ButtonText          = "Search";
     this.btnSearch.Cursor              = System.Windows.Forms.Cursors.Hand;
     this.btnSearch.Font                = new System.Drawing.Font("Century Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.btnSearch.ForeColor           = System.Drawing.Color.SeaGreen;
     this.btnSearch.IdleBorderThickness = 1;
     this.btnSearch.IdleCornerRadius    = 20;
     this.btnSearch.IdleFillColor       = System.Drawing.Color.White;
     this.btnSearch.IdleForecolor       = System.Drawing.Color.SeaGreen;
     this.btnSearch.IdleLineColor       = System.Drawing.Color.SeaGreen;
     this.btnSearch.Location            = new System.Drawing.Point(588, 6);
     this.btnSearch.Margin              = new System.Windows.Forms.Padding(5);
     this.btnSearch.Name                = "btnSearch";
     this.btnSearch.Size                = new System.Drawing.Size(178, 60);
     this.btnSearch.TabIndex            = 6;
     this.btnSearch.TextAlign           = System.Drawing.ContentAlignment.MiddleCenter;
     this.btnSearch.Click              += new System.EventHandler(this.btnSearch_Click);
     //
     // txtSearch
     //
     this.txtSearch.Anchor                = System.Windows.Forms.AnchorStyles.Right;
     this.txtSearch.BackColor             = System.Drawing.Color.White;
     this.txtSearch.BackgroundImage       = ((System.Drawing.Image)(resources.GetObject("txtSearch.BackgroundImage")));
     this.txtSearch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
     this.txtSearch.ForeColor             = System.Drawing.Color.SeaGreen;
     this.txtSearch.Icon     = ((System.Drawing.Image)(resources.GetObject("txtSearch.Icon")));
     this.txtSearch.Location = new System.Drawing.Point(133, 15);
     this.txtSearch.Name     = "txtSearch";
     this.txtSearch.Size     = new System.Drawing.Size(447, 42);
     this.txtSearch.TabIndex = 4;
     this.txtSearch.text     = "";
     //
     // bunifuImageButton2
     //
     this.bunifuImageButton2.Anchor      = System.Windows.Forms.AnchorStyles.Left;
     this.bunifuImageButton2.BackColor   = System.Drawing.Color.Transparent;
     this.bunifuImageButton2.Image       = ((System.Drawing.Image)(resources.GetObject("bunifuImageButton2.Image")));
     this.bunifuImageButton2.ImageActive = null;
     this.bunifuImageButton2.Location    = new System.Drawing.Point(774, 14);
     this.bunifuImageButton2.Name        = "bunifuImageButton2";
     this.bunifuImageButton2.Size        = new System.Drawing.Size(48, 45);
     this.bunifuImageButton2.SizeMode    = System.Windows.Forms.PictureBoxSizeMode.Zoom;
     this.bunifuImageButton2.TabIndex    = 7;
     this.bunifuImageButton2.TabStop     = false;
     this.bunifuImageButton2.Zoom        = 10;
     this.bunifuImageButton2.Click      += new System.EventHandler(this.bunifuImageButton2_Click);
     //
     // Emp_CustomerInfo
     //
     this.ClientSize = new System.Drawing.Size(1184, 661);
     this.Controls.Add(this.tableLayoutPanel1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name            = "Emp_CustomerInfo";
     this.Load           += new System.EventHandler(this.Emp_CustomerInfo_Load);
     this.tableLayoutPanel1.ResumeLayout(false);
     this.tableLayoutPanel2.ResumeLayout(false);
     this.tableLayoutPanel2.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.bunifuImageButton1)).EndInit();
     this.tableLayoutPanel3.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.dgvCustomerInfo)).EndInit();
     this.tableLayoutPanel4.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.bunifuImageButton2)).EndInit();
     this.ResumeLayout(false);
 }
コード例 #30
0
        static void getTVPerPage(System.Windows.Forms.PictureBox preview, List <string> URLs, string table_db, string seasons_db, string stream_db, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, Bunifu.Framework.UI.BunifuCheckbox UpdateCheck)
        {
            foreach (string URL in URLs)
            {
                HtmlWeb browser = new HtmlWeb();
                try
                {
                    Console.WriteLine(URL);
                    HtmlDocument doc      = browser.Load(URL);
                    Regex        pattern0 = new Regex(@"\(.*\)");
                    //Regex p = new Regex("Saison ([0-9]+)");
                    Regex  t    = new Regex("- Saison [0-9]+");
                    string info = doc.DocumentNode.SelectSingleNode("//h1[@id='s-title']").InnerText.Trim();
                    info = pattern0.Replace(info, "").Trim();
                    //string season = p.Match(info).Groups[1].Value;
                    string title = t.Replace(info, "").Trim();
                    TV     tv    = Information.getTMDB_TV(Information.getTMDBId_TV(title), "fr-FR");
                    if (tv == null)
                    {
                        continue;
                    }
                    if (!Information.DataExist_db(tv.id.ToString(), table_db))
                    {
                        Information.insertTV(tv, table_db);
                        if (dataGrid.InvokeRequired)
                        {
                            dataGrid.Invoke(new Action(() => dataGrid.Rows.Add(tv.name, "INSERTED")));
                        }
                    }
                    else
                    {
                        if (UpdateCheck.Checked)
                        {
                            if (dataGrid.InvokeRequired)
                            {
                                dataGrid.Invoke(new Action(() => dataGrid.Rows.Add(tv.name, "UPDATED")));
                            }
                        }
                        else
                        if (dataGrid.InvokeRequired)
                        {
                            dataGrid.Invoke(new Action(() => dataGrid.Rows.Add(tv.name, "SEARCHING NEW EPs")));
                        }
                    }

                    preview.ImageLocation = "https://image.tmdb.org/t/p/w300_and_h450_bestv2" + tv.poster_path;


                    string seasonsURL = "https://french-serie.co" + doc.DocumentNode.SelectSingleNode(".//div[@class='fmeta icon-l']")
                                        .SelectSingleNode(".//strong").ParentNode.ParentNode.Attributes["href"].Value;
                    seasonsURL = Uri.EscapeUriString(seasonsURL);
                    //-- get seasons episodes <Season,<Episode,Streams>>
                    Dictionary <int, Dictionary <int, List <string> > > tvData = getTVData(seasonsURL);
                    // ---- save into db ------
                    Information.dumpSeasonsEpisodes_db(tv, tvData, seasons_db, stream_db, "fr-FR", UpdateCheck);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }