Exemple #1
0
        /// <summary>
        /// 绑定下拉列表的值
        /// </summary>
        private void DropDown(int?dept, int?position)
        {
            DepartmentData deptdb = new DepartmentData();

            ViewData["DeptId"] = new SelectList(deptdb.GetAllDepart(), "DeptId", "DeptName", dept);
            PositionData positiondb = new PositionData();

            ViewData["PositionId"] = new SelectList(positiondb.GetAllPosition(), "PositionId", "PosName", position);
        }
Exemple #2
0
        /// <summary>
        ///获取当前部门的可用父级部门
        /// </summary>
        /// <param name="id">当前部门的ID</param>
        /// <returns>JSon数据</returns>
        public JsonResult DropDownParent(string id)
        {
            List <Dept> dropList;

            if (id == null || id == "" || id == "null")
            {
                dropList = db.GetAllDepart();
            }
            else
            {
                dropList = db.GetParentDept(int.Parse(id));
            }
            var strResult = "{\"DropList\":" + dropList.ToJsonString() + "}";

            return(Json(strResult, JsonRequestBehavior.AllowGet));
        }