private void 除病房ToolStripMenuItem_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { PromptingForm p = new PromptingForm("请选择要删除的病房"); p.ShowDialog(); return; } int num = 0; List <sickroom> sic = new List <sickroom>(); for (int i = 0; i < listView1.Items.Count; i++) { //判断此行是否被选中 if (listView1.Items[i].Selected) { num++; sickroom s = new sickroom(); s.Idsickroom = int.Parse(listView1.Items[i].SubItems[0].Text + ""); sic.Add(s); } } string str = new IdCard_BLL().Delete(sic); if (str == "1") { PromptingForm prom = new PromptingForm("删除 " + num + "个病房成功"); InHospitalForm_Load(null, null); listView2.Items.Clear(); prom.ShowDialog(); } }
public List <sickroom> sickroom_select() { List <sickroom> ssic = new List <sickroom>(); SqlDataReader reader = DBHelper.SectionRoomSelect("p_sickroom_select"); while (reader.Read()) { sickroom sic = new sickroom(); sic.Idsickroom = int.Parse(reader[0] + ""); sic.Tyep = reader[2] + ""; sic.Sid = int.Parse(reader[1] + ""); sic.Price = int.Parse(reader[3] + ""); ssic.Add(sic); } DBHelper.con.Close(); DBHelper.con.Dispose(); DBHelper.cmd.Dispose(); return(ssic); }
private void button1_Click(object sender, EventArgs e) { foreach (Control item in groupBox1.Controls) { if (checkBox1.Checked) { if (item.Text == "" && item.Name != "txtnum") { PromptingForm frmPrompting = new PromptingForm("请输入完整!"); frmPrompting.ShowDialog(); return; } } else { if (item.Name == "txtlou1" || item.Name == "txtlou2" || item.Name == "txtfang1" || item.Name == "txtfang2") { break; } if (item.Text == "") { PromptingForm frmPrompting = new PromptingForm("请输入完整!"); frmPrompting.ShowDialog(); return; } } } List <sickroom> sics = new List <sickroom>();//要添加的病房放到sics集合中 if (checkBox1.Checked) { for (int i = int.Parse(txtlou1.Text); i <= int.Parse(txtlou2.Text); i++) { for (int j = int.Parse(txtfang1.Text); j <= int.Parse(txtfang2.Text); j++) { sickroom sic = new sickroom(); if (j > 9) { sic.Idsickroom = int.Parse("" + i + j); } else { sic.Idsickroom = int.Parse("" + i + 0 + j); } sic.Sid = cboKeshi.SelectedIndex; sic.Tyep = cboType.Text; sic.Price = int.Parse(txtPrice.Text); sics.Add(sic); } } } else { sickroom sic = new sickroom(); sic.Idsickroom = int.Parse(txtnum.Text); sic.Sid = cboKeshi.SelectedIndex; sic.Tyep = cboType.Text; sic.Price = int.Parse(txtPrice.Text); sics.Add(sic); } int num = int.Parse(txtBFnum.Text); string str = new IdCard_BLL().sickroom(sics, num); PromptingForm prop = new PromptingForm(str); prop.ShowDialog(); }