예제 #1
0
        //功能 窗口构造函数
        public 功能(MySqlConnection connection, string name, string password)
        {
            Password1   = password;
            Connection1 = connection;
            Name1       = name;
            //MainWindow m1 = new MainWindow();
            InitializeComponent();
            我的课程_grid1_data data2 = new 我的课程_grid1_data();

            data2.Init(Connection1, Name1, this.我的课程_grid1);
            我的课程_grid1_data data3 = new 我的课程_grid1_data();

            data3.课_init(Connection1, this.课_grid1);
            我的课程_grid1_data data4 = new 我的课程_grid1_data();

            data4.Init2(Connection1, Name1, this.课_grid2);

            //公告
            公告_announcment data5 = new 公告_announcment();

            data5.Init(Connection1, 公告_grid1);

            //讨论
            讨论_discussion data6 = new 讨论_discussion();

            data6.Init(Connection1, 讨论_grid1);
        }
예제 #2
0
        //选课——checked
        private void  课_Checked(Object sender, RoutedEventArgs e)
        {
            Button       button1   = sender as Button;
            string       course_id = button1.Content.ToString();
            string       str1      = "insert ignore into student_course_selected_tempary value ('";
            string       str2      = "', '";
            string       str3      = "');";
            MySqlCommand cmd       = new MySqlCommand(str1 + Name1 + str2 + course_id + str3, Connection1);

            cmd.ExecuteNonQuery();
            MessageBox.Show("选课成功", "选课成功", MessageBoxButton.OK);
            var list = new List <我的课程_grid1_data>();

            this.课_grid2.DataContext = list;
            讨论_discussion data6 = new 讨论_discussion();

            data6.Init(Connection1, 讨论_grid1);
        }
예제 #3
0
        public void Init(MySqlConnection Connection, Grid grid1)
        {
            var list = new List <讨论_discussion>();

            string str1 = "select * from discussion";

            MySqlCommand    cmd = new MySqlCommand(str1, Connection);
            MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                讨论_discussion data = new 讨论_discussion();
                data.Discussionperson  = rdr[0].ToString();
                data.Discussioncontent = rdr[1].ToString();


                list.Add(data);
            }
            grid1.DataContext = list;
            rdr.Close();
        }