private void btnXoa_Click(object sender, EventArgs e)
 {
     if (ThongBaoChon("Bạn có chắc muốn xóa những cán bộ đã chọn trong quyết định nâng bậc - chuyển ngạch này.") == DialogResult.Yes)
     {
         if (Them == true)
         {
             for (int i = 0; i < dtNangBacChuyenNgach.Rows.Count; i++)
             {
                 if (bool.Parse(dtNangBacChuyenNgach.Rows[i]["Chon"].ToString()) == true)
                 {
                     DataRow dr = dtNangBacChuyenNgach.Rows[i];
                     dtNangBacChuyenNgach.Rows.Remove(dr);
                     i = -1;
                 }
             }
         }
         if (Sua == true)
         {
             for (int i = 0; i < dtNangBacChuyenNgach.Rows.Count; i++)
             {
                 if (bool.Parse(dtNangBacChuyenNgach.Rows[i]["Chon"].ToString()) == true)
                 {
                     pNS_LuongInfo.NS_LuongID = int.Parse("0" + dtNangBacChuyenNgach.Rows[i]["NS_LuongID"]);
                     oBLuong.Delete(pNS_LuongInfo);
                     DataRow dr = dtNangBacChuyenNgach.Rows[i];
                     dtNangBacChuyenNgach.Rows.Remove(dr);
                     i = -1;
                 }
             }
         }
     }
 }
Esempio n. 2
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (ThongBaoChon("Bạn có chắc chắn xóa?") == DialogResult.Yes)
     {
         try
         {
             pNS_LuongInfo.NS_LuongID = int.Parse(drLuong[pNS_LuongInfo.strNS_LuongID].ToString());
             oBLuong.Delete(pNS_LuongInfo);
             int NS_SoQuyetDinhID = int.Parse("0" + grvLuong.GetDataRow(grvLuong.FocusedRowHandle)[pSoQuyetDinhInfo.strNS_SoQuyetDinhID].ToString());
             pNS_LuongInfo.NS_LuongID = 0;
             DataTable dt    = oBLuong.Get(pNS_LuongInfo);
             DataRow[] arrDr = dt.Select("IDNS_SoQuyetDinh = " + NS_SoQuyetDinhID);
             if (arrDr.Length == 0)
             {
                 pSoQuyetDinhInfo.NS_SoQuyetDinhID = NS_SoQuyetDinhID;
                 oBSoQuyetDinh.Delete(pSoQuyetDinhInfo);
             }
             // ghi log
             GhiLog("Xóa lương giáo viên '" + drGiaoVien[pGiaoVienInfo.strHoTen] + " bậc lương " + pNS_LuongInfo.BacLuong + "' khỏi CSDL ", "Xóa", this.Tag.ToString());
             dtLuong.Rows.Remove(drLuong);
             if (grvLuong.DataRowCount > 0)
             {
                 SetTextMain();
             }
             else
             {
                 ClearText();
             }
             XoaThanhCong();
         }
         catch
         {
             XoaThatBai();
         }
     }
 }