private void m_cbo_ky_hoc_SelectedIndexChanged_1(object sender, EventArgs e) { try { m_txt_gpa.Text = ""; m_txt_cpa.Text = ""; if (tim_kiem_diem_sinh_vien() && tim_kiem_sinh_vien()) { US_KET_QUA_HOC_TAP v_us_kq_hoc_tap = new US_KET_QUA_HOC_TAP(m_dc_id_ket_qua_hoc_tap); m_txt_gpa.Text = v_us_kq_hoc_tap.dcGPA.ToString(); m_txt_cpa.Text = v_us_kq_hoc_tap.dcCPA.ToString(); load_data_2_grid(); } } catch (Exception) { MessageBox.Show("Đã xảy ra lỗi trong hệ thống!"); } }
private void m_cmd_tim_kiem_Click(object sender, EventArgs e) { try { if (tim_kiem_sinh_vien()) { US_V_DM_SINH_VIEN v_us_sinh_vien = new US_V_DM_SINH_VIEN(m_dc_id_sinh_vien); m_txt_lop_sinh_vien.Text = v_us_sinh_vien.strLOP_SINH_VIEN; m_txt_ho_ten_sinh_vien.Text = v_us_sinh_vien.strTEN_SINH_VIEN; m_txt_khoa_hoc.Text = v_us_sinh_vien.strKHOA; m_txt_khoa_vien.Text = v_us_sinh_vien.strTEN_KHOA_VIEN; m_dat_ngay_sinh.Value = v_us_sinh_vien.datNGAY_SINH; m_txt_que_quan.Text = v_us_sinh_vien.strQUE_QUAN; m_txt_trang_thai.Text = v_us_sinh_vien.strTEN_TRANG_THAI; m_txt_so_dien_thoai.Text = v_us_sinh_vien.strSDT; if (v_us_sinh_vien.strGIOI_TINH == "N") { m_rdb_nam.Checked = true; } else m_rdb_nu.Checked = false; if (tim_kiem_diem_sinh_vien()) { m_txt_gpa.Text = ""; m_txt_cpa.Text = ""; US_KET_QUA_HOC_TAP v_us_kq_hoc_tap = new US_KET_QUA_HOC_TAP(m_dc_id_ket_qua_hoc_tap); m_txt_gpa.Text = v_us_kq_hoc_tap.dcGPA.ToString(); m_txt_cpa.Text = v_us_kq_hoc_tap.dcCPA.ToString(); } load_data_2_grid(); } } catch { MessageBox.Show("Đã xảy ra lỗi trong hệ thống!"); } }
private void m_cmd_xoa_Click(object sender, EventArgs e) { try { for (int i = 0; i < m_grv_ket_qua.RowCount; i++) { US_KET_QUA_HOC_TAP v_us = new US_KET_QUA_HOC_TAP(CIPConvert.ToDecimal(m_grv_ket_qua.GetDataRow(i)["ID"].ToString())); v_us.Delete(); load_data_2_grid(CIPConvert.ToDecimal(m_cbo_lop_sinh_vien.SelectedValue.ToString())); MessageBox.Show("Xóa thành công!"); } } catch { MessageBox.Show("Đã xảy ra lỗi trong hệ thống!"); } }
private void m_cmd_ket_qua_Click(object sender, EventArgs e) { try { US_DUNG_CHUNG v_us = new US_DUNG_CHUNG(); DataSet v_ds = new DataSet(); v_ds.Tables.Add(new DataTable()); string v_str_query; if (CIPConvert.ToDecimal(m_cbo_lop_sinh_vien.SelectedValue.ToString()) > -1) v_str_query = "SELECT DISTINCT ID_SINH_VIEN FROM V_DIEM_THI WHERE ID_HOC_KY = " + m_cbo_hoc_ky.SelectedValue.ToString() + "AND ID_LOP_SINH_VIEN =" + m_cbo_lop_sinh_vien.SelectedValue.ToString(); else { if (CIPConvert.ToDecimal(m_cbo_khoa.SelectedValue.ToString()) > -1 && CIPConvert.ToDecimal(m_cbo_khoa_vien.SelectedValue.ToString()) > -1) v_str_query = "SELECT DISTINCT ID_SINH_VIEN FROM V_DIEM_THI WHERE ID_HOC_KY = " + m_cbo_hoc_ky.SelectedValue.ToString() + " AND ID_KHOA = " + m_cbo_khoa.SelectedValue.ToString() + "AND ID_KHOA_VIEN = " + m_cbo_khoa_vien.SelectedValue.ToString(); else if (CIPConvert.ToDecimal(m_cbo_khoa.SelectedValue.ToString()) == -1 && CIPConvert.ToDecimal(m_cbo_khoa_vien.SelectedValue.ToString()) > -1) v_str_query = "SELECT DISTINCT ID_SINH_VIEN FROM V_DIEM_THI WHERE ID_HOC_KY = " + m_cbo_hoc_ky.SelectedValue.ToString() + "AND ID_KHOA_VIEN = " + m_cbo_khoa_vien.SelectedValue.ToString(); else if (CIPConvert.ToDecimal(m_cbo_khoa.SelectedValue.ToString()) > -1 && CIPConvert.ToDecimal(m_cbo_khoa_vien.SelectedValue.ToString()) == -1) v_str_query = "SELECT DISTINCT ID_SINH_VIEN FROM V_DIEM_THI WHERE ID_HOC_KY = " + m_cbo_hoc_ky.SelectedValue.ToString() + "AND ID_KHOA = " + m_cbo_khoa.SelectedValue.ToString(); else v_str_query = "SELECT DISTINCT ID_SINH_VIEN FROM V_DIEM_THI WHERE ID_HOC_KY = " + m_cbo_hoc_ky.SelectedValue.ToString(); } v_us.FillDatasetWithQuery(v_ds, v_str_query); for (int i = 0; i < v_ds.Tables[0].Rows.Count; i++) { //kiểm tra xem có hay không để trọn insert hoặc update US_DUNG_CHUNG v_us_check = new US_DUNG_CHUNG(); DataSet v_ds_check = new DataSet(); v_ds_check.Tables.Add(new DataTable()); string v_str_query_test = "SELECT ID FROM V_KET_QUA_HOC_TAP WHERE ID_HOC_KY = " + m_cbo_hoc_ky.SelectedValue.ToString() + "AND ID_SINH_VIEN = " + v_ds.Tables[0].Rows[i]["ID_SINH_VIEN"].ToString(); v_us_check.FillDatasetWithQuery(v_ds_check, v_str_query_test); if (v_ds_check.Tables[0].Rows.Count == 0) { US_KET_QUA_HOC_TAP v_us_ket_qua_hoc_tap = new US_KET_QUA_HOC_TAP(); v_us_ket_qua_hoc_tap.dcID_HOC_KY = CIPConvert.ToDecimal(m_cbo_hoc_ky.SelectedValue.ToString()); v_us_ket_qua_hoc_tap.dcID_SINH_VIEN = CIPConvert.ToDecimal(v_ds.Tables[0].Rows[i]["ID_SINH_VIEN"].ToString()); v_us_ket_qua_hoc_tap.dcGPA = User.GetGPA(v_us_ket_qua_hoc_tap.dcID_SINH_VIEN, v_us_ket_qua_hoc_tap.dcID_HOC_KY); v_us_ket_qua_hoc_tap.dcCPA = User.GetCPA(v_us_ket_qua_hoc_tap.dcID_SINH_VIEN, v_us_ket_qua_hoc_tap.dcID_HOC_KY); v_us_ket_qua_hoc_tap.Insert(); } else { US_KET_QUA_HOC_TAP v_us_ket_qua_hoc_tap = new US_KET_QUA_HOC_TAP(CIPConvert.ToDecimal(v_ds_check.Tables[0].Rows[0]["ID"].ToString())); v_us_ket_qua_hoc_tap.dcID_HOC_KY = CIPConvert.ToDecimal(m_cbo_hoc_ky.SelectedValue.ToString()); v_us_ket_qua_hoc_tap.dcID_SINH_VIEN = CIPConvert.ToDecimal(v_ds.Tables[0].Rows[i]["ID_SINH_VIEN"].ToString()); v_us_ket_qua_hoc_tap.dcGPA = User.GetGPA(v_us_ket_qua_hoc_tap.dcID_SINH_VIEN, v_us_ket_qua_hoc_tap.dcID_HOC_KY); v_us_ket_qua_hoc_tap.dcCPA = User.GetCPA(v_us_ket_qua_hoc_tap.dcID_SINH_VIEN, v_us_ket_qua_hoc_tap.dcID_HOC_KY); v_us_ket_qua_hoc_tap.Update(); } } MessageBox.Show("Thành công!"); load_data_2_grid(CIPConvert.ToDecimal(m_cbo_lop_sinh_vien.SelectedValue.ToString())); } catch { MessageBox.Show("Đã xảy ra lỗi trong hệ thống!"); } }