BKI_DichVuMatDat.US.US_GD_HE_SO_LNS.KiemTraThoiGianHeSoLNSHopLeForInsert C# (CSharp) Method

KiemTraThoiGianHeSoLNSHopLeForInsert() public method

public KiemTraThoiGianHeSoLNSHopLeForInsert ( 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 KiemTraThoiGianHeSoLNSHopLeForInsert(decimal ip_dc_id_nhan_vien, DateTime ip_dat_tu_ngay, DateTime ip_dat_den_ngay)
        {
            CStoredProc v_cstore = new CStoredProc("pr_HD_du_lieu_hs_lns_hop_le_CheckInsert");
            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_he_so_lns_Insert(DataRow ip_dr)
 {
     //Hợp đồng hợp lệ khi trong một khoảng thời gian chỉ có một hợp đồng
     US_GD_HE_SO_LNS v_us = new US_GD_HE_SO_LNS();
     var v_dc_id_nhan_vien = ExecuteFuntion.LayNhanVienID(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]);
     var v_bool_hop_le = v_us.KiemTraThoiGianHeSoLNSHopLeForInsert(v_dc_id_nhan_vien, v_dat_ngay_bat_dau, v_dat_ngay_ket_thuc);
     if(!v_bool_hop_le)
     {
         XtraMessageBox.Show("Thời gian hiệu lực hệ số LNS của nhân viên " + ip_dr[ExcelLNS.MA_NHAN_VIEN].ToString() + " không hợp lệ " +
                                 "do đã có hiệu lực hệ số LNS khác tồn tại trong khoảng thời gian này!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     return v_bool_hop_le;
 }