Beispiel #1
0
        private void hk1bt_Click(object sender, EventArgs e)
        {
            string x = yearcombo.SelectedItem.ToString();
            string y = "1" + x;
            int    z = int.Parse(y);
            int    i = 0;

            if (mhnothkgrid.SelectedRows.Count > 0)
            {
                foreach (var nh in HocKi.HK)
                {
                    if (nh.MaHK1 == z && mhnothkgrid.SelectedRows.Count > 0)
                    {
                        i = 1;
                        DataGridViewRow row = mhnothkgrid.SelectedRows[0];

                        string   mabc    = nh.MaHK1 + row.Cells[0].Value.ToString();
                        CTMonHoc chitiet = new CTMonHoc(mabc, nh.MaHK1, row.Cells[0].Value.ToString());
                        HSB.AddMHtoHK(chitiet);
                        MessageBox.Show("successfull");
                    }
                }
                if (i == 0)
                {
                    MessageBox.Show("năm học này chưa có học kì này");
                }
            }
            else
            {
                MessageBox.Show("chưa chọn môn cần thêm vào học kì");
            }
        }