BKI_DichVuMatDat.NghiepVu.f380_thay_doi_he_so_chat_luong_xls.kiem_tra_va_thuc_hien_nhap_hs C# (CSharp) Method

kiem_tra_va_thuc_hien_nhap_hs() private method

private kiem_tra_va_thuc_hien_nhap_hs ( decimal &v_count, int &v_int_khong_nhap_duoc, decimal v_selectedRowCount ) : void
v_count decimal
v_int_khong_nhap_duoc int
v_selectedRowCount decimal
return void
        private void kiem_tra_va_thuc_hien_nhap_hs(ref decimal v_count, ref int v_int_khong_nhap_duoc, decimal v_selectedRowCount)
        {
            if (CHRMCommon.thang_da_chot_bang_luong(CIPConvert.ToDecimal(m_txt_chon_thang.Text.Trim()), CIPConvert.ToDecimal(m_txt_chon_nam.Text.Trim())))
            {
                CHRM_BaseMessages.MsgBox_Error(CONST_ID_MSGBOX.ERROR_THANG_DA_CHOT_BANG_LUONG);
                return;
            }
            else
            {
                for (int i = 0; i < v_selectedRowCount; i++)
                {
                    decimal v_id_nv = 0;
                    US_DUNG_CHUNG v_us_dc = new US_DUNG_CHUNG();
                    US_GD_HE_SO_CHAT_LUONG v_us_hs_cl = new US_GD_HE_SO_CHAT_LUONG();

                    var v_data_row = m_grv_them_hs.GetDataRow(m_grv_them_hs.GetSelectedRows()[i]);

                    try
                    {
                        get_id_nhan_vien_tu_data_row(v_us_dc, v_data_row, ref v_id_nv);
                    }
                    catch (Exception)
                    {
                        CHRM_BaseMessages.MsgBox_Error("Mã nhân viên " + v_data_row[1].ToString() + " không tồn tại trong hệ thống. Vui lòng kiểm tra lại thông tin!");
                        v_int_khong_nhap_duoc++;
                        continue;
                    }

                    v_us_hs_cl.dcID_NHAN_VIEN = v_id_nv;
                    v_us_hs_cl.dcHE_SO_K = Convert.ToDecimal(v_data_row["HSK"]);
                    v_us_hs_cl.dcTHANG = CIPConvert.ToDecimal(m_txt_chon_thang.Text.Trim());
                    v_us_hs_cl.dcNAM = CIPConvert.ToDecimal(m_txt_chon_nam.Text.Trim());
                    v_us_hs_cl.datNGAY_LAP = DateTime.Now.Date;
                    v_us_hs_cl.strNGUOI_LAP = CAppContext_201.getCurrentUserName();
                    v_us_hs_cl.strDA_XOA = "N";

                    try
                    {
                        delete_gd_da_co_trong_thang_cua_nhan_vien(v_us_dc, v_data_row, v_id_nv);
                        v_us_hs_cl.BeginTransaction();
                        v_us_hs_cl.Insert();
                        v_us_hs_cl.CommitTransaction();
                        v_count++;
                    }
                    catch (Exception)
                    {
                        CHRM_BaseMessages.MsgBox_Error(CONST_ID_MSGBOX.ERROR_DA_CO_LOI_XAY_RA);
                        v_int_khong_nhap_duoc++;
                    }
                }
            }
        }