Example #1
0
        private void LoadUserRestrictions(string UserName)
        {
            try
            {
                //Load allowed navigation into tree
                DataTable NavigatorTree = new DataTable();
                NavigatorTree = VSWebBL.SecurityBL.AdminTabBL.Ins.NavigatorVisibleUpdateTree();
                NavigatorVisibleTreeList.ClearNodes();
                if (NavigatorTree.Rows.Count > 0)
                {
                    NavigatorVisibleTreeList.DataSource = NavigatorTree;
                    NavigatorVisibleTreeList.DataBind();
                }

                DataTable RestrictedNavigatorTree = VSWebBL.SecurityBL.AdminTabBL.Ins.GetRestrictedNavigatorByUserID(UserName, "<=2");
                NavigatorNotVisibleTreeList.ClearNodes();
                if (RestrictedNavigatorTree.Rows.Count >= 0)
                {
                    NavigatorNotVisibleTreeList.DataSource   = RestrictedNavigatorTree;
                    NavigatorNotVisibleTreeList.KeyFieldName = "ID";
                    //NavigatorNotVisibleTreeList.ParentFieldName = "ParentID";
                    NavigatorNotVisibleTreeList.DataBind();
                    Session["DataNotVisible"] = RestrictedNavigatorTree;
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    FillUserNameComboBox();
                    Session["DataNotVisible"] = null;
                    //Navigator panel fields and buttons
                    //NavigatorRoundPanel.Enabled = false;
                }

                //Navigator
                if (Session["DataVisible"] == null)
                {
                    DataTable NavigatorTree = VSWebBL.SecurityBL.AdminTabBL.Ins.NavigatorVisibleUpdateTree();
                    Session["DataVisible"] = NavigatorTree;
                }

                NavigatorVisibleTreeList.DataSource = (DataTable)Session["DataVisible"];
                NavigatorVisibleTreeList.DataBind();
                NavigatorNotVisibleTreeList.DataSource = (DataTable)Session["DataNotVisible"];
                NavigatorNotVisibleTreeList.DataBind();
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
Example #3
0
        void SetNodeSelectionSettings()
        {
            TreeListNodeIterator iterator = NavigatorVisibleTreeList.CreateNodeIterator();
            TreeListNode         node;

            while (true)
            {
                node = iterator.GetNext();
                if (node == null)
                {
                    break;
                }

                node.AllowSelect = !node.HasChildren;
            }
        }
Example #4
0
        protected void ResetServerAccessButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (IsPostBack)
                {
                    FillUserNameComboBox();
                    UserNameComboBox.Text = "";

                    NavigatorNotVisibleTreeList.ClearNodes();
                    NavigatorVisibleTreeList.UnselectAll();
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
Example #5
0
 public void ToggleButton()
 {
     try
     {
         if (CollapseButton.Text == "Collapse All Rows")
         {
             NavigatorVisibleTreeList.CollapseAll();
             CollapseButton.Image.Url = "~/images/icons/add.png";
             CollapseButton.Text      = "Expand All Rows";
         }
         else
         {
             NavigatorVisibleTreeList.ExpandAll();
             CollapseButton.Image.Url = "~/images/icons/forbidden.png";
             CollapseButton.Text      = "Collapse All Rows";
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
        private void NavigatorsRebuildTrees(object fromTreeVal, object toTreeVal)
        {
            ASPxTreeList fromTree = (ASPxTreeList)fromTreeVal;
            ASPxTreeList toTree   = (ASPxTreeList)toTreeVal;
            DataTable    dataTo   = new DataTable();

            string[]            fieldValues            = new string[5];
            List <string>       fieldValuesID          = new List <string>();
            List <string>       fieldValuesDisplayText = new List <string>();
            List <string>       fieldValuesOrderNum    = new List <string>();
            List <string>       fieldValuesParentID    = new List <string>();
            List <string>       fieldValuesPageLink    = new List <string>();
            List <TreeListNode> selectItemsNavID       = fromTree.GetSelectedNodes();



            foreach (TreeListNode selectItemNavID in selectItemsNavID)
            {
                //Check if a selected node has a parent
                if (selectItemNavID.ParentNode != null && selectItemNavID.ParentNode.Key != "")
                {
                    //If the parent node is not already in the list, add it to the list
                    //if (fieldValuesID != null)
                    //{
                    //    if (!fieldValuesID.Contains(selectItemNavID.ParentNode.GetValue("ID").ToString()))
                    //    {
                    //        fieldValuesID.Add(selectItemNavID.ParentNode.GetValue("ID").ToString());
                    //        fieldValuesDisplayText.Add(selectItemNavID.ParentNode.GetValue("DisplayText").ToString());
                    //        fieldValuesOrderNum.Add(selectItemNavID.ParentNode.GetValue("OrderNum").ToString());
                    //        fieldValuesParentID.Add(selectItemNavID.ParentNode.GetValue("ParentID").ToString());
                    //        fieldValuesPageLink.Add(selectItemNavID.ParentNode.GetValue("PageLink").ToString());
                    //    }
                    //}
                }
                //If selected node is not already in the list, add it to the list
                if (fieldValuesID != null)
                {
                    if (!fieldValuesID.Contains(selectItemNavID.GetValue("ID").ToString()))
                    {
                        fieldValuesID.Add(selectItemNavID.GetValue("ID").ToString());
                        fieldValuesDisplayText.Add(selectItemNavID.GetValue("DisplayText").ToString());
                        fieldValuesOrderNum.Add(selectItemNavID.GetValue("OrderNum").ToString());
                        fieldValuesParentID.Add(selectItemNavID.GetValue("ParentID").ToString());
                        fieldValuesPageLink.Add(selectItemNavID.GetValue("PageLink").ToString());
                    }
                }
            }
            //Build data table based on the existing nodes in the tree
            dataTo            = NavigatorBuildDataTable(toTree);
            dataTo.PrimaryKey = new DataColumn[] { dataTo.Columns["ID"] };
            //Add new values to the data table, then re-assign the data table to the navigator
            for (int i = 0; i < fieldValuesID.Count; i++)
            {
                fieldValues[0] = fieldValuesID[i];
                fieldValues[1] = fieldValuesDisplayText[i];
                fieldValues[2] = fieldValuesOrderNum[i];;
                fieldValues[3] = fieldValuesParentID[i];
                fieldValues[4] = fieldValuesPageLink[i];
                if (!dataTo.Rows.Contains(fieldValues[0]))
                {
                    dataTo.Rows.Add(fieldValues);
                }
            }
            Session["DataNotVisible"] = dataTo;

            /*
             * IEnumerable<TreeListNode> list = fromTree.GetAllNodes();
             * foreach (TreeListNode node in list)
             * {
             *  int ind = fieldValuesID.IndexOf(node.GetValue("ID").ToString());
             *  if (ind == -1)
             *  {
             *      fieldValues[0] = node.GetValue("ID").ToString();
             *      fieldValues[1] = node.GetValue("DisplayText").ToString();
             *      fieldValues[2] = node.GetValue("OrderNum").ToString();
             *      fieldValues[3] = node.GetValue("ParentID").ToString();
             *      fieldValues[4] = node.GetValue("PageLink").ToString();
             *      dataFrom.Rows.Add(fieldValues);
             *  }
             * }
             * fromTree.DataSource = dataFrom;
             * fromTree.KeyFieldName = "ID";
             * fromTree.ParentFieldName = "ParentID";
             * fromTree.DataBind();
             */
            //fromTree.UnselectAll();
            NavigatorVisibleTreeList.UnselectAll();
            toTree.DataSource      = dataTo;
            toTree.KeyFieldName    = "ID";
            toTree.ParentFieldName = "ParentID";
            toTree.DataBind();
        }