private bool check_loai_hd_dang_su_dung(decimal ip_id_loai_hd) { US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); v_us.FillDataset(v_ds, "where id_loai_hop_dong =" + ip_id_loai_hd); if (v_ds.Tables[0].Rows.Count == 0) return false; return true; }
private bool check_hd_dang_su_dung(decimal ip_id_chuc_vu) { US_GD_HOP_DONG v_us_hd = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds_hd = new DS_GD_HOP_DONG(); v_us_hd.FillDataset(v_ds_hd, "where id_chuc_vu =" + ip_id_chuc_vu); if (v_ds_hd.Tables[0].Rows.Count == 0) { return false; } else return true; }
private decimal find_id_hop_by_ma_hop_dong(string ip_str_ma_nv) { US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); v_us.FillDataset(v_ds); string v_str_filter = "MA_HOP_DONG = '" + ip_str_ma_nv + "'"; DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter); if (v_dr.Count() == 0) { return -1; } else { return CIPConvert.ToDecimal(v_dr.First()["ID"].ToString()); } }
private bool check_ma_hd_da_ton_tai(string ip_str_ma_hd) { if (m_us_gd_hd.strMA_HOP_DONG != ip_str_ma_hd) { US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); v_us.FillDataset(v_ds, "where MA_HOP_DONG = '" + ip_str_ma_hd + "'"); if (v_ds.Tables[0].Rows.Count != 0) return true; } return false; }
private DataTable load_data_to_ma_hd() { US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds_hd = new DS_GD_HOP_DONG(); v_us.FillDataset(v_ds_hd); return v_ds_hd.Tables[0]; }
//Insert, update, delete private decimal find_id_hd(decimal ip_dc_id_nv) { US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); v_us.FillDataset(v_ds); string v_str_filter = "ID_NHAN_VIEN = " + ip_dc_id_nv + " AND DA_XOA = 'N'"; DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter); if (v_dr.Count() == 0) { return -1; } else { return CIPConvert.ToDecimal(v_dr.First()["ID"].ToString()); } }
private decimal find_id_loai_hop_dong_cua_nhan_vien(decimal ip_dc_id_gd_hd) { US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); v_us.FillDataset(v_ds); string v_str_filter = "ID = " + ip_dc_id_gd_hd + " AND DA_XOA = 'N'"; DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter); if (v_dr.Count() == 0) { return -1; } else { return CIPConvert.ToDecimal(v_dr.First()["ID_LOAI_HOP_DONG"].ToString()); } }
//check validate data private bool check_ma_hd() { DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); v_us.FillDataset(v_ds); string v_str_filter = ""; v_str_filter = "MA_HOP_DONG = '" + m_txt_ma_hd.Text + "'"; DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter); if (v_dr.Count() != 0) { m_txt_ma_hd.BackColor = Color.Bisque; // m_lbl_kiem_tra_ma_hd.Visible = true; // m_lbl_kiem_tra_ma_hd.Text = "Đã có mã này rồi..."; MessageBox.Show("Đã có mã này rồi!"); return true; } else { m_txt_ma_hd.BackColor = Color.White; // m_lbl_kiem_tra_ma_hd.Visible = false; return false; } }
private decimal find_id_gd_hop_dong_by_id_nhan_vien(decimal ip_dc_id_nv) { try { US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); v_us.FillDataset(v_ds); string v_str_filter = "ID_NHAN_VIEN = " + ip_dc_id_nv + " AND DA_XOA = 'N'"; DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter); if (v_dr.Count() == 0) { return -1; } else { return CIPConvert.ToDecimal(v_dr.First()["ID"].ToString()); } } catch (Exception v_e) { throw v_e; } }