コード例 #1
0
        private void LoadSections(string dept)
        {
            r.Connect();
            MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM sections WHERE department = @department", r.adminn);

            r.admin2 = da.SelectCommand;
            r.admin2.Parameters.Add(new MySqlParameter("department", dept));
            DataTable dt = new DataTable();

            da.Fill(dt);
            r.Disconnect();
            dataGridView2.DataSource = dt;
        }
コード例 #2
0
ファイル: Form9.cs プロジェクト: bscpe-sofeng/stjohn
        private void button1_Click(object sender, EventArgs e)
        {
            {
                //database billing
                admin4.Connect();
                admin4.admin2 = new MySqlCommand("Insert into billing(StudentID, Name, Total, RemainingBalance, Monthly, TypeofPayment) value(@sn, @Name, @Total, @RemainingBalance, @Monthly, @TypeofPayment)", admin4.adminn);
                admin4.admin2.Parameters.Add(new MySqlParameter("sn", StudentID));
                admin4.admin2.Parameters.Add(new MySqlParameter("Name", label4.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Total", button3.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("RemainingBalance", label13.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Monthly", textBox3.Text));
                string payment = "";

                if (radioButton1.Checked)
                {
                    payment = radioButton1.Text;
                }
                else if (radioButton2.Checked)
                {
                    payment = radioButton2.Text;
                }
                admin4.admin2.Parameters.Add(new MySqlParameter("TypeofPayment", payment));


                admin4.admin2.ExecuteNonQuery();
                admin4.Disconnect();
            }


            //Name
            use1 = label4.Text;
            //remaining balance
            use2 = label13.Text;
            //AMTpay
            use3 = textBox1.Text;
            //AMTtoPAY
            use7 = textBox4.Text;
            //schoo year
            use4 = label16.Text;
            //date
            use5 = dateTimePicker1.Text;
            //change
            use6 = button4.Text;
            //total amount
            use8 = button3.Text;


            this.Hide();
            Form8 Form8 = new Form8();

            Form8.ShowDialog();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "" || textBox8.Text == "" || textBox9.Text == "" || textBox13.Text == "" || textBox14.Text == "" || textBox15.Text == "" || textBox16.Text == "" || textBox17.Text == "" || textBox18.Text == "")
            {
                MessageBox.Show("Some of the textbox is EMPTY!");
            }
            else
            {
                //database Student Info
                admin4.Connect();
                admin4.admin2 = new MySqlCommand("Insert into " + deparment + "(LastName, FirstName, MiddleName, Address, Age, AverageGrade, Birthday, Gender, PlaceofBirth, Nationality, Citizenship, Religion, FatherName, Occupation1, MotherName, Occupation2, GuardianName, ContactNumber) value(@LastName, @FirstName, @MiddleName, @Address, @Age, @AverageGrade, @Birthday, @Gender, @PlaceofBirth, @Nationality, @Citizenship, @Religion, @FatherName, @Occupation1, @MotherName, @Occupation2, @GuardianName, @ContactNumber)", admin4.adminn);
                admin4.admin2.Parameters.Add(new MySqlParameter("LastName", textBox1.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("FirstName", textBox2.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("MiddleName", textBox3.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Address", textBox4.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Age", textBox5.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("AverageGrade", textBox10.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Birthday", comboBox1.Text + " " + comboBox2.Text + ", " + comboBox3.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Gender", comboBox4.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("PlaceofBirth", textBox6.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Nationality", textBox7.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Citizenship", textBox8.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Religion", textBox9.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("FatherName", textBox13.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Occupation1", textBox15.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("MotherName", textBox14.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Occupation2", textBox16.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("GuardianName", textBox17.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("ContactNumber", textBox18.Text));
                admin4.admin2.ExecuteNonQuery();
                long lastID = admin4.admin2.LastInsertedId;
                admin4.Disconnect();


                //name
                Last   = textBox1.Text;
                First  = textBox2.Text;
                Middle = textBox3.Text;


                this.Hide();
                Form9.StudentID = lastID;
                Form9 Form10 = new Form9();
                Form10.ShowDialog();
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            {
                //update
                admin4.Connect();
                admin4.admin2 = new MySqlCommand("update billing set StudentID=@StudentID, Name=@Name, RemainingBalance=@RemainingBalace, Monthly=@Monthly where ID=@ID", admin4.adminn);
                admin4.admin2.Parameters.Add(new MySqlParameter("ID", label15.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("StudentID", label4.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Name", label5.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("RemainingBalance", label20.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Monthly", label10.Text));


                admin4.admin2.ExecuteNonQuery();
                admin4.Disconnect();
                LoadTable1();
            }


            //Name
            user1 = label5.Text;
            //remaining balance
            user2 = label7.Text;
            //AMTpay
            user3 = textBox2.Text;
            //AMTtoPAY
            user4 = textBox3.Text;
            //change
            user5 = label18.Text;
            //School year
            user6 = label18.Text;
            //date
            user7 = dateTimePicker1.Text;



            this.Hide();
            Form8 Form8 = new Form8();

            Form8.ShowDialog();
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            cs          = new Class1();
            cs.savePath = Application.StartupPath;
            if (cs.Connect(textBox1.Text))
            {
                label1.Text = "连接成功....";
            }
            ;
            comboBox1.SelectedIndex = 2;
            //Thread td2 = new Thread(Crosscontrol);//读取控件
            //td2.IsBackground = true; //设定为后台线程
            //td2.Start();//启动线程
            Thread td21 = new Thread(Crosscontrol1); //读取控件

            td21.IsBackground = true;                //设定为后台线程
            td21.Start();                            //启动线程

            button2_Click(sender, e);
            button3_Click(sender, e);
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            admin4.Connect();
            admin4.admin2 = new MySqlCommand("select * from adminsaccount where Username=@Username and Password=@Password", admin4.adminn);
            admin4.admin2.Parameters.Add(new MySqlParameter("Username", textBox3.Text));
            admin4.admin2.Parameters.Add(new MySqlParameter("Password", textBox2.Text));
            admin4.admin1 = admin4.admin2.ExecuteReader();

            if (admin4.admin1.Read())
            {
                new Form6().Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Incorrect Username or Password!");
            }

            textBox2.Text = string.Empty;
            textBox3.Text = string.Empty;
        }
コード例 #7
0
        private void LoadTable()
        {
            //Elementary
            DataTable dt = new DataTable();

            dt.Columns.Add("StudentNumber");
            dt.Columns.Add("LastName");
            dt.Columns.Add("FirstName");
            dt.Columns.Add("MiddleName");
            dt.Columns.Add("Address");
            dt.Columns.Add("Age");
            dt.Columns.Add("AverageGrade");
            dt.Columns.Add("Birthday");
            dt.Columns.Add("Gender");
            dt.Columns.Add("PlaceofBirth");
            dt.Columns.Add("Nationality");
            dt.Columns.Add("Citizenship");
            dt.Columns.Add("Religion");
            dt.Columns.Add("FatherName");
            dt.Columns.Add("Occupation1");
            dt.Columns.Add("MotherName");
            dt.Columns.Add("Occupation2");
            dt.Columns.Add("GuardianName");
            dt.Columns.Add("ContactNumber");

            admin4.Connect();
            admin4.admin2 = new MySqlCommand("Select * from elementary where LastName like'%" + textBox1.Text + "%'", admin4.adminn);
            admin4.admin1 = admin4.admin2.ExecuteReader();

            while (admin4.admin1.Read())
            {
                dt.Rows.Add(new Object[] {
                    admin4.admin1["StudentNumber"],
                    admin4.admin1["LastName"],
                    admin4.admin1["FirstName"],
                    admin4.admin1["MiddleName"],
                    admin4.admin1["Address"],
                    admin4.admin1["Age"],
                    admin4.admin1["AverageGrade"],
                    admin4.admin1["Birthday"],
                    admin4.admin1["Gender"],
                    admin4.admin1["PlaceofBirth"],
                    admin4.admin1["Nationality"],
                    admin4.admin1["Citizenship"],
                    admin4.admin1["Religion"],
                    admin4.admin1["FatherName"],
                    admin4.admin1["Occupation1"],
                    admin4.admin1["MotherName"],
                    admin4.admin1["Occupation2"],
                    admin4.admin1["GuardianName"],
                    admin4.admin1["ContactNumber"]
                });
            }
            admin4.Disconnect();
            dataGridView1.DataSource = dt;



            //juniorHigh
            DataTable dtt = new DataTable();

            dtt.Columns.Add("StudentNumber");
            dtt.Columns.Add("LastName");
            dtt.Columns.Add("FirstName");
            dtt.Columns.Add("MiddleName");
            dtt.Columns.Add("Address");
            dtt.Columns.Add("Age");
            dtt.Columns.Add("AverageGrade");
            dtt.Columns.Add("Birthday");
            dtt.Columns.Add("Gender");
            dtt.Columns.Add("PlaceofBirth");
            dtt.Columns.Add("Nationality");
            dtt.Columns.Add("Citizenship");
            dtt.Columns.Add("Religion");
            dtt.Columns.Add("FatherName");
            dtt.Columns.Add("Occupation1");
            dtt.Columns.Add("MotherName");
            dtt.Columns.Add("Occupation2");
            dtt.Columns.Add("GuardianName");
            dtt.Columns.Add("ContactNumber");

            admin4.Connect();
            admin4.admin2 = new MySqlCommand("Select * from juniorhigh where LastName like'%" + textBox1.Text + "%'", admin4.adminn);
            admin4.admin1 = admin4.admin2.ExecuteReader();

            while (admin4.admin1.Read())
            {
                dt.Rows.Add(new Object[] {
                    admin4.admin1["StudentNumber"],
                    admin4.admin1["LastName"],
                    admin4.admin1["FirstName"],
                    admin4.admin1["MiddleName"],
                    admin4.admin1["Address"],
                    admin4.admin1["Age"],
                    admin4.admin1["AverageGrade"],
                    admin4.admin1["Birthday"],
                    admin4.admin1["Gender"],
                    admin4.admin1["PlaceofBirth"],
                    admin4.admin1["Nationality"],
                    admin4.admin1["Citizenship"],
                    admin4.admin1["Religion"],
                    admin4.admin1["FatherName"],
                    admin4.admin1["Occupation1"],
                    admin4.admin1["MotherName"],
                    admin4.admin1["Occupation2"],
                    admin4.admin1["GuardianName"],
                    admin4.admin1["ContactNumber"]
                });
            }
            admin4.Disconnect();
            dataGridView1.DataSource = dt;



            //seniorHigh
            DataTable dttt = new DataTable();

            dttt.Columns.Add("StudentNumber");
            dttt.Columns.Add("LastName");
            dttt.Columns.Add("FirstName");
            dttt.Columns.Add("MiddleName");
            dttt.Columns.Add("Address");
            dttt.Columns.Add("Age");
            dttt.Columns.Add("AverageGrade");
            dttt.Columns.Add("Birthday");
            dttt.Columns.Add("Gender");
            dttt.Columns.Add("PlaceofBirth");
            dttt.Columns.Add("Nationality");
            dttt.Columns.Add("Citizenship");
            dttt.Columns.Add("Religion");
            dttt.Columns.Add("FatherName");
            dttt.Columns.Add("Occupation1");
            dttt.Columns.Add("MotherName");
            dttt.Columns.Add("Occupation2");
            dttt.Columns.Add("GuardianName");
            dttt.Columns.Add("ContactNumber");

            admin4.Connect();
            admin4.admin2 = new MySqlCommand("Select * from seniorhigh where LastName like'%" + textBox1.Text + "%'", admin4.adminn);
            admin4.admin1 = admin4.admin2.ExecuteReader();


            while (admin4.admin1.Read())
            {
                dt.Rows.Add(new Object[] {
                    admin4.admin1["StudentNumber"],
                    admin4.admin1["LastName"],
                    admin4.admin1["FirstName"],
                    admin4.admin1["MiddleName"],
                    admin4.admin1["Address"],
                    admin4.admin1["Age"],
                    admin4.admin1["AverageGrade"],
                    admin4.admin1["Birthday"],
                    admin4.admin1["Gender"],
                    admin4.admin1["PlaceofBirth"],
                    admin4.admin1["Nationality"],
                    admin4.admin1["Citizenship"],
                    admin4.admin1["Religion"],
                    admin4.admin1["FatherName"],
                    admin4.admin1["Occupation1"],
                    admin4.admin1["MotherName"],
                    admin4.admin1["Occupation2"],
                    admin4.admin1["GuardianName"],
                    admin4.admin1["ContactNumber"]
                });
            }
            admin4.Disconnect();
            dataGridView1.DataSource = dt;
        }
コード例 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("Please enter your Lastname!");
                textBox1.Focus();
                return;
            }
            if (textBox2.Text == "")
            {
                MessageBox.Show("Please enter your Firstname!");
                textBox2.Focus();
                return;
            }
            if (textBox3.Text == "")
            {
                MessageBox.Show("Please enter your Username!");
                textBox3.Focus();
                return;
            }
            if (textBox4.Text == "")
            {
                MessageBox.Show("Please enter your Password!");
                textBox4.Focus();
                return;
            }
            else if (textBox4.Text != textBox5.Text)
            {
                MessageBox.Show("You have re-entered a wrong password!");
                textBox4.Clear();
                textBox5.Clear();
                textBox4.Focus();
                return;
            }
            else
            {
                //ADD
                admin4.Connect();
                admin4.admin2 = new MySqlCommand("Insert into adminsaccount(LastName, FirstName, UserName, Password, Status) value (@LastName, @FirstName, @UserName, @Password, @Status)", admin4.adminn);
                admin4.admin2.Parameters.Add(new MySqlParameter("LastName", textBox1.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("FirstName", textBox2.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("UserName", textBox3.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Password", textBox4.Text));
                admin4.admin2.Parameters.Add(new MySqlParameter("Status", label7.Text));

                admin4.admin2.ExecuteNonQuery();
                admin4.Disconnect();

                textBox1.Text = string.Empty;
                textBox2.Text = string.Empty;
                textBox3.Text = string.Empty;
                textBox4.Text = string.Empty;
                textBox5.Text = string.Empty;



                MessageBox.Show("You are successfully registerd!");

                this.Hide();
                Form3 Form3 = new Form3();
                Form3.ShowDialog();
            }
        }