Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            TienIchKhac frm = new TienIchKhac();
            frm.MdiParent = this.ParentForm;
            this.Close();
            frm.Show();
 
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string query = string.Empty;


            string strDbPath = Application.StartupPath + @"\CodeChildren1Offical.mdb";
            string strCnn = "Provider = Microsoft.Jet.OleDb.4.0; Data Source = " + strDbPath;
            OleDbConnection conn = new OleDbConnection(strCnn);
            try
            {
                conn.Open();
                if (checkBox1.Checked )
                {
                    query = "INSERT INTO BlockWebQickSt(Game) VALUES('Game1')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }
                if (checkBox2.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Shopping) VALUES('Shopping')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }

                if (checkBox3.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Sexxxx) VALUES('Sexxxx')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }

                if (checkBox4.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Weapon) VALUES('Weapon')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }
                if (checkBox5.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Social) VALUES('Social')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }
                if (checkBox6.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Violent) VALUES('Violent')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }
                if (checkBox7.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Alocol) VALUES('Alocol')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }
                if (checkBox8.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Crime) VALUES('Crime')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }
                if (checkBox9.Checked)
                {
                    query = "INSERT INTO BlockWebQickSt(Drug) VALUES('Drug')";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();
                }

                if (checkBox1.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Game='Game1' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    sqlCommand.ExecuteNonQuery();

                }

                if (checkBox2.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Shopping='Shopping' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }

                if (checkBox3.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Sexxxx='Sexxxx' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }

                if (checkBox4.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Weapon='Weapon'";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }

                if (checkBox5.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Social='Social' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }

                if (checkBox6.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Violent='Violent' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }

                if (checkBox7.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Alocol='Alocol' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }

                if (checkBox8.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Crime='Crime' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }

                if (checkBox9.Checked == false)
                {
                    query = "DELETE FROM BlockWebQickSt WHERE Drug='Drug' ";
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    int i = sqlCommand.ExecuteNonQuery();

                }
                
                
                MessageBox.Show("Đã Cài Đặt Chặn Nội Dung Web Theo Yêu Cầu Người Dùng");
                TienIchKhac frm = new TienIchKhac();
                frm.MdiParent = this.ParentForm;
                this.Close();
                frm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     this.DialogResult = DialogResult.Cancel;
     TienIchKhac frm = new TienIchKhac();
     frm.MdiParent = this.ParentForm;
     this.Close();
     frm.Show();
 }
Пример #4
0
 private void metroTileItem5_Click_1(object sender, EventArgs e)
 {
     TienIchKhac frm = new TienIchKhac();
     frm.MdiParent = this.ParentForm;
     this.Close();
     frm.Show();
 }
Пример #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            string strDbPath = Application.StartupPath + @"\CodeChildren1Offical.mdb";
            string strCnn = "Provider = Microsoft.Jet.OleDb.4.0; Data Source = " + strDbPath;
            OleDbConnection conn = new OleDbConnection(strCnn);
            try
            {
                string[] words;
                string newwords = "";
                Boolean chkiKid = false;
                string FileName = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\drivers\etc\hosts";
                if (File.Exists(FileName))
                {
                    words = File.ReadAllLines(FileName, Encoding.Default);
                    for (int i = 0; i < words.Length; i++)
                    {
                        if (words[i] != "#iKidStart")
                        {
                            if (chkiKid == false)
                            {
                                newwords += words[i] + "\n";
                            }
                        }
                        else if (words[i] == "#iKidStart")
                        {
                            chkiKid = true;
                        }
                        else if (words[i] == "#iKidEnd")
                        {
                            chkiKid = false;
                        }
                    }
                }
                newwords += "#iKidStart\n";
                
                conn.Open();
                string sql = "DELETE from BlockWeb";
                OleDbCommand cmd = new OleDbCommand(sql, conn);
                cmd.ExecuteScalar();
                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    sql = "Insert Into BlockWeb(LinkWeb,Status) values('" + listView1.Items[i].Text + "','bat')";
                    //newwords += "210.211.126.218 " + listView1.Items[i].Text + "\n";
                    // newwords += "210.211.126.218 www." + listView1.Items[i].Text + "\n";
                    newwords += "127.0.0.1 " + listView1.Items[i].Text + "\n";
                    newwords += "127.0.0.1 www." + listView1.Items[i].Text + "\n";
                    cmd = new OleDbCommand(sql, conn);
                    cmd.ExecuteScalar();
                }
                newwords += "#iKidEnd";
                StreamWriter writer = new StreamWriter(FileName);
                writer.Write(newwords);
                writer.Close();               
                MessageBox.Show("Đã lưu trữ danh sách TRANG WEB CẤM thành công");
            }
            catch
            {
                MessageBox.Show("Có lỗi của chương trình");
            }
            finally
            {
                conn.Close();
            }
            



            TienIchKhac frm = new TienIchKhac();
            frm.MdiParent = this.ParentForm;
            this.Close();
            frm.Show();
        }