Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string maSv    = textBoxMaSv.Text;
            string maMh    = (string)comboBoxMaMh.SelectedValue;
            string lanThi  = (string)comboBoxLanThi.SelectedItem;
            string diemThi = textBoxDiemThi.Text;

            if (checkFormat(diemThi))
            {
                if (SinhVien.CheckSinhVienExits(maSv))
                {
                    DiemThi d = new DiemThi(maSv, maMh, Convert.ToInt32(lanThi), Convert.ToInt32(diemThi));
                    if (DiemThi.insertDiem(d))
                    {
                        MessageBox.Show("Them Diem Thanh Cong");
                    }
                    else
                    {
                        MessageBox.Show("Them Diem That Bai", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Sinh Vien " + maSv + " khong ton tai!!!!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int adminID = Admin.getAdminIdByUser(a.User1);

            if (adminID == 0)
            {
                MessageBox.Show("Can't not find out " + a.User1);
                return;
            }
            string maSV  = textBoxMSSV.Text;
            string tenSv = textBoxTenSV.Text;

            if (!checkFormat(maSV, tenSv))
            {
                return;
            }
            if (SinhVien.CheckSinhVienExits(maSV))
            {
                MessageBox.Show("Ma Sinh Vien Da Ton Tai!!!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            bool     GioiTinh = getGioiTinh();
            DateTime d        = dateTimePicker1.Value;
            string   maLop    = (string)comboBoxMaLOp.SelectedValue;
            SinhVien s        = new SinhVien(maSV, tenSv, GioiTinh, d, maLop);

            if (!SinhVien.insertSinhVien(s))
            {
                MessageBox.Show("Add That Bai", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DateTime dn = DateTime.Now;

            if (HistoryAction.insertHistoryAction(adminID, "Insert", dn, "Insert SinhVien with MaSv: " + s.MaSv))
            {
                ;
            }
            {
                MessageBox.Show("Add History Success");
            }
        }