private void btn_Tim_Click(object sender, EventArgs e) { string ma_nv = txt_MaNV.Text == "" ? null : txt_MaNV.Text; string ho_nv = txt_Ho.Text == "" ? null : txt_Ho.Text; string ten_nv = txt_Ten.Text == "" ? null : txt_Ten.Text; string ma_hd = txt_MaHD.Text == "" ? null : txt_MaHD.Text; int?ma_loai_hd = null; if (comB_Loai.Text != "") { ma_loai_hd = Convert.ToInt16(comB_Loai.SelectedValue); } bool?co_thoi_han = null; if (comB_CoThoiHan.Text == "Có thời hạn") { co_thoi_han = true; } else if (comB_CoThoiHan.Text == "Không thời hạn") { co_thoi_han = false; } else { co_thoi_han = null; } DateTime?ngay_ky_tu = null; DateTime?ngay_ky_den = null; if (dTP_TuNgay.Checked == true) { ngay_ky_tu = dTP_TuNgay.Value; ngay_ky_den = dTP_DenNgay.Value; } try { dtDSHopDong = oHopDong.Search_HD(ma_nv, ho_nv, ten_nv, ma_hd, ma_loai_hd, co_thoi_han, ngay_ky_tu, ngay_ky_den); //dtDSHopDong = oHopDong.Search_HD(ma_nv, ma_hd, ma_loai_hd, ngay_ky_tu, ngay_ky_den); if (dtDSHopDong != null) { PrepareDataSource(); EditDtgInterface(); if (dtDSHopDong.Rows.Count != 0) { ResetInterface(true); } else { ResetInterface(false); } } } catch { } }
public void LoadCNVC_HopDong(string p_ma_nv) { //oHopDong.MaNV = p_ma_nv; dtHopDong = oHopDong.Search_HD(p_ma_nv, null, null, null, null, null, null, null); if ((dtHopDong) != null && dtHopDong.Rows.Count > 0) { PrepareDataSource(); EditDtgInterface(); } }
/// <summary> /// Refresh Data Source cho dtg sau moi lan thao tac /// </summary> private void RefreshDataSource() { Business.HDQD.CNVC_HopDong hopdong = new Business.HDQD.CNVC_HopDong(); // khong dung chung oChucVu duoc ??? string ma_nv = txt_MaNV.Text == "" ? null : txt_MaNV.Text; string ho_nv = txt_Ho.Text == "" ? null : txt_Ho.Text; string ten_nv = txt_Ten.Text == "" ? null : txt_Ten.Text; string ma_hd = txt_MaHD.Text == "" ? null : txt_MaHD.Text; int?ma_loai_hd = null; if (comB_Loai.Text != "") { ma_loai_hd = Convert.ToInt16(comB_Loai.SelectedValue); } bool?co_thoi_han = null; if (comB_CoThoiHan.Text == "Có thời hạn") { co_thoi_han = true; } else if (comB_CoThoiHan.Text == "Không thời hạn") { co_thoi_han = false; } else { co_thoi_han = null; } DateTime?ngay_ky_tu = null; DateTime?ngay_ky_den = null; if (dTP_TuNgay.Checked == true) { ngay_ky_tu = dTP_TuNgay.Value; ngay_ky_den = dTP_DenNgay.Value; } dtDSHopDong = hopdong.Search_HD(ma_nv, ho_nv, ten_nv, ma_hd, ma_loai_hd, co_thoi_han, ngay_ky_tu, ngay_ky_den); //dtDSHopDong = hopdong.Search_HD(ma_nv, ma_hd, ma_loai_hd, ngay_ky_tu, ngay_ky_den); PrepareDataSource(); }
/// <summary> /// Refresh Data Source cho dtg sau moi lan thao tac /// </summary> private void RefreshDataSource() { Business.HDQD.CNVC_HopDong hopdong = new Business.HDQD.CNVC_HopDong(); // khong dung chung oChucVu duoc ??? string ma_nv = txt_MaNV.Text == "" ? null : txt_MaNV.Text; string ho_nv = txt_Ho.Text == "" ? null : txt_Ho.Text; string ten_nv = txt_Ten.Text == "" ? null : txt_Ten.Text; string ma_hd = txt_MaHD.Text == "" ? null : txt_MaHD.Text; int? ma_loai_hd = null; if (comB_Loai.Text != "") ma_loai_hd = Convert.ToInt16(comB_Loai.SelectedValue); bool? co_thoi_han = null; if (comB_CoThoiHan.Text == "Có thời hạn") co_thoi_han = true; else if (comB_CoThoiHan.Text == "Không thời hạn") co_thoi_han = false; else co_thoi_han = null; DateTime? ngay_ky_tu = null; DateTime? ngay_ky_den = null; if (dTP_TuNgay.Checked == true) { ngay_ky_tu = dTP_TuNgay.Value; ngay_ky_den = dTP_DenNgay.Value; } dtDSHopDong = hopdong.Search_HD(ma_nv, ho_nv, ten_nv, ma_hd, ma_loai_hd, co_thoi_han, ngay_ky_tu, ngay_ky_den); //dtDSHopDong = hopdong.Search_HD(ma_nv, ma_hd, ma_loai_hd, ngay_ky_tu, ngay_ky_den); PrepareDataSource(); }