/// <summary> /// 加载所有列表 /// </summary> private void LoadALLList() { //调用BLL获取所有的用户列表 KPS.BLL.DeviceInfoManager manager = new BLL.DeviceInfoManager(); RecordList = manager.GetModelList(""); ReaLoadSpList();//重新加载列表 }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text.Trim())) { KPS.Model.DeviceInfo _deviceinfo = new Model.DeviceInfo(); _deviceinfo.DeviceType = textBox1.Text.Trim(); if (isSelDevice) { //调用BLL获取所有的仪器类型 KPS.BLL.DeviceInfoManager manager = new BLL.DeviceInfoManager(); RecordList = manager.GetModelList(string.Format("DeviceType like '%{0}%'", _deviceinfo.DeviceType)); ReaLoadSpList();//重新加载列表 } else { //调用BLL获取所有的用户列表 KPS.BLL.DeviceInfoManager manager = new BLL.DeviceInfoManager(); if (manager.Add(_deviceinfo)) { _deviceinfo.DeviceID = manager.GetMaxId(); } if (_deviceinfo.DeviceID != null && _deviceinfo.DeviceID != 0) { if (RecordList == null) { RecordList = new List<Model.DeviceInfo>(); } RecordList.Add(_deviceinfo); ReaLoadSpList(); MessageBox.Show("添加成功!"); } else { MessageBox.Show("添加失败!"); } } } else { MessageBox.Show("名称不可为空!"); } }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text.Trim())) { KPS.Model.DeviceInfo _deviceinfo = new Model.DeviceInfo(); _deviceinfo.DeviceType = textBox1.Text.Trim(); if (isSelDevice) { //调用BLL获取所有的仪器类型 KPS.BLL.DeviceInfoManager manager = new BLL.DeviceInfoManager(); RecordList = manager.GetModelList(string.Format("DeviceType like '%{0}%'", _deviceinfo.DeviceType)); ReaLoadSpList();//重新加载列表 } else { //调用BLL获取所有的用户列表 KPS.BLL.DeviceInfoManager manager = new BLL.DeviceInfoManager(); if (manager.Add(_deviceinfo)) { _deviceinfo.DeviceID = manager.GetMaxId(); } if (_deviceinfo.DeviceID != null && _deviceinfo.DeviceID != 0) { if (RecordList == null) { RecordList = new List <Model.DeviceInfo>(); } RecordList.Add(_deviceinfo); ReaLoadSpList(); MessageBox.Show("添加成功!"); } else { MessageBox.Show("添加失败!"); } } } else { MessageBox.Show("名称不可为空!"); } }