Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string maMon  = (string)textBoxMaMon.Text;
            string tenMon = (string)textBoxTenMon.Text;
            string slot   = (string)textBoxSlot.Text;

            if (!checkFormat(maMon, tenMon, slot))
            {
                return;
            }
            int adminID = Admin.getAdminIdByUser(a.User1);

            if (adminID == 0)
            {
                MessageBox.Show("Can't not find out " + a.User1);
                return;
            }
            MonHoc m = new MonHoc(maMon, tenMon, Convert.ToInt32(slot));

            if (!MonHoc.insertMonHoc(m))
            {
                return;
            }
            DateTime d = DateTime.Now;

            if (HistoryAction.insertHistoryAction(adminID, "Insert", d, "Insert MonHoc with MaMonHoc: " + m.MaMh1 + ", TenMh: " + m.TenMh1 + " ,slot: " + m.Slot1))
            {
                MessageBox.Show("Add Success");
            }
        }
Beispiel #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            string maKh    = textBoxMaKHoa.Text;
            string tenKh   = textBoxTenKhoa.Text;
            int    adminID = Admin.getAdminIdByUser(a.User1);

            if (adminID == 0)
            {
                MessageBox.Show("Can't not find out " + a.User1);
                return;
            }
            if (maKh.Length != 0 && tenKh.Length != 0)
            {
                Khoa k = new Khoa(maKh, tenKh);
                //add khoa
                if (Khoa.insertKhoa(k))
                {
                    MessageBox.Show("Add Khoa Success");
                }
                DateTime d = DateTime.Now;
                if (HistoryAction.insertHistoryAction(adminID, "Insert", d, "Insert Khoa with MaKhoa = " + k.MaKhoa1 + " and " + k.TenKhoa1))
                {
                    MessageBox.Show("Add History Success");
                }
            }
            else
            {
                MessageBox.Show("You must input Data!");
            }
        }
Beispiel #3
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            string Notes   = "Remove DiemThi with MaSv: ";
            int    adminID = Admin.getAdminIdByUser(a.User1);

            if (adminID == 0)
            {
                MessageBox.Show("Can't not find out " + a.User1);
                return;
            }
            int count = 0;
            List <SinhVienAndPoint> list = new List <SinhVienAndPoint>();

            for (int i = 0; i < dataGridViewClass.RowCount - 1; i++)
            {
                if (Convert.ToBoolean(dataGridViewClass.Rows[i].Cells["Select"].Value) == true)
                {
                    count++;
                    string           MaSv   = (String)dataGridViewClass[2, i].Value;
                    string           MaMh   = dataGridViewClass.Rows[i].Cells["mamh"].Value.ToString();
                    int              LanThi = Convert.ToInt32(dataGridViewClass.Rows[i].Cells["lanthi"].Value.ToString());
                    SinhVienAndPoint svap   = new SinhVienAndPoint(null, MaSv, null, null, MaMh, 0, LanThi);
                    list.Add(svap);
                    Notes += MaSv + " \nMaSv";
                }
            }

            foreach (SinhVienAndPoint sv in list)
            {
                MessageBox.Show("List Sinh vien " + sv.MaSv1 + " " + sv.MaMh1);
            }

            if (count == 0)
            {
                MessageBox.Show("You must choose at least one");
            }
            if (SinhVienAndPoint.removeListPointSinhVien(list))
            {
                MessageBox.Show("Remove success");
            }
            else
            {
                return;
            }
            DateTime d = DateTime.Now;

            if (HistoryAction.insertHistoryAction(adminID, "Delete", d, Notes))
            {
                MessageBox.Show("Add History Success");
            }
        }
Beispiel #4
0
        private void button1_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 lanThi = textBoxLanThi.Text;
            string diem   = textBoxDiemThi.Text;

            if (lanThi.Length == 0 || diem.Length == 0)
            {
                MessageBox.Show("You must enter value for Lan thi and  Diem");
            }
            else if (checkNumber(lanThi) && checkNumber(diem))
            {
                var result = MessageBox.Show("Do you want to update ?", "Notification",
                                             MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (result == DialogResult.OK)
                {
                    int lThi   = Convert.ToInt32(lanThi);
                    int diemTh = Convert.ToInt32(diem);

                    //update diem thi
                    if (DiemThi.updateDiem(s, lThi, diemTh))
                    {
                        MessageBox.Show("Update success");
                    }
                    else
                    {
                        MessageBox.Show("Update faill");
                        return;
                    }
                    DateTime d = DateTime.Now;
                    if (HistoryAction.insertHistoryAction(adminID, "Update", d, "Update DiemThi with MaSv " + s.MaSv1 + " Diem Thi Lan Cu: " + s.DiemThi1 + " -> Diem Thi Moi: " + diemTh + " Lan Thi Cu: " + s.LanThi1 + " -> Lan Thi Moi: " + lanThi))
                    {
                        MessageBox.Show("Add History Success");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please Input Againt");
            }
        }
Beispiel #5
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");
            }
        }
Beispiel #6
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 maLop  = (string)comboBoxKhoa.SelectedValue;
            string tenLop = (string)comboBoxKhoa.Text;
            string numLop = textBoxMaLop.Text.Trim();
            string maKhoa = (string)comboBoxKhoa.SelectedValue;
            string maGv   = (string)comboBoxMaGV.SelectedValue;

            if (checkNumLop(numLop))
            {
                maLop  += numLop;
                tenLop += numLop;
                Lop l = new Lop(maLop, tenLop, maKhoa, maGv);
                if (Lop.checkLopExits(l))
                {
                    MessageBox.Show("Lop Da Ton Tai!!!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (Lop.insertLop(l))
                {
                    MessageBox.Show("Add lop success");
                }
                else
                {
                    return;
                }
                DateTime d = DateTime.Now;
                if (HistoryAction.insertHistoryAction(adminID, "Insert", d, "Insert Lop with MaLop: " + maLop + ", TenLop: " + tenLop + ", MaKhoa: " + maKhoa + ", MaGv: " + maGv))
                {
                    MessageBox.Show("Add History Success");
                }
            }
        }
Beispiel #7
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            string maGv     = textBoxMaGv.Text;
            string tenGv    = textBoxTenGv.Text;
            string chuyenNg = textBoxChuyenNganh.Text;
            string maKhoa   = (string)comboBoxMaKhoa.SelectedValue;

            int adminID = Admin.getAdminIdByUser(a.User1);

            if (adminID == 0)
            {
                MessageBox.Show("Can't not find out " + a.User1);
                return;
            }
            if (maGv.Length != 0 && tenGv.Length != 0 && chuyenNg.Length != 0)
            {
                GiangVien gv = new GiangVien(maGv, tenGv, chuyenNg, maKhoa);

                if (GiangVien.insertGiangVien(gv))
                {
                    MessageBox.Show("Add Giang Vien " + maGv + " successful!!!");
                }
                else
                {
                    MessageBox.Show("Can't not add giang vien " + maGv);
                }
                DateTime d = DateTime.Now;
                if (HistoryAction.insertHistoryAction(adminID, "Insert", d, "Insert GiangVien with MaGiangVien: " + gv.MaGv1 + ", TenGiangVien: " + gv.TenGv1 + " ,Chuyen Nganh: " + gv.ChuyenNganh1 + " ,Ma Khoa: " + gv.MaKhoa1))
                {
                    MessageBox.Show("Add History Success");
                }
            }
            else
            {
                MessageBox.Show("You must input all data!!!");
            }
        }