public string GetItemHtml(EDepartmentLoadingType loadingType, NameValueCollection additional, bool isOpen) { var htmlBuilder = new StringBuilder(); var parentsCount = _departmentInfo.ParentsCount; if (loadingType == EDepartmentLoadingType.AdministratorTree || loadingType == EDepartmentLoadingType.DepartmentSelect || loadingType == EDepartmentLoadingType.ContentTree) { parentsCount = parentsCount + 1; } for (var i = 0; i < parentsCount; i++) { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />"); } if (_departmentInfo.ChildrenCount > 0) { if (isOpen) { htmlBuilder.Append( $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""false"" isOpen=""true"" id=""{_departmentInfo .DepartmentId}"" src=""{_iconMinusUrl}"" />"); } else { htmlBuilder.Append( $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_departmentInfo .DepartmentId}"" src=""{_iconPlusUrl}"" />"); } } else { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />"); } if (!string.IsNullOrEmpty(_iconFolderUrl)) { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconFolderUrl}"" />"); } htmlBuilder.Append(" "); if (loadingType == EDepartmentLoadingType.AdministratorTree) { var linkUrl = PageAdministrator.GetRedirectUrl(_departmentInfo.DepartmentId); htmlBuilder.Append( $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='department'>{_departmentInfo.DepartmentName}</a>"); } else if (loadingType == EDepartmentLoadingType.DepartmentSelect) { var linkUrl = PageUtils.AddQueryString(additional["UrlFormatString"], new NameValueCollection { { "DepartmentId", _departmentInfo.DepartmentId.ToString() } }); htmlBuilder.Append($"<a href='{linkUrl}'>{_departmentInfo.DepartmentName}</a>"); } else if (loadingType == EDepartmentLoadingType.ContentTree) { var linkUrl = PageGovPublicContent.GetRedirectUrl(TranslateUtils.ToInt(additional["PublishmentSystemID"]), _departmentInfo.DepartmentId); htmlBuilder.Append( $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_departmentInfo.DepartmentName}</a>"); } else { htmlBuilder.Append(_departmentInfo.DepartmentName); } if (loadingType == EDepartmentLoadingType.AdministratorTree) { if (_departmentInfo.CountOfAdmin >= 0) { htmlBuilder.Append(" "); htmlBuilder.Append( $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_departmentInfo.CountOfAdmin})</span>"); } } htmlBuilder.Replace("displayChildren", "displayChildren_Department"); return(htmlBuilder.ToString()); }
public string GetItemHtml(EGovPublicCategoryLoadingType loadingType) { var htmlBuilder = new StringBuilder(); var parentsCount = _categoryInfo.ParentsCount; if (loadingType == EGovPublicCategoryLoadingType.Tree || loadingType == EGovPublicCategoryLoadingType.Select) { parentsCount = parentsCount + 1; } for (var i = 0; i < parentsCount; i++) { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />"); } if (_categoryInfo.ChildrenCount > 0) { htmlBuilder.Append( $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_categoryInfo .CategoryID}"" src=""{_iconPlusUrl}"" />"); } else { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />"); } if (!string.IsNullOrEmpty(_iconFolderUrl)) { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconFolderUrl}"" />"); } htmlBuilder.Append(" "); if (_enabled) { if (loadingType == EGovPublicCategoryLoadingType.Tree) { var linkUrl = PageGovPublicContent.GetRedirectUrl(_categoryInfo.PublishmentSystemID, _categoryInfo.ClassCode, _categoryInfo.CategoryID); htmlBuilder.Append( $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_categoryInfo.CategoryName}</a>"); } else if (loadingType == EGovPublicCategoryLoadingType.Select) { htmlBuilder.Append($@"<a href=""{ModalGovPublicCategorySelect.GetRedirectUrl(_categoryInfo.PublishmentSystemID, _categoryInfo.ClassCode, _categoryInfo.CategoryID)}"" href=""javascript:;"">{_categoryInfo.CategoryName}</a>"); } else { htmlBuilder.Append(_categoryInfo.CategoryName); } } else { htmlBuilder.Append(_categoryInfo.CategoryName); } if (_categoryInfo.ContentNum >= 0) { htmlBuilder.Append(" "); htmlBuilder.Append( $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_categoryInfo.ContentNum})</span>"); } htmlBuilder.Replace("displayChildren", $"displayChildren_{_categoryInfo.ClassCode}"); return(htmlBuilder.ToString()); }