예제 #1
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (dgvThemLoaiKyThi.Rows.Count > 0)
     {
         for (int i = 0; i < dgvThemLoaiKyThi.Rows.Count; i++)
         {
             _objloaikythi = new LoaiKyThi(_objloaikythibus.NextID(),
                                           dgvThemLoaiKyThi.Rows[i].Cells[1].Value.ToString());
             if (_objloaikythibus.AddLoaiKyThi(_objloaikythi))
             {
                 dgvThemLoaiKyThi.Rows.Remove(dgvThemLoaiKyThi.Rows[i]);
                 i--;
                 LoadData();
                 resetbox();
             }
             else
             {
                 string a = dgvThemLoaiKyThi.Rows[i].Cells[0].Value.ToString();
                 MessageBox.Show("Lưu dòng " + a + " thất bại");
             }
         }
     }
     else
     {
         MessageBox.Show("Không có dữ liệu để lưu ! ", "Thống báo ", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     if (dgvDSLoaiKyThi.RowCount > 0)
     {
         if (txtTenLoaiKyThi.Text == "")
         {
             MessageBox.Show("Bạn còn số liệu chưa nhập ");
             return;
         }
         _objloaikythi = new LoaiKyThi(dgvDSLoaiKyThi.CurrentRow.Cells[0].Value.ToString(),
                                       txtTenLoaiKyThi.Text);
         if (_objloaikythibus.EditLoaiKyThi(_objloaikythi))
         {
             MessageBox.Show("Sửa Thành Công!!!");
             LoadData();
             txtTenLoaiKyThi.Text = "";
         }
         else
         {
             MessageBox.Show("Sửa Thất Bại!!!");
         }
     }
     else
     {
         MessageBox.Show("Không Có Thông Tin Để Sửa");
     }
 }
예제 #3
0
 public bool EditLoaiKyThi(LoaiKyThi lkt)
 {
     try
     {
         if (conn.State != ConnectionState.Open)
         {
             conn.Open();
         }
         SqlCommand cmd = new SqlCommand("LoaiKyThi_Edit", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@MaLoaiKyThi", SqlDbType.VarChar).Value   = lkt._maloaikythi;
         cmd.Parameters.Add("@TenLoaiKyThi", SqlDbType.NVarChar).Value = lkt._tenloaikythi;
         cmd.ExecuteNonQuery();
         conn.Close();
         return(true);
     }
     catch (Exception e)
     {
         conn.Close();
         return(false);
     }
 }
예제 #4
0
 public bool EditLoaiKyThi(LoaiKyThi lkt)
 {
     return(objLoaiKyThi.EditLoaiKyThi(lkt));
 }
예제 #5
0
 public bool AddLoaiKyThi(LoaiKyThi lkt)
 {
     return(objLoaiKyThi.AddLoaiKyThi(lkt));
 }