private void OnSearchNetwork() { var idMember = IdMember.Value.Trim(); var allMemberNodeDto = DcapServiceUtil.SearchMemberNodeDto(idMember); var parentNodeDto = DcapServiceUtil.GetParentNodeByChildNo(idMember); long parentId; string description; if (parentNodeDto == null) { parentId = -1; ParentInfo.Text = ""; description = "Tuyến gốc"; } else { parentId = parentNodeDto.AccountId; ParentInfo.Text = "Tuyến trên: " + parentNodeDto.Description; description = GetNodeDescription(parentNodeDto.Description); } long count = 0; ltrTree.Text = "<div id='sptree" + parentId + "'>" + description + "</div><ul>"; DrawTree(allMemberNodeDto.ToList(), parentId, count); ltrTree.Text += "</ul>"; var headerNames = new[] { "AccountId", "ParentId", "Description" }; var columnTypes = new[] { typeof(long), typeof(long), typeof(string) }; var ds = CreateMemberNodeDataSet(allMemberNodeDto, headerNames, columnTypes); TreeThanhVien.DataSource = new HierarchicalDataSet(ds, "AccountId", "ParentId", parentId); TreeThanhVien.DataBind(); TreeThanhVien.CollapseAll(); }
private void OnSearchNetwork() { MemberNodeDto[] allMemberNodeDto; var idMember = IdMember.Value.Trim(); long parentId = -1; if (!string.IsNullOrEmpty(idMember) && !DcapServiceUtil.IsValidAccountNumber(idMember)) { InvalidCredentialsMessage.Text = "Id thành viên không đúng định dạng"; InvalidCredentialsMessage.Visible = true; ResetMemberTreeView(out allMemberNodeDto); } else { allMemberNodeDto = DcapServiceUtil.SearchMemberNodeDto(idMember); if (allMemberNodeDto.Length == 0) { InvalidCredentialsMessage.Text = "Không tồn tại cây thành viên " + idMember; InvalidCredentialsMessage.Visible = true; ResetMemberTreeView(out allMemberNodeDto); } else { InvalidCredentialsMessage.Visible = false; var parentDirectNodeDto = DcapServiceUtil.GetParentDirectNodeByChildNo(idMember); if (parentDirectNodeDto == null) { ParentDirectInfo.Text = ""; } else { ParentDirectInfo.Text = "Người giới thiệu: " + parentDirectNodeDto.Description; } var parentNodeDto = DcapServiceUtil.GetParentNodeByChildNo(idMember); if (parentNodeDto == null) { ParentInfo.Text = ""; } else { parentId = parentNodeDto.AccountId; ParentInfo.Text = "Tuyến trên: " + parentNodeDto.Description; } } } var headerNames = new[] { "AccountId", "ParentId", "Description" }; var columnTypes = new[] { typeof(long), typeof(long), typeof(string) }; var ds = CreateMemberNodeDataSet(allMemberNodeDto, headerNames, columnTypes); TreeThanhVien.DataSource = new HierarchicalDataSet(ds, "AccountId", "ParentId", parentId); TreeThanhVien.DataBind(); TreeThanhVien.CollapseAll(); }