예제 #1
0
파일: ql_monhoc.cs 프로젝트: ncthanh239/DMN
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || cb1.Text == "")
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             string sql = "select count(*) from monhoc where mamh = '" + textBox1.Text + "'";
             int    i   = KetNoiCSDL.count(sql);
             if (i == 0)
             {
                 MessageBox.Show("Không được đổi mã môn học!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 textBox1.Focus();
             }
             else
             {
                 string sql1 = "update monhoc set tenmh=N'" + textBox2.Text + "',sotiet = '" + textBox3.Text + "' , magv = '" + cb1.Text + "' where mamh='" + textBox1.Text + "'";
                 KetNoiCSDL.themsuaxoa(sql1);
                 MessageBox.Show("Sửa thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 load();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sửa thất bại", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
파일: ql_diem.cs 프로젝트: ncthanh239/DMN
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || comboBox2.Text == "")
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             string sql = "select count(*) from diem where id = '" + textBox1.Text + "'";
             int    i   = KetNoiCSDL.count(sql);
             if (i == 0)
             {
                 MessageBox.Show("Không được đổi mã điểm!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 textBox1.Focus();
             }
             else
             {
                 string sql1 = "update diem set masv=N'" + comboBox2.Text + "', mamh = '" + comboBox1.Text + "', diem='" + textBox4.Text + "' where id='" + textBox1.Text + "'";
                 KetNoiCSDL.themsuaxoa(sql1);
                 MessageBox.Show("Sửa thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 load();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sửa thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
파일: ql_lop.cs 프로젝트: ncthanh239/DMN
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "" || textBox2.Text == "")
     {
         MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         string sql = "select count(*) from lop where malop = '" + textBox1.Text + "'";
         int    i   = KetNoiCSDL.count(sql);
         if (i > 0)
         {
             MessageBox.Show("Mã lớp đã tồn tại!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             textBox1.ResetText();
             textBox2.ResetText();
             textBox1.Focus();
         }
         else
         {
             string sql1 = "insert into lop values ('" + textBox1.Text + "',N'" + textBox2.Text + "','" + comboBox1.Text + "') ";
             KetNoiCSDL.themsuaxoa(sql1);
             MessageBox.Show("Thêm thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
             load();
         }
     }
 }
예제 #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "")
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             string sql = "select count(*) from chinhsach where macs = '" + textBox1.Text + "'";
             int    i   = KetNoiCSDL.count(sql);
             if (i == 0)
             {
                 MessageBox.Show("Không được đổi mã chính sách!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 textBox1.Focus();
             }
             else
             {
                 string sql1 = "update chinhsach set tencs=N'" + textBox2.Text + "' where macs='" + textBox1.Text + "'";
                 KetNoiCSDL.themsuaxoa(sql1);
                 MessageBox.Show("Sửa thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 load();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sửa thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "")
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             string sql = "select count(*) from chinhsach where macs = '" + textBox1.Text + "'";
             int    i   = KetNoiCSDL.count(sql);
             if (i > 0)
             {
                 MessageBox.Show("Chính sách đã tồn tại!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 textBox1.ResetText();
                 textBox2.ResetText();
                 textBox1.Focus();
             }
             else
             {
                 string sql1 = "insert into chinhsach values ('" + textBox1.Text + "', N'" + textBox2.Text + "') ";
                 KetNoiCSDL.themsuaxoa(sql1);
                 MessageBox.Show("Thêm thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 load();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Thêm thất bại", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #6
0
파일: ql_gv.cs 프로젝트: ncthanh239/DMN
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || dateTimePicker1.Value.ToString() == "")
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             string sql = "select count(*) from giaovien where magv = '" + textBox1.Text + "'";
             int    i   = KetNoiCSDL.count(sql);
             if (i > 0)
             {
                 MessageBox.Show("Mã giáo viên đã tồn tại!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 textBox1.ResetText();
                 textBox2.ResetText();
                 textBox4.ResetText();
                 textBox4.ResetText();
                 radioButton1.Checked = false;
                 radioButton2.Checked = false;
                 dateTimePicker1.ResetText();
                 textBox1.Focus();
             }
             else
             {
                 if (radioButton1.Checked == true)
                 {
                     b = "Nam";
                 }
                 else if (radioButton2.Checked == true)
                 {
                     b = "Nữ";
                 }
                 string sql1 = "insert into giaovien values ('" + textBox1.Text + "', N'" + textBox2.Text + "',N'" + b + "','" + dateTimePicker1.Value.ToString() + "',N'" + textBox4.Text + "',N'" + textBox3.Text + "') ";
                 KetNoiCSDL.themsuaxoa(sql1);
                 MessageBox.Show("Thêm thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 load();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Thêm thất bại", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #7
0
파일: ql_diem.cs 프로젝트: ncthanh239/DMN
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         string d = textBox4.Text;
         float  diem;
         // bool ok = float.TryParse(d, out diem);
         if (textBox1.Text == "" || comboBox2.Text == "" || comboBox1.Text == "" || textBox4.Text == "")
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             string sql = "select count(*) from diem where id = '" + textBox1.Text + "'";
             int    i   = KetNoiCSDL.count(sql);
             if (i > 0)
             {
                 MessageBox.Show("Trùng ID điểm!");
                 textBox1.ResetText();
                 textBox4.ResetText();
                 comboBox2.ResetText();
                 comboBox1.ResetText();
                 textBox1.Focus();
             }
             else
             {
                 if (int.Parse(textBox4.Text) < 0 || int.Parse(textBox4.Text) > 10)
                 {
                     MessageBox.Show("Nhập điểm lớn hơn 0 và nhỏ hơn 10", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
                 else
                 {
                     string sql1 = "insert into diem values ('" + textBox1.Text + "',N'" + comboBox2.Text + "','" + comboBox1.Text + "', '" + d + "') ";
                     KetNoiCSDL.themsuaxoa(sql1);
                     MessageBox.Show("Thêm thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     load();
                 }
             }
         }
     }
     catch (Exception ex) {
         MessageBox.Show("Nhập điểm kiểu số!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #8
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || dateTimePicker1.Value.ToString() == "" || comboBox1.Text == "" || comboBox2.Text == "")
         {
             MessageBox.Show("Không được để trống!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             if (radioButton1.Checked == true)
             {
                 b = "Nam";
             }
             else if (radioButton3.Checked == true)
             {
                 b = "Nữ";
             }
             string sql = "select count(*) from sinhvien where masv = '" + textBox1.Text + "'";
             int    i   = KetNoiCSDL.count(sql);
             if (i == 0)
             {
                 MessageBox.Show("Không được đổi mã sinh viên!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 textBox1.Focus();
             }
             else
             {
                 string sql1 = "update sinhvien set tensv=N'" + textBox2.Text + "', gioitinh= N'" + b + "', ngaysinh ='" + dateTimePicker1.Value.ToString() + "', sdt= '" + textBox3.Text + "', diachi = N'" + textBox4.Text + "' , macs ='" + comboBox1.Text + "', malop='" + comboBox2.Text + "' where masv='" + textBox1.Text + "'";
                 KetNoiCSDL.themsuaxoa(sql1);
                 MessageBox.Show("Sửa thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 load();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sửa thất bại", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
                {
                    MessageBox.Show("Nhập đầy đủ thông tin để đổi mật khẩu!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string txt   = getMD5(textBox2.Text);
                    string sqlad = "select count(*) from tkad where tk = '" + textBox1.Text + "' and mk ='" + txt + "'";
                    int    i     = (int)KetNoiCSDL.count(sqlad);

                    if (i != 0)
                    {
                        if (textBox3.Text == textBox4.Text)
                        {
                            string sql = "update tkad set mk= '" + getMD5(textBox3.Text) + "' where tk ='" + textBox1.Text + "' ";
                            KetNoiCSDL.themsuaxoa(sql);
                            MessageBox.Show("Đổi mật khẩu thành công!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Nhập lại sai mật khẩu!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Tài khoản hoặc mật khẩu không đúng!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi!", "Nhóm 9", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }