예제 #1
0
파일: tkLop.cs 프로젝트: ncthanh239/DMN
 public void load()
 {
     dataGridView1.DataSource            = KetNoiCSDL.Index("Select malop,tenlop,tenkhoa from lop join khoa on(lop.makhoa=khoa.makhoa)");
     dataGridView1.Columns[0].HeaderText = "Mã Lớp";
     dataGridView1.Columns[1].HeaderText = "Tên Lớp";
     dataGridView1.Columns[2].HeaderText = "Tên Khoa";
 }
예제 #2
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)
     {
     }
 }
예제 #3
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);
                }
            }
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn nhập từ khóa cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (comboBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn chọn cách cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                String sqlten = "Select count(*) from khoa where tenkhoa like '%" + textBox1.Text + "%'";

                int i = (int)KetNoiCSDL.count(sqlten);


                if ((i != 0) && comboBox1.Text.Equals("Tên Khoa"))
                {
                    MessageBox.Show("Tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    String kq = "select * from khoa where tenkhoa like N'%" + textBox1.Text.Trim() + "%'";
                    dataGridView1.DataSource = KetNoiCSDL.Index(kq);
                }

                else
                {
                    MessageBox.Show("Không tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn nhập từ khóa cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (comboBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn chọn cách cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                String sqlten = "Select count(*) from sinhvien where tensv like '%" + textBox1.Text + "%'";
                String sqlst  = "Select count(*) from sinhvien where masv like '%" + textBox1.Text + "%'";
                int    i      = (int)KetNoiCSDL.count(sqlten);
                int    j      = (int)KetNoiCSDL.count(sqlst);

                if ((i != 0) && comboBox1.Text.Equals("Tên Sinh Viên"))
                {
                    MessageBox.Show("Tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    String kq = "select masv[Mã sinh viên], tensv[Tên sinh viên], gioitinh[Giới tính], ngaysinh[Ngày sinh], sdt[Sdt], diachi[Địa chỉ], macs[Mã chính sách], tenlop[Tên lớp] from sinhvien join lop on(sinhvien.malop=lop.malop) where tensv like '%" + textBox1.Text.Trim() + "%'";
                    dataGridView1.DataSource = KetNoiCSDL.Index(kq);
                }
                else if ((j != 0) && comboBox1.Text.Equals("Mã Sinh Viên"))
                {
                    MessageBox.Show("Tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    String kq = "select masv[Mã sinh viên], tensv[Tên sinh viên], gioitinh[Giới tính], ngaysinh[Ngày sinh], sdt[Sdt], diachi[Địa chỉ], macs[Mã chính sách], tenlop[Tên lớp] from sinhvien join lop on(sinhvien.malop=lop.malop) where masv like '%" + textBox1.Text.Trim() + "%'";
                    dataGridView1.DataSource = KetNoiCSDL.Index(kq);
                }
                else
                {
                    MessageBox.Show("Không tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #6
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);
                }
            }
        }
예제 #7
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);
                }
            }
        }
예제 #8
0
파일: ql_admin.cs 프로젝트: ncthanh239/DMN
        void load()
        {
            string sql = "SELECT tk As N'Tài khoản', mk AS N'Mật khẩu', status AS N'Loại tài khoản' FROM tkad order by status";

            dataGridView1.DataSource = KetNoiCSDL.laybang(sql);
            comboBox1.SelectedIndex  = 0;
        }
예제 #9
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);
                }
            }
        }
예제 #10
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);
                }
            }
        }
예제 #11
0
        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);
            }
        }
