Exemplo n.º 1
0
        public ActionResult Edit(CasDepartmentEntity entity, string id)
        {
            string strError = "";

            if (!IsPost)
            {
                entity          = SystemService.DepartmentService.CreateDepartmentDomain().CasDepartmentEntity;
                entity.DeptType = 2;
                if (!string.IsNullOrEmpty(id))
                {
                    entity           = SystemService.DepartmentService.GetById <CasDepartmentEntity>(id);
                    ViewBag.EditType = "0";//编辑
                }
                else
                {
                    ViewBag.EditType = "1";//新增
                }
                //Dictionary<string, string> dicDeptManager = new Dictionary<string, string>();

                //List<CasUserEntity> listAllUsers = SystemService.DepartmentService.GetAllUsers();
                //if (listAllUsers.Count > 0)
                //{
                //    dicDeptManager = listAllUsers.ToDictionary(x => x.UserId, x => x.ChineseName);
                //}

                //ViewBag.DeptManagerDic = dicDeptManager;
            }
            else
            {
                entity.DeptManagerId = entity.DeptManagerId != "0" ? entity.DeptManagerId : "";
                var domian = SystemService.DepartmentService.CreateDepartmentDomain();
                domian.CasDepartmentEntity = entity;
                if (SystemService.DepartmentService.Save(domian, ref strError))
                {
                    return(Json(AjaxResult.Success()));
                }
                else
                {
                    return(Json(AjaxResult.Error(strError)));
                }
            }
            ViewBag.strError = strError;
            return(View(entity));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建领域对象
        /// </summary>
        /// <returns></returns>
        public virtual CasDepartmentDomain CreateDepartmentDomain()
        {
            CasDepartmentEntity departmentEntity = new CasDepartmentEntity();

            return(new CasDepartmentDomain(departmentEntity));
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="CasDepartmentEntity">部门实体</param>
 public CasDepartmentDomain(CasDepartmentEntity CasDepartmentEntity)
     : base(CasDepartmentEntity)
 {
 }