private void lbl_ThemTonGiao_Click(object sender, EventArgs e) { UCs.ThemTonGiao oThemTonGiao = new ThemTonGiao("QLNS_ThongTinNV_Phu"); oThemTonGiao.Dock = DockStyle.Fill; Forms.Popup fPopup = new Forms.Popup("Thêm tôn giáo", oThemTonGiao); fPopup.ShowDialog(); if (nNewTonGiaoID > 0) { Label lbl = ((Label)sender); ComboBox com = null; switch (lbl.Name) { case "lbl_ThemTonGiao": com = comb_TonGiao; break; default: break; } int?x = null; if (com.SelectedValue != Convert.DBNull && com.SelectedValue != null) { x = Convert.ToInt16(com.SelectedValue); } dtTonGiao = oTonGiao.GetData(); com.DataSource = dtTonGiao; com.DisplayMember = "ten_ton_giao"; com.ValueMember = "id"; if (x != null) { com.SelectedValue = x; } nNewTonGiaoID = 0; } }
private void lbl_ThemTonGiao_Click(object sender, EventArgs e) { UCs.ThemTonGiao oThemTonGiao = new ThemTonGiao("QLNS_ThongTinNV_Phu"); oThemTonGiao.Dock = DockStyle.Fill; Forms.Popup fPopup = new Forms.Popup("Thêm tôn giáo", oThemTonGiao); fPopup.ShowDialog(); if (nNewTonGiaoID > 0) { Label lbl = ((Label)sender); ComboBox com = null; switch (lbl.Name) { case "lbl_ThemTonGiao": com = comb_TonGiao; break; default: break; } int? x = null; if (com.SelectedValue != Convert.DBNull && com.SelectedValue != null) x = Convert.ToInt16(com.SelectedValue); dtTonGiao = oTonGiao.GetData(); com.DataSource = dtTonGiao; com.DisplayMember = "ten_ton_giao"; com.ValueMember = "id"; if (x != null) { com.SelectedValue = x; } nNewTonGiaoID = 0; } }