protected void DropDownListClass_SelectedIndexChanged(object sender, EventArgs e) { string tenLop = (string)DropDownListClass.SelectedValue; GridViewSinhVien.DataSource = SinhVienAndPoint.getSinhVienAndPointByClassID(tenLop); GridViewSinhVien.DataBind(); }
private void RefreshData(DataGridView dataGridViewClass) { string classID = (string)comboBoxClass.SelectedValue.ToString(); dataGridViewClass.DataSource = SinhVienAndPoint.getSinhVienAndPointByClassID(classID); dataGridViewClass.Columns[1].DataPropertyName = "MaLop1"; dataGridViewClass.Columns[2].DataPropertyName = "MaSv1"; dataGridViewClass.Columns[3].DataPropertyName = "TenSv1"; dataGridViewClass.Columns[4].DataPropertyName = "NgaySinh1"; dataGridViewClass.Columns[5].DataPropertyName = "MaMh1"; dataGridViewClass.Columns[6].DataPropertyName = "DiemThi1"; dataGridViewClass.Columns[7].DataPropertyName = "LanThi1"; }
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"); } }
private void dataGridViewClass_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridViewClass.Columns[e.ColumnIndex] == dataGridViewClass.Columns["updateButton"]) { string maSv = (string)dataGridViewClass.Rows[e.RowIndex].Cells["masv"].Value; string maMh = (string)dataGridViewClass.Rows[e.RowIndex].Cells["mamh"].Value; int lanThi = Convert.ToInt32(dataGridViewClass.Rows[e.RowIndex].Cells["lanthi"].Value); int diem = Convert.ToInt32(dataGridViewClass.Rows[e.RowIndex].Cells["diem"].Value); SinhVienAndPoint sv = new SinhVienAndPoint(null, maSv, null, null, maMh, diem, lanThi); if (p == null) { p = new UpdatePoint(sv, a); p.Show(); p = null; } } }
public UpdatePoint(SinhVienAndPoint sv, Admin ad) { a = ad; s = sv; InitializeComponent(); }