/// <summary> /// 根据ID获取组织机构 /// </summary> /// <param name="id"></param> /// <returns></returns> public SysDepartmentsExt GetModel(int id, int pdepid) { SysDepartmentsExt model = _dal.GetExtModel(id); if (model == null) { model = GetNewModel(pdepid); } return(model); }
/// <summary> /// 根据Id获取部门列表 /// </summary> /// <param name="id"></param> /// <returns></returns> public SysDepartmentsExt GetExtModel(int id) { SysDepartmentsExt model = null; var datas = GetExtList(id); if (datas != null && datas.Count > 0) { model = datas[0]; } return(model); }
/// <summary> /// 根据ID查找权限实体信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public SysDepartmentsExt GetDepartment(string id, int pid) { SysDepartmentsExt model = _dal.GetDepById(id); if (model == null) { model = new SysDepartmentsExt(); model.PDepId = pid; model.Type = (short)(pid + 1); var pmodel = FindById(pid); if (pmodel != null) { model.PDepId = pmodel.Id; model.PTitle = pmodel.Title; } } return(model); }
/// <summary> /// 获取新Mode /// </summary> /// <param name="pobjid"></param> /// <returns></returns> private SysDepartmentsExt GetNewModel(int pobjid) { var pmodel = _dal.GetByColumn(pobjid, "DepId"); var model = new SysDepartmentsExt(); if (pmodel != null) { model.PDepId = pmodel.PDepId; model.Type = (short)(pmodel.Type + 1); model.PTitle = pmodel.Title; } else { model.PDepId = 0; model.Type = 1; } return(model); }