private void AddHouseSet() { V_HouseSetCs.Houseid = Clsxtpz.myHouseID; V_HouseSetCs.HouseGui = Convert.ToInt32(txtGuiHao.Text); V_HouseSetCs.HouseCol = Convert.ToInt32(txtLie.Text); V_HouseSetCs.HouseRow = Convert.ToInt32(txtCeng.Text); V_HouseSetCs.Housebox = Convert.ToInt32(txtboxsn.Text); V_HouseSetCs.Housejuan = Convert.ToInt16(txtJuan.Text); int id = 0; if (radio_kfsz_box.Checked) { foreach (ListViewItem item in lsvCabinet.Items) { int CabinetNum = Convert.ToInt32(item.Text.ToString()); if (V_HouseSetCs.HouseGui == CabinetNum) { txtGuiHao.Focus(); MessageBox.Show("柜号已存在"); return; } } id = 0; } else { id = 1; } T_Sysset.HouseSetAdd(id); }