Beispiel #1
0
    public List <TreeItem> GetAllManagerDepartmentTreeByMelliCode(string code)
    {
        try
        {
            BDepartment DepartmentBusiness = new BDepartment();
            BPerson     PersonBusinesss    = new BPerson();
            BManager    ManagerBusiness    = new BManager();

            var person = PersonBusinesss.GetByBarcode(code);
            if (person == null)
            {
                return(new List <TreeItem>());
            }

            decimal managerPersonId = person.ID;

            var manager = ManagerBusiness.GetManager(managerPersonId);
            IList <Department> departments = DepartmentBusiness.GetAllManagerDepartmentTree_JustOrgan(manager.ID);

            var result = departments.Select(c => new TreeItem()
            {
                id = (Int32)c.ID, parent = c.ParentID.ToString(), text = c.Name
            }).ToList();
            result[0].parent = "#";
            return(result);
        }
        catch (UIValidationExceptions ex)
        {
            this.exceptionHandler.ApiHandleException("ProfileServiceProvider", ex);
            throw ex;
        }
        catch (Exception ex)
        {
            this.exceptionHandler.ApiHandleException("ProfileServiceProvider", ex);
            throw ex;
        }
    }