Пример #1
0
 private void SetParttimeJobs(EmployeeOutput s, EmployeeDetailVm d)
 {
     d.ParttimeJobs = new List <ParttimeJobListVm>();
     foreach (var posId in s.ParttimePositionIds)
     {
         if (_positionListCache.ContainsKey(posId))
         {
             var pos = _positionListCache[posId];
             var vm  = new ParttimeJobListVm();
             vm.PositionName    = pos.Name;
             vm.DepartmentNames = new List <string>();
             //最多设置两级部门名称
             if (_departmentListCache.ContainsKey(pos.DepartmentId))
             {
                 var dep = _departmentListCache[pos.DepartmentId];
                 vm.DepartmentNames.Add(dep.Name);
                 if (dep.ParentId.HasValue && _departmentListCache.ContainsKey(dep.ParentId.Value))
                 {
                     vm.DepartmentNames.Add(_departmentListCache[dep.ParentId.Value].Name);
                 }
             }
             d.ParttimeJobs.Add(vm);
         }
     }
 }
Пример #2
0
 //返回完整层级
 private void SetDepartmentNames(EmployeeOutput s, EmployeeDetailVm d)
 {
     d.DepartmentNames = new List <string>();
     if (_departmentListCache.ContainsKey(s.PrimaryDepartmentId))
     {
         var item = _departmentListCache[s.PrimaryDepartmentId];
         d.DepartmentNames.Add(item.Name);
         while (item.ParentId.HasValue && _departmentListCache.ContainsKey(item.ParentId.Value))
         {
             var sub = _departmentListCache[item.ParentId.Value];
             d.DepartmentNames.Add(sub.Name);
             item = sub;
         }
     }
 }
 public IHttpActionResult Post(EmployeeDetailVm employees)
 {