コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from tkgv where tk='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Tên Người Dùng!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox2.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Mật Khẩu!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int i = (int)KetNoiCSDL.count(sqlsa);
                if (i != 0)
                {
                    MessageBox.Show("Tài Khoản Đã Được Đăng Ký. Vui Lòng Sử Dụng Tên Khác! ", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Clear();
                    textBox2.Clear();
                    textBox1.Focus();
                }
                else
                {
                    string sql = "insert into tkgv values('" + textBox1.Text + "', '" + textBox2.Text + "')";
                    KetNoiCSDL.themsuaxoa(sql);
                    dataGridView1.DataSource = KetNoiCSDL.Index("select * from tkgv");
                    MessageBox.Show("Thêm mới thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #2
0
ファイル: Diem.cs プロジェクト: ncthanh239/DMN
        private void button2_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from diem where id ='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập ID!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox3.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Điểm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int i = (int)KetNoiCSDL.count(sqlsa);
                if (i == 0)
                {
                    MessageBox.Show("ID Đã Được Sử Dụng. Vui Lòng Sử Dụng ID Khác! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Clear();
                    textBox3.Clear();
                    comboBox1.ResetText();
                    comboBox2.ResetText();
                    textBox1.Focus();
                }
                else
                {
                    string sql = "update diem set masv = N'" + comboBox2.Text + "',mamh = '" + comboBox1.Text + "', diem = '" + textBox3.Text + "' where id = '" + textBox1.Text + "'";
                    KetNoiCSDL.themsuaxoa(sql);
                    dataGridView1.DataSource = KetNoiCSDL.Index("select * from diem");
                    MessageBox.Show("Update thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from tkgv where tk='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Tên Người Dùng!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox2.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Mật Khẩu!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int i = (int)KetNoiCSDL.count(sqlsa);
                if (i == 0)
                {
                    MessageBox.Show("Tên tài khoản không thay đổi được! ", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Clear();
                    textBox2.Clear();
                    textBox1.Focus();
                }
                else
                {
                    string sql = "update tkgv set mk = '" + textBox2.Text + "' where tk = '" + textBox1.Text + "'";
                    KetNoiCSDL.themsuaxoa(sql);
                    dataGridView1.DataSource = KetNoiCSDL.Index("select * from tkgv");
                    MessageBox.Show("Update thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #4
0
ファイル: ql_admin.cs プロジェクト: ncthanh239/DMN
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         if (txb_pass.Text == null || txb_username.Text == null || comboBox1.Text == null)
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         string sql = "select count(*) from tkad where tk = '" + txb_username.Text + "'";
         int    i   = KetNoiCSDL.count(sql);
         if (i > 0)
         {
             MessageBox.Show("Tên tài khoản đã tồn tại!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             txb_username.ResetText();
             txb_pass.ResetText();
             comboBox1.ResetText();
             txb_username.Focus();
         }
         else
         {
             string sql1 = "insert into tkad values ('" + txb_username.Text + "', '" + getMD5(txb_pass.Text) + "','" + comboBox1.Text + "') ";
             KetNoiCSDL.themsuaxoa(sql1);
             MessageBox.Show("Thêm thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
             load();
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from khoa where makhoa='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Mã Khoa!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox2.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Tên Khoa!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int i = (int)KetNoiCSDL.count(sqlsa);
                if (i == 0)
                {
                    MessageBox.Show("Mã Khoa Không Thay Đổi Được! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Clear();
                    textBox2.Clear();
                    textBox1.Focus();
                }
                else
                {
                    string sql = "update khoa set tenkhoa = N'" + textBox2.Text + "' where makhoa = '" + textBox1.Text + "'";
                    KetNoiCSDL.themsuaxoa(sql);
                    dataGridView1.DataSource = KetNoiCSDL.Index("select * from khoa");
                    MessageBox.Show("Update thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #6
0
ファイル: qlttLop.cs プロジェクト: ncthanh239/DMN
        private void button1_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from lop where malop ='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Mã Lớp!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox2.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Tên Lớp!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int i = (int)KetNoiCSDL.count(sqlsa);
                if (i != 0)
                {
                    MessageBox.Show("Mã Lớp Đã Được Sử Dụng. Vui Lòng Sử Dụng Tên Khác! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Clear();
                    textBox2.Clear();
                    comboBox1.ResetText();
                    textBox1.Focus();
                }
                else
                {
                    string sql = "insert into lop values('" + textBox1.Text + "', N'" + textBox2.Text + "', N'" + comboBox1.Text + "')";
                    KetNoiCSDL.themsuaxoa(sql);
                    dataGridView1.DataSource = KetNoiCSDL.Index("select * from lop");
                    MessageBox.Show("Thêm mới thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #7
0
ファイル: qlttSinhViencs.cs プロジェクト: ncthanh239/DMN
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string sqlsa = "select count(*) from sinhvien where masv='" + textBox1.Text + "'";
                if (textBox1.Text.Trim().Equals(""))
                {
                    MessageBox.Show("Bạn Chưa Nhập Mã Sinh Viên!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (textBox2.Text.Trim().Equals(""))
                {
                    MessageBox.Show("Bạn Chưa Tên Sinh Viên!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (comboBox1.Text.Trim().Equals(""))
                {
                    MessageBox.Show("Bạn Chưa Chọn Giới Tính!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (dateTimePicker1.Text.Trim().Equals(""))
                {
                    MessageBox.Show("Bạn Chưa Nhập Ngày Sinh!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (textBox4.Text.Trim().Equals(""))
                {
                    MessageBox.Show("Bạn Chưa Nhập Số Điện Thoại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (textBox5.Text.Trim().Equals(""))
                {
                    MessageBox.Show("Bạn Chưa Nhập Số Địa Chỉ!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    int i = (int)KetNoiCSDL.count(sqlsa);
                    if (i != 0)
                    {
                        MessageBox.Show("Mã Sinh Viên Đã Được Sử Dụng. Vui Lòng Sử Dụng Tên Khác! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        textBox1.Clear();
                        textBox2.Clear();

                        textBox4.Clear();
                        textBox5.Clear();

                        textBox1.Focus();
                        comboBox2.ResetText();
                        comboBox3.ResetText();
                        dateTimePicker1.ResetText();
                    }
                    else
                    {
                        string sql = "insert into sinhvien values('" + textBox1.Text + "', N'" + textBox2.Text + "', N'" + comboBox1.Text + "', '" + dateTimePicker1.Value.ToString() + "', '" + textBox4.Text + "', N'" + textBox5.Text + "', N'" + comboBox2.Text + "', N'" + comboBox3.Text + "')";
                        KetNoiCSDL.themsuaxoa(sql);
                        dataGridView1.DataSource = KetNoiCSDL.Index("select * from sinhvien");
                        MessageBox.Show("Thêm mới thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception l)
            {
                MessageBox.Show("" + l);
            }
        }
コード例 #8
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string pass   = textBox2.Text;
         string repass = textBox3.Text;
         if (pass.Equals(repass))
         {
             string sql = "select count(*) from tkad where tk=N'" + textBox1.Text + "'";
             if (textBox1.Text.Trim().Equals(""))
             {
                 MessageBox.Show("Bạn Chưa Nhập Tên Người Dùng!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else if (textBox2.Text.Trim().Equals(""))
             {
                 MessageBox.Show("Bạn Chưa Nhập Mật Khẩu!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 int i = (int)KetNoiCSDL.count(sql);
                 if (i != 0)
                 {
                     MessageBox.Show("Tài Khoản Đã Được Đăng Ký. Vui Lòng Sử Dụng Tên Khác! ", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     textBox1.Clear();
                     textBox2.Clear();
                     textBox3.Clear();
                     textBox1.Focus();
                 }
                 else
                 {
                     string txt  = getMD5(textBox2.Text);
                     string them = "insert into tkad values(N'" + textBox1.Text + "',N'" + txt + "',N'User')";
                     KetNoiCSDL.themsuaxoa(them);
                     if (MessageBox.Show("Đăng Ký Thành Công. Bạn Có Muốn Đăng Nhập Không?", "Đăng Ký", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                     {
                         this.Hide();
                         dangnhap f = new dangnhap();
                         f.Show();
                     }
                 }
             }
         }
         else
         {
             MessageBox.Show("Mật Khẩu Bạn Nhập Không Khớp! Bạn Vui Lòng Kiểm Tra Lại!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Error);
             textBox2.Clear();
             textBox3.Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Thao Tác Không Thực Hiện Được! Vui Lòng Kiểm Tra Lại!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #9
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from ttgiaovien where magv='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Mã Giáo Viên!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox2.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Tên Giáo Viên!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (comboBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Chọn Giới Tính!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (dateTimePicker1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Ngày Sinh!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox4.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Số Điện Thoại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox5.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Số Địa Chỉ!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int i = (int)KetNoiCSDL.count(sqlsa);
                if (i == 0)
                {
                    MessageBox.Show("Mã Giáo Viên Không Thay Đổi Được! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Clear();
                    textBox2.Clear();

                    textBox4.Clear();
                    textBox5.Clear();
                    comboBox1.ResetText();
                    dateTimePicker1.ResetText();
                    textBox1.Focus();
                }
                else
                {
                    string sql = "update ttgiaovien set tengv = N'" + textBox2.Text + "', gioitinh = N'" + comboBox1.SelectedItem.ToString() + "', ngaysinh = '" + dateTimePicker1.Value.ToString() + "', sdt = '" + textBox4.Text + "', diachi = N'" + textBox5.Text + "'  where magv = '" + textBox1.Text + "'";
                    KetNoiCSDL.themsuaxoa(sql);
                    dataGridView1.DataSource = KetNoiCSDL.Index("select * from ttgiaovien");
                    MessageBox.Show("Update thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #10
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Trim().Equals(""))
     {
         MessageBox.Show("Xóa không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         string sql = "delete from tkgv where tk = '" + textBox1.Text + "'";
         KetNoiCSDL.themsuaxoa(sql);
         dataGridView1.DataSource = KetNoiCSDL.Index("select * from tkgv");
         MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sql = "select count(*) from tkad where tk = '" + txb_username.Text + "'";
            int    i   = KetNoiCSDL.count(sql);

            if (i == 0)
            {
                MessageBox.Show("Không được đổi tên tài khoản!");
                txb_username.Focus();
            }
            else
            {
                string sql1 = "update tkad set mk='" + txb_pass.Text + "' where tk='" + txb_username.Text + "'";
                KetNoiCSDL.themsuaxoa(sql1);
                MessageBox.Show("Sửa thành công!");
                load();
            }
        }
コード例 #12
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sql = "select count(*) from tktk where tk = '" + txb_username.Text + "'";
            int    i   = KetNoiCSDL.count(sql);

            if (i == 0)
            {
                MessageBox.Show("Không được đổi tên tài khoản!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txb_username.Focus();
            }
            else
            {
                string sql1 = "update tktk set mk='" + getMD5(txb_pass.Text) + "' where tk='" + txb_username.Text + "'";
                KetNoiCSDL.themsuaxoa(sql1);
                MessageBox.Show("Sửa thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                load();
            }
        }
コード例 #13
0
ファイル: Diem.cs プロジェクト: ncthanh239/DMN
        private void button1_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from diem where id ='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập ID!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox3.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Điểm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }


            else
            {
                float diem = float.Parse(textBox3.Text);
                if (diem < 0 || diem > 10)
                {
                    MessageBox.Show("Mời Bạn Nhập Điểm Chính Xác! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    int i = (int)KetNoiCSDL.count(sqlsa);
                    if (i != 0)
                    {
                        MessageBox.Show("ID Đã Được Sử Dụng. Vui Lòng Sử Dụng ID Khác! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        textBox1.Clear();

                        textBox3.Clear();
                        comboBox1.ResetText();
                        comboBox2.ResetText();
                        textBox1.Focus();
                    }
                    else
                    {
                        string sql = "insert into diem values('" + textBox1.Text + "', N'" + comboBox2.Text + "','" + comboBox1.Text + "', N'" + textBox3.Text + "')";
                        KetNoiCSDL.themsuaxoa(sql);
                        dataGridView1.DataSource = KetNoiCSDL.Index("select * from diem");
                        MessageBox.Show("Thêm mới thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
コード例 #14
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Xóa không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string sql = "delete from ttgiaovien where magv = '" + textBox1.Text + "'";
                KetNoiCSDL.themsuaxoa(sql);
                dataGridView1.DataSource = KetNoiCSDL.Index("select * from ttgiaovien");
                MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox1.Clear();
                textBox2.Clear();

                textBox4.Clear();
                textBox5.Clear();
                comboBox1.ResetText();
                dateTimePicker1.ResetText();
                textBox1.Focus();
            }
        }
コード例 #15
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sqlsa = "select count(*) from monhoc where mamh='" + textBox1.Text + "'";

            if (textBox1.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Mã Môn Học!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox2.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Tên Môn Học!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox3.Text.Trim().Equals(""))
            {
                MessageBox.Show("Bạn Chưa Nhập Số Tiết!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int i = (int)KetNoiCSDL.count(sqlsa);
                if (i == 0)
                {
                    MessageBox.Show("Mã môn học Không Thay Đổi Được! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Clear();
                    textBox2.Clear();
                    textBox3.Clear();
                    comboBox1.ResetText();
                    textBox1.Focus();
                }
                else
                {
                    string sql = "update monhoc set tenmh = N'" + textBox2.Text + "',sotiet = '" + textBox3.Text + "', magv = '" + comboBox1.Text + "' where mamh = '" + textBox1.Text + "'";
                    KetNoiCSDL.themsuaxoa(sql);
                    dataGridView1.DataSource = KetNoiCSDL.Index("select * from monhoc");
                    MessageBox.Show("Update thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txb_pass.Text == null || txb_username.Text == null)
            {
                MessageBox.Show("Không được để trống!");
            }
            string sql = "select count(*) from tkad where tk = '" + txb_username.Text + "'";
            int    i   = KetNoiCSDL.count(sql);

            if (i > 0)
            {
                MessageBox.Show("Tên tài khoản đã tồn tại!");
                txb_username.ResetText();
                txb_pass.ResetText();
                txb_username.Focus();
            }
            else
            {
                string sql1 = "insert into tkad values ('" + txb_username.Text + "', '" + txb_pass.Text + "') ";
                KetNoiCSDL.themsuaxoa(sql1);
                MessageBox.Show("Thêm thành công!");
                load();
            }
        }