BKI_DichVuMatDat.US.US_GD_HE_SO_LNS.KiemTraThoiGianVoiLuongCungHopLeForInsert C# (CSharp) Метод

KiemTraThoiGianVoiLuongCungHopLeForInsert() публичный Метод

public KiemTraThoiGianVoiLuongCungHopLeForInsert ( decimal ip_dc_id_nhan_vien, System.DateTime ip_dat_tu_ngay, System.DateTime ip_dat_den_ngay ) : bool
ip_dc_id_nhan_vien decimal
ip_dat_tu_ngay System.DateTime
ip_dat_den_ngay System.DateTime
Результат bool
        public bool KiemTraThoiGianVoiLuongCungHopLeForInsert(decimal ip_dc_id_nhan_vien, DateTime ip_dat_tu_ngay, DateTime ip_dat_den_ngay)
        {
            CStoredProc v_cstore = new CStoredProc("pr_LNS_kiem_tra_thoi_gian_hop_le_voi_luong_cung_ForInsert");
            v_cstore.addDecimalInputParam("@ip_dc_id_nhan_vien", ip_dc_id_nhan_vien);
            v_cstore.addDatetimeInputParam("@ip_dat_tu_ngay", ip_dat_tu_ngay);
            v_cstore.addDatetimeInputParam("@ip_dat_den_ngay", ip_dat_den_ngay);

            SqlParameter v_yn = v_cstore.addNVarcharOutputParam("@op_str_hop_le_yn", "");
            v_cstore.ExecuteCommand(this);

            return v_yn.Value.ToString() == "Y" ? true : false;
        }

Usage Example

 private bool check_thoi_gian_voi_luong_cung_Insert(DataRow ip_dr)
 {
     US_GD_HE_SO_LNS v_us_check = new US_GD_HE_SO_LNS();
     decimal v_dc_id_nhan_vien = find_id_nv_by_ma_nv(ip_dr[ExcelLNS.MA_NHAN_VIEN].ToString());
     var v_dat_ngay_bat_dau = Convert.ToDateTime(ip_dr[ExcelLNS.NGAY_BAT_DAU]).Date;
     var v_dat_ngay_ket_thuc = ip_dr[ExcelLNS.NGAY_KET_THUC] == DBNull.Value ? new DateTime(2100, 01, 01).Date : Convert.ToDateTime(ip_dr[ExcelLNS.NGAY_KET_THUC]);
     if(!v_us_check.KiemTraThoiGianVoiLuongCungHopLeForInsert(v_dc_id_nhan_vien, v_dat_ngay_bat_dau, v_dat_ngay_ket_thuc))
     {
         string v_str_error = "Trong hệ thống, đã tồn tại bản ghi LƯƠNG CỨNG của nhân viên "+ip_dr[ExcelLNS.MA_NHAN_VIEN].ToString()+" có hiệu lực trong khoảng thời gian này rồi!!";
         XtraMessageBox.Show(v_str_error, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
     }
     return true;
 }