Exemplo n.º 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");
            }
        }