/// <summary> /// /// </summary> /// <param name="currentUserId"></param> /// <param name="currentDeptId"></param> /// <param name="chineseName"></param> /// <param name="showcurrdept">是否只显示当前科室床位</param> public FrmInsertNewBed(long currentUserId, long currentDeptId, string chineseName, bool showcurrdept) { InitializeComponent(); _currentUser = new User(currentUserId); _currentDept = new Deptment(currentDeptId); this.Text = chineseName; dt = op_bed.getAllBedInfo(_currentDept.DeptID); dataGridViewEx1.DataSource = dt; cmbDeptName.DisplayMember = "name"; cmbDeptName.ValueMember = "code"; currdeptonly = showcurrdept; cmbDeptName.DataSource = op_bed.getdept(); label3.Visible = textBox3.Visible = false;//TODO:屏蔽房间号 dataGridViewEx1.Columns["Column1"].Visible = label1.Visible = cmbDeptName.Visible = !currdeptonly; InitListView(_currentDept.DeptID); cmbDeptName.SelectedValue = _currentDept.DeptID; InitGroupBox2(_currentDept.DeptID); }
/// <summary> /// /// <summary> /// 添加床位操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btninsertbed_Click(object sender, EventArgs e) { OP_Bed op_bed = new OP_Bed(); bool insertResult; HIS.Model.ZY_NURSE_BED bedlist = new HIS.Model.ZY_NURSE_BED(); if (chkaddbed.Checked == false) { bedlist.BED_NO = queryTextBox1.Text; } else { bedlist.BED_NO = "加" + queryTextBox1.Text; } //如果只显示当前科室 if (currdeptonly) { bedlist.DEPT_ID = Convert.ToInt32(_currentDept.DeptID); } else { bedlist.DEPT_ID = Convert.ToInt32(cmbDeptName.SelectedValue.ToString()); } bedlist.ROOM_NO = textBox3.Text; if (bedlist.BED_NO == "") { MessageBox.Show("床号不能为空,请输入床号!", "提示", MessageBoxButtons.OK); return; } else { insertResult = op_bed.insertNewBed(bedlist); } if (insertResult == true) { MessageBox.Show("添加床位成功", "提示", MessageBoxButtons.OK); dataGridViewEx1.DataSource = op_bed.getAllBedInfo(_currentDept.DeptID); InitListView(Convert.ToInt64(cmbDeptName.SelectedValue.ToString())); InitGroupBox2(Convert.ToInt64(cmbDeptName.SelectedValue.ToString())); } else { MessageBox.Show("该床位已经存在,请重新输入床位号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }