Exemplo n.º 1
0
        //部门
        private void lbHYList_BM()
        {
            HY_BLL.HY_DepartmentBLL hydep = new HY_DepartmentBLL();
            string sql = "select * from HY_Department";

            this.lbHY.DataSource    = hydep.ExecuteQuery(sql);
            this.lbHY.DisplayMember = "d_Name";
            this.lbHY.ValueMember   = "d_ID";
        }
Exemplo n.º 2
0
        private void B_DEL_Click(object sender, EventArgs e)
        {
            //实例化部门实体类
            HY_Model.HY_Department del = new HY_Model.HY_Department();
            del.D_ID = int.Parse(this.lbHY.SelectedValue.ToString());//选择部门项值

            HY_BLL.HY_DepartmentBLL hydep = new HY_DepartmentBLL();
            int res = hydep.del_Department(del);

            if (res > 0)
            {
                MessageBoxEx.Show("提示:成功删除部门!");
                lbHYList_BM();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加部门类别信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dnADD_Click(object sender, EventArgs e)
        {
            string dName = this.d_Name.Text.Trim();

            if (dName == string.Empty)
            {
                MessageBox.Show("部门名称不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.d_Name.Focus();
                return;
            }
            //实例化部门实体类
            HY_Model.HY_Department d = new HY_Model.HY_Department();
            d.D_Name = this.d_Name.Text.Trim();

            //执行操作
            HY_BLL.HY_DepartmentBLL hydep = new HY_DepartmentBLL();
            int res = hydep.com_Department(d);

            if (res > 0)
            {
                MessageBox.Show("添加成功!");
                lbHYList_BM();
            }
        }