private void BindGridOnPageLoad() { try { bool Issystem = true; string CurrentCultureName = GetCurrentCultureName; ListManagementController objController = new ListManagementController(); List<ListInfo> defaultList = objController.GetDefaultList(CurrentCultureName, -1); foreach (ListInfo topList in defaultList) { BindGrid(topList.ListName, topList.ParentKey); List<ListInfo> listSystemCheck = objController.GetListByPortalID(CurrentCultureName, -1); foreach (ListInfo system in listSystemCheck) { if (system.ListName == topList.ListName) Issystem = system.SystemList; } lblListName.Text = topList.ListName; lblDeleteList.Text = "Delete " + topList.ListName + " List"; ViewState["PARENTKEY"] = topList.ParentKey; ViewState["LISTNAME"] = topList.ListName; } if (Issystem == true) { gdvSubList.Columns[4].Visible = false; } else { gdvSubList.Columns[4].Visible = true; } lblParent.Visible = false; if (ViewState["LIST"] != null) { lblEntry.Text = ViewState["LIST"].ToString() + " " + GetSageMessage("ListSettings", "Entries"); } ViewMode(); pnlListAll.Visible = true; } catch (Exception ex) { ProcessException(ex); } }
private void GetParentList() { try { ddlParentList.Items.Clear(); ListManagementController objController = new ListManagementController(); List<ListInfo> objList = objController.GetListByPortalID(GetCurrentCultureName, -1); if (objList != null) { ddlParentList.Items.Insert(0, new ListItem("None Specified", "0")); int i = 1; foreach (ListInfo LPR in objList) { if (LPR.Parent.ToString() != "") { ddlParentList.Items.Insert(i, new ListItem(LPR.Parent.ToString() + ":" + LPR.ListName.ToString(), LPR.ParentKey.ToString() + ":" + i.ToString())); } else { ddlParentList.Items.Insert(i, new ListItem(LPR.ListName.ToString(), ":" + i.ToString())); } i++; } ddlParentList.DataBind(); } } catch (Exception ex) { ProcessException(ex); } }
private void PopulateSubLevel(TreeNode node, string parentKey) { try { ListManagementController objController = new ListManagementController(); List<ListInfo> nodeList = objController.GetListByPortalID(GetCurrentCultureName, -1); int count = 1; foreach (ListInfo resultNode in nodeList) { if (parentKey == "") { if (resultNode.ParentList == node.Text) { TreeNode nNode = new TreeNode(); nNode.Text = resultNode.Parent + ":" + resultNode.ListName.ToString(); nNode.Value = resultNode.ParentKey.ToString() + ":" + count; PopulateSubLevel(nNode, resultNode.ParentKey.ToString()); node.ChildNodes.Add(nNode); } } else { string[] tempNodes = SplitString(node.Text); string tempNode = tempNodes[1]; string temp = parentKey + ":" + tempNode; if (resultNode.ParentList == temp) { TreeNode nNode = new TreeNode(); nNode.Text = resultNode.Parent + ":" + resultNode.ListName.ToString(); nNode.Value = resultNode.ParentKey.ToString() + ":" + count; PopulateSubLevel(nNode, resultNode.ParentKey.ToString()); node.ChildNodes.Add(nNode); } } count = count + 1; } } catch (Exception ex) { ProcessException(ex); } }
protected void tvList_SelectedNodeChanged(object sender, EventArgs e) { try { string listName = tvList.SelectedNode.Text; string parentKey = tvList.SelectedNode.Value; string deleteText = lblDeleteList.Text; string[] texts = deleteText.Split(' '); if (texts.Length > 0) { lblDeleteList.Text = texts[0] + " " + listName + " " + ((texts.Length - 1) > 0 ? texts[texts.Length - 1] : ""); } if (tvList.SelectedNode.Value.Contains(":")) { string[] parentKeys = SplitString(parentKey); parentKey = parentKeys[0]; } if (tvList.SelectedNode.Text.Contains(":")) { string[] listNames = SplitString(listName); listName = listNames[1]; lblParent.Visible = true; lblParentText.Visible = true; } else { lblParent.Visible = false; lblParentText.Visible = false; } ListManagementController objController = new ListManagementController(); List<ListInfo> listSystemCheck = objController.GetListByPortalID(GetCurrentCultureName, -1); bool Issystem = true; foreach (ListInfo system in listSystemCheck) { if (system.ListName == listName) Issystem = system.SystemList; } lblListName.Text = listName; ViewState["PARENTKEY"] = parentKey; ViewState["LISTNAME"] = listName; BindGrid(listName, parentKey); if (Issystem == true) { gdvSubList.Columns[4].Visible = false; } else { gdvSubList.Columns[4].Visible = true; } lblParent.Text = parentKey; if (ViewState["LIST"] != null) { lblEntry.Text = ViewState["LIST"].ToString() + " " + GetSageMessage("ListSettings", "Entries"); } ViewMode(); pnlListAll.Visible = true; } catch (Exception ex) { ProcessException(ex); } }
private void PopulateTreeRootLevel() { try { ListManagementController objController = new ListManagementController(); List<ListInfo> nodeList = objController.GetListByPortalID(GetCurrentCultureName, -1); int count = 1; foreach (ListInfo node in nodeList) { if (node.ParentKey.ToString() == "") { if (node.ListName != _listName) { TreeNode tn = new TreeNode(); tn.Text = node.ListName.ToString(); tn.Value = node.ParentKey.ToString() + ":" + count.ToString(); PopulateSubLevel(tn, node.ParentKey.ToString()); tvList.Nodes.Add(tn); _listName = node.ListName; count++; } } } } catch (Exception ex) { ProcessException(ex); } tvList.CollapseAll(); }