/// <summary>
        /// 加载所有列表
        /// </summary>
        private void LoadALLList()
        {
            //调用BLL获取所有的用户列表
            KPS.BLL.UnitManager manager = new BLL.UnitManager();
            RecordList = manager.GetModelList("");

            ReaLoadSpList();//重新加载列表
        }
Пример #2
0
        /// <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.Unit unitinfo=new Model.Unit();
                unitinfo.unitname=textBox1.Text.Trim();
                if (isSelUnit)
                {
                    //调用BLL获取所有的用户列表
                    KPS.BLL.UnitManager manager = new BLL.UnitManager();
                    RecordList = manager.GetModelList(string.Format("unitname  like '%{0}%'", unitinfo.unitname));

                    ReaLoadSpList();//重新加载列表
                }
                else
                {
                    //调用BLL获取所有的用户列表
                    KPS.BLL.UnitManager manager = new BLL.UnitManager();
                    if (manager.Add(unitinfo))
                    {
                        unitinfo.unitid = manager.GetMaxId();
                    }
                    if (unitinfo.unitid != null && unitinfo.unitid != 0)
                    {
                        if (RecordList == null)
                        {
                            RecordList = new List<Model.Unit>();
                        }
                        RecordList.Add(unitinfo);

                        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.Unit unitinfo = new Model.Unit();
                unitinfo.unitname = textBox1.Text.Trim();
                if (isSelUnit)
                {
                    //调用BLL获取所有的用户列表
                    KPS.BLL.UnitManager manager = new BLL.UnitManager();
                    RecordList = manager.GetModelList(string.Format("unitname  like '%{0}%'", unitinfo.unitname));

                    ReaLoadSpList();//重新加载列表
                }
                else
                {
                    //调用BLL获取所有的用户列表
                    KPS.BLL.UnitManager manager = new BLL.UnitManager();
                    if (manager.Add(unitinfo))
                    {
                        unitinfo.unitid = manager.GetMaxId();
                    }
                    if (unitinfo.unitid != null && unitinfo.unitid != 0)
                    {
                        if (RecordList == null)
                        {
                            RecordList = new List <Model.Unit>();
                        }
                        RecordList.Add(unitinfo);

                        ReaLoadSpList();
                        MessageBox.Show("添加成功!");
                    }
                    else
                    {
                        MessageBox.Show("添加失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不可为空!");
            }
        }
Пример #4
0
        /// <summary>
        /// 加载所有列表
        /// </summary>
        private void LoadALLList()
        {
            //调用BLL获取所有的用户列表
            KPS.BLL.UnitManager manager = new BLL.UnitManager();
            RecordList = manager.GetModelList("");

            ReaLoadSpList();//重新加载列表
        }
Пример #5
0
        /// <summary>
        /// 删除项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemDel_Click(object sender, EventArgs e)
        {
            Unit _ItemInfo = null;
            if (this._RecordListView.SelectedObjects != null && this._RecordListView.SelectedObjects.Count > 0)
            {
                _ItemInfo = (Unit)this._RecordListView.SelectedObjects[0];
            }
            else
            {
                MessageBox.Show("请选中项后再试!");
            }

            ConfirmFrm confirm = new ConfirmFrm("提示", "您确定需要删除此选中项?", "确定", "取消", 3);
            if (confirm.ShowDialog() == DialogResult.OK)
            {
                //1.调用bll,从模块对应的权限列表中移除
                UnitManager manager = new UnitManager();
                if (manager.Delete(_ItemInfo.unitid))
                {
                    RecordList.Remove(_ItemInfo);
                    //从列表中移除

                    //2.从列表中移除
                    this._RecordListView.RemoveObject(_ItemInfo);//将原生从列表中移除
                }
                else
                {
                    MessageBox.Show("操作失败!");
                }
            }
        }