示例#1
0
 private void m_cmd_xoa_Click(object sender, EventArgs e)
 {
     try
     {
         DataRow v_dr = m_grv_diem_thi.GetDataRow(m_grv_diem_thi.FocusedRowHandle);
         if (v_dr != null)
         {
             US_DIEM_THI v_us = new US_DIEM_THI(CIPConvert.ToDecimal(v_dr["ID"].ToString()));
             v_us.Delete();
             MessageBox.Show("xóa thành công!");
             load_data_2_grid();
         }
         else
         {
             MessageBox.Show("chọn 1 dòng để xóa");
         }
     }
     catch
     {
         MessageBox.Show("Đã xảy ra lỗi trong hệ thống!");
     }
 }
示例#2
0
 private void m_cmd_luu_Click(object sender, EventArgs e)
 {
     try
     {
         if (check_du_lieu())
         {
             // kiểm tra xem là update hay insert
             US_DUNG_CHUNG v_us = new US_DUNG_CHUNG();
             DataSet v_ds = new DataSet();
             v_ds.Tables.Add(new DataTable());
             v_us.FillDatasetWithQuery(v_ds, "SELECT ID,ID_SINH_VIEN,ID_LOP_HOC FROM V_DIEM_THI WHERE MA_SINH_VIEN = '" + m_txt_ma_so_sinh_vien.Text + "' AND ID_LOP_HOC =" + m_cbo_ma_lop_hoc.SelectedValue.ToString());
             if (v_ds.Tables[0].Rows.Count == 0)
             {
                 m_bol_isUpdate = false;
             }
             else
                 m_bol_isUpdate = true;
             if (m_bol_isUpdate)
             {
                 US_DIEM_THI v_us_diem_thi = new US_DIEM_THI(CIPConvert.ToDecimal(v_ds.Tables[0].Rows[0]["ID"].ToString()));
                 v_us_diem_thi.dcDIEM_QUA_TRINH = CIPConvert.ToDecimal(m_txt_diem_qua_trinh.Text);
                 v_us_diem_thi.dcID_SINH_VIEN = m_id_sinh_vien;
                 v_us_diem_thi.dcID_LOP_HOC = CIPConvert.ToDecimal(m_cbo_ma_lop_hoc.SelectedValue);
                 v_us_diem_thi.dcDIEM_THI = CIPConvert.ToDecimal(m_txt_diem_thi.Text);
                 v_us_diem_thi.strDIEM_CHU = User.GetDiemChu(v_us_diem_thi.dcDIEM_QUA_TRINH, v_us_diem_thi.dcDIEM_THI, CIPConvert.ToDecimal(CIPConvert.ToDecimal(m_txt_trong_so.Text)));
                 v_us_diem_thi.Update();
                 MessageBox.Show("Cập nhật thành công!");
                 load_data_2_grid();
             }
             else
             {
                 US_DIEM_THI v_us_diem_thi = new US_DIEM_THI();
                 v_us_diem_thi.dcDIEM_QUA_TRINH = CIPConvert.ToDecimal(m_txt_diem_qua_trinh.Text);
                 v_us_diem_thi.dcDIEM_THI = CIPConvert.ToDecimal(m_txt_diem_thi.Text);
                 v_us_diem_thi.dcID_SINH_VIEN = m_id_sinh_vien;
                 v_us_diem_thi.dcID_LOP_HOC = CIPConvert.ToDecimal(m_cbo_ma_lop_hoc.SelectedValue);
                 v_us_diem_thi.strDIEM_CHU = User.GetDiemChu(v_us_diem_thi.dcDIEM_QUA_TRINH, v_us_diem_thi.dcDIEM_THI, CIPConvert.ToDecimal(m_txt_trong_so.Text));
                 v_us_diem_thi.Insert();
                 MessageBox.Show("thêm thành công!");
                 load_data_2_grid();
             }
         }
     }
     catch
     {
         MessageBox.Show("Đã xảy ra lỗi trong hệ thống!");
     }
 }