예제 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn nhập từ khóa cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (comboBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn chọn cách cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                String sqlten = "Select count(*) from ttgiaovien where diachi like '%" + textBox1.Text + "%'";
                String sqlst  = "Select count(*) from ttgiaovien where tengv like '%" + textBox1.Text + "%'";
                int    i      = (int)KetNoiCSDL.count(sqlten);
                int    j      = (int)KetNoiCSDL.count(sqlst);

                if ((i != 0) && comboBox1.Text.Equals("Địa Chỉ"))
                {
                    MessageBox.Show("Tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    String kq = "select magv[Mã giáo viên], tengv[Tên giáo viên], gioitinh[Giới tính], ngaysinh[Ngày sinh], sdt[Sdt], diachi[Địa chỉ] from ttgiaovien where diachi like '%" + textBox1.Text.Trim() + "%'";
                    dataGridView1.DataSource = KetNoiCSDL.Index(kq);
                }
                else if ((j != 0) && comboBox1.Text.Equals("Tên Giáo Viên"))
                {
                    MessageBox.Show("Tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    String kq = "select magv[Mã giáo viên], tengv[Tên giáo viên], gioitinh[Giới tính], ngaysinh[Ngày sinh], sdt[Sdt], diachi[Địa chỉ] from ttgiaovien where tengv like '%" + textBox1.Text.Trim() + "%'";
                    dataGridView1.DataSource = KetNoiCSDL.Index(kq);
                }
                else
                {
                    MessageBox.Show("Không tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn nhập từ khóa cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (comboBox1.Text.Equals(""))
            {
                MessageBox.Show("Mời bạn chọn cách cần tìm kiếm!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                String sqlten = "Select count(*) from monhoc where tenmh like '%" + textBox1.Text + "%'";
                String sqlst  = "Select count(*) from monhoc where sotiet like '%" + textBox1.Text + "%'";
                int    i      = (int)KetNoiCSDL.count(sqlten);
                int    j      = (int)KetNoiCSDL.count(sqlst);

                if ((i != 0) && comboBox1.Text.Equals("Tên Môn Học"))
                {
                    MessageBox.Show("Tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    String kq = "select mamh[Mã môn học], tenmh[Tên môn học], sotiet[Số tiết], tengv[Tên giáo viên] from monhoc join ttgiaovien on(monhoc.magv=ttgiaovien.magv) where tenmh like '%" + textBox1.Text.Trim() + "%'";
                    dataGridView1.DataSource = KetNoiCSDL.Index(kq);
                }
                else if ((j != 0) && comboBox1.Text.Equals("Số Tiết"))
                {
                    MessageBox.Show("Tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    String kq = "select mamh[Mã môn học], tenmh[Tên môn học], sotiet[Số tiết], tengv[Tên giáo viên] from monhoc join ttgiaovien on(monhoc.magv=ttgiaovien.magv) where sotiet like '%" + textBox1.Text.Trim() + "%'";
                    dataGridView1.DataSource = KetNoiCSDL.Index(kq);
                }
                else
                {
                    MessageBox.Show("Không tìm thấy dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #14
0
 private void tt_sinhvien_Load(object sender, EventArgs e)
 {
     dataGridView1.DataSource = KetNoiCSDL.Index("select * from sinhvien");
     comboBox2.DataSource = KetNoiCSDL.Index("select macs from chinhsach");
     comboBox2.DisplayMember = "macs";
     comboBox3.DataSource = KetNoiCSDL.Index("select malop from lop");
     comboBox3.DisplayMember = "malop";
 }
예제 #15
0
 public void load()
 {
     dataGridView1.DataSource            = KetNoiCSDL.Index("Select * from monhoc");
     dataGridView1.Columns[0].HeaderText = "Mã môn học";
     dataGridView1.Columns[1].HeaderText = "Tên môn học";
     dataGridView1.Columns[2].HeaderText = "Số tiết";
     dataGridView1.Columns[3].HeaderText = "Mã giáo viên";
 }
예제 #16
0
 public void load()
 {
     dataGridView1.DataSource            = KetNoiCSDL.Index("Select * from ttgiaovien");
     dataGridView1.Columns[0].HeaderText = "Mã giáo viên";
     dataGridView1.Columns[1].HeaderText = "Tên giáo viên";
     dataGridView1.Columns[2].HeaderText = "Giới tính";
     dataGridView1.Columns[3].HeaderText = "Ngày sinh";
     dataGridView1.Columns[4].HeaderText = "Sdt";
     dataGridView1.Columns[5].HeaderText = "Địa chỉ";
 }
예제 #17
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);
     }
 }
예제 #18
0
 public void load()
 {
     dataGridView1.DataSource            = KetNoiCSDL.Index("Select * from sinhvien");
     dataGridView1.Columns[0].HeaderText = "Mã Sinh Viên";
     dataGridView1.Columns[1].HeaderText = "Tên Sinh Viên";
     dataGridView1.Columns[2].HeaderText = "Giới Tính";
     dataGridView1.Columns[3].HeaderText = "Ngày Sinh";
     dataGridView1.Columns[4].HeaderText = "Số Điện Thoại";
     dataGridView1.Columns[5].HeaderText = "Địa Chỉ";
     dataGridView1.Columns[6].HeaderText = "Mã Chính Sách";
     dataGridView1.Columns[7].HeaderText = "Mã lớp";
 }
예제 #19
0
파일: Diem.cs 프로젝트: ncthanh239/DMN
 private void Diem_Load(object sender, EventArgs e)
 {
     dataGridView1.DataSource            = KetNoiCSDL.Index("select * from diem");
     dataGridView1.Columns[0].HeaderText = "Id";
     dataGridView1.Columns[1].HeaderText = "Mã Sinh Viên";
     dataGridView1.Columns[2].HeaderText = "Mã Môn Học";
     dataGridView1.Columns[3].HeaderText = "Điểm";
     comboBox2.DataSource    = KetNoiCSDL.Index("Select masv from sinhvien");
     comboBox1.DataSource    = KetNoiCSDL.Index("select mamh from monhoc");
     comboBox1.DisplayMember = "mamh";
     comboBox2.DisplayMember = "masv";
 }
예제 #20
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);
                }
            }
        }
예제 #21
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);
     }
 }
예제 #22
0
 private void button3_Click(object sender, EventArgs e)
 {
     try {
         string sql = "DELETE from tkad where tk = '" + txb_username.Text + "'";
         KetNoiCSDL.laybang(sql);
         txb_username.ResetText();
         txb_pass.ResetText();
         txb_username.Focus();
         load();
     }
     catch (Exception ex) {
         MessageBox.Show("Không xóa được!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #23
0
파일: ql_admin.cs 프로젝트: ncthanh239/DMN
 private void button3_Click(object sender, EventArgs e)
 {
     try {
         if (MessageBox.Show("Bạn có muốn xóa không", "Nhóm 9", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             string sql = "DELETE from tkad where tk = '" + txb_username.Text + "'";
             KetNoiCSDL.laybang(sql);
             txb_username.ResetText();
             txb_pass.ResetText();
             txb_username.Focus();
             load();
         }
     }
     catch (Exception ex) {
         MessageBox.Show("Không xóa được!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #24
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();
            }
        }
예제 #25
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();
            }
        }
예제 #26
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);
                    }
                }
            }
        }
예제 #27
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();
            }
        }
예제 #28
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);
                }
            }
        }
예제 #29
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();
            }
        }
예제 #30
0
        void load()
        {
            string sql = "SELECT * FROM tkad";

            dataGridView1.DataSource = KetNoiCSDL.laybang(sql);
        }