BKI_DichVuMatDat.US.US_GD_LUONG_CUNG.KiemTraThoiGianVoiHeSoLNSForInsert C# (CSharp) Method

KiemTraThoiGianVoiHeSoLNSForInsert() public method

public KiemTraThoiGianVoiHeSoLNSForInsert ( 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
return bool
        public bool KiemTraThoiGianVoiHeSoLNSForInsert(decimal ip_dc_id_nhan_vien, DateTime ip_dat_tu_ngay, DateTime ip_dat_den_ngay)
        {
            CStoredProc v_cstore = new CStoredProc("pr_LC_kiem_tra_thoi_gian_hop_le_voi_lns_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 kiem_tra_thoi_gian_hop_le_voi_lns_Insert()
 {
     US_GD_LUONG_CUNG v_us = new US_GD_LUONG_CUNG();
     var v_dat_tu_ngay = m_dat_ngay_bat_dau.DateTime.Date;
     var v_dat_den_ngay = m_dat_ngay_ket_thuc.EditValue == null ? new DateTime(2100, 1, 1).Date : m_dat_ngay_ket_thuc.DateTime.Date;
     if(!v_us.KiemTraThoiGianVoiHeSoLNSForInsert(Convert.ToDecimal(m_sle_chon_nhan_vien.EditValue), v_dat_tu_ngay, v_dat_den_ngay))
     {
         XtraMessageBox.Show("Không thêm lương cứng được vì nhân viên đã có hệ số LNS có hiệu lực trong khoảng thời gian này rồi!","THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return false;
     }
     return true;
 }