//End Department Json

        public string getWhileLoopData()
        {
            DepartmentManager departmentManager = new BusinessModel.DepartmentManager();

            var htmlStr             = new System.Text.StringBuilder();
            List <Department> empty = new List <Department>();

            empty = departmentManager.GetChildItems(departmentManager.Read(null).First().Id, empty);
            htmlStr.Append("<tr><td>");
            htmlStr.Append(departmentManager.Read(null).First().Id);
            htmlStr.Append("</td><td>");
            htmlStr.Append("");
            htmlStr.Append("</td><td>");
            htmlStr.Append(departmentManager.Read(null).First().Name);
            htmlStr.Append("</td></tr>");

            foreach (var item in empty)
            {
                string parent = "";
                if (item.ParentDepartement != null)
                {
                    parent = item.ParentDepartement.Id.ToString();
                }
                Guid   id   = item.Id;
                string name = item.Name;
                htmlStr.Append("<tr><td>");
                htmlStr.Append(id);
                htmlStr.Append("</td><td>");
                htmlStr.Append(parent);
                htmlStr.Append("</td><td>");
                htmlStr.Append(name);
                htmlStr.Append("</td></tr>");
            }
            return(htmlStr.ToString());
        }
示例#2
0
        public static string GetFullDepartmentPath(this Department d)
        {
            try
            {
                DepartmentManager departmentManager = new DepartmentManager();
                StringBuilder     stb = new StringBuilder();

                stb.Append(d.Name);

                foreach (var item in departmentManager.GetParents(d.Id, new List <Department>()))
                {
                    stb.Append(" " + item.Name);
                }
                return(stb.ToString());
            }
            catch
            {
                return("دپارتمان ها");
            }
        }