protected void DisableParentNodeSelection()
    {
        // Iterates through all nodes and prevents the display of selection check boxes within parent nodes
        TreeListNodeIterator iterator = ASPxTreeList1.CreateNodeIterator();
        TreeListNode         node     = iterator.GetNext();

        while (node != null)
        {
            node.AllowSelect = !node.HasChildren;
            node             = iterator.GetNext();
        }
    }
Ejemplo n.º 2
0
        protected void SelectTree(ASPxTreeList treelist, DataTable dtSel)
        {
            TreeListNodeIterator iterator = treelist.CreateNodeIterator();
            TreeListNode         node;

            for (int i = 0; i < dtSel.Rows.Count; i++)
            {
                while (true)
                {
                    node = iterator.GetNext();
                    if (node == null)
                    {
                        break;
                    }

                    if ((Convert.ToInt32(dtSel.Rows[i]["ID"]) == Convert.ToInt32(node.GetValue("ID"))))
                    {
                        //5/8/2014 NS modified
                        if (node.ParentNode.Key != "" || !node.HasChildren)
                        {
                            node.Selected = true;
                        }
                    }
                }
                iterator.Reset();
            }
        }
Ejemplo n.º 3
0
        protected void rdoIsDefault_Init(object sender, EventArgs e)
        {
            ASPxRadioButton radioBtn = sender as ASPxRadioButton;

            DevExpress.Web.ASPxTreeList.TreeListDataCellTemplateContainer container = radioBtn.NamingContainer as
                                                                                      DevExpress.Web.ASPxTreeList.TreeListDataCellTemplateContainer;
            Guid key = Guid.Parse((container).NodeKey.ToString());

            radioBtn.Checked = false;
            string para = "default," + key.ToString();

            radioBtn.ClientInstanceName = String.Format("rdoIsDefault_{0}", container.NodeKey.ToString());
            string code = "function(s, e){ ";

            foreach (TreeListNode node in treelstProductUnits.Nodes)
            {
                TreeListNodeIterator iterator = new TreeListNodeIterator(node);
                while (iterator.Current != null)
                {
                    if (!container.NodeKey.Equals(iterator.Current.Key))
                    {
                        code += String.Format("rdoIsDefault_{0}.SetChecked(false); ", iterator.Current.Key);
                    }
                    iterator.GetNext();
                }
            }
            code += "if (s.GetChecked())" +
                    string.Format("treelstProductUnits.PerformCallback('{0}');", para + ",1") +
                    " else " +
                    string.Format("treelstProductUnits.PerformCallback('{0}');", para + ",0") + "}";

            radioBtn.ClientSideEvents.CheckedChanged = code;
        }
Ejemplo n.º 4
0
        private string GetRestrictedMenu()
        {
            string selValues = "";
            TreeListNodeIterator iterator = NavigatorNotVisibleTreeList.CreateNodeIterator();
            TreeListNode         node;

            while (true)
            {
                node = iterator.GetNext();
                if (node == null)
                {
                    break;
                }
                if (selValues == "")
                {
                    selValues = "" + node.Key + "";
                }
                else
                {
                    selValues += "," + "" + node.Key + "";
                }
            }

            return(selValues);
        }
Ejemplo n.º 5
0
        private void GetSelectedServers()
        {
            DataTable dtSel   = new DataTable();
            DataTable dtUnSel = new DataTable();

            try
            {
                dtSel.Columns.Add("ServerID");
                dtSel.Columns.Add("Name");
                dtSel.Columns.Add("ServerType");

                dtUnSel.Columns.Add("ServerID");
                dtUnSel.Columns.Add("Name");
                dtUnSel.Columns.Add("ServerType");

                //string selValues = "";
                TreeListNodeIterator iterator = ServersTreeList.CreateNodeIterator();
                TreeListNode         node;

                while (true)
                {
                    node = iterator.GetNext();

                    if (node == null)
                    {
                        break;
                    }
                    if (node.Level == 2) //(node.ParentNode.Selected==false)
                    {
                        if (node.Selected)
                        {
                            DataRow dr = dtSel.NewRow();
                            dr["ServerID"]   = node.GetValue("actid");
                            dr["Name"]       = node.GetValue("Name");
                            dr["ServerType"] = node.GetValue("ServerType");
                            dtSel.Rows.Add(dr);
                        }
                        else
                        {
                            DataRow dr = dtUnSel.NewRow();
                            dr["ServerID"]   = node.GetValue("actid");
                            dr["Name"]       = node.GetValue("Name");
                            dr["ServerType"] = node.GetValue("ServerType");
                            dtUnSel.Rows.Add(dr);
                        }
                    }
                }
                Session["SelectedServers"]   = dtSel;
                Session["UnSelectedServers"] = dtUnSel;
            }
            catch (Exception ex)
            {
                //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
                //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
                //    ", Error: " + ex.ToString());
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
        }
Ejemplo n.º 6
0
        protected void SearchBtn_Click(object sender, EventArgs e)
        {
            TreeListNodeIterator iterator = new TreeListNodeIterator(SectionTreeList.RootNode);

            while (iterator.Current != null)
            {
                CheckNode(iterator.Current);
                iterator.GetNext();
            }
        }
Ejemplo n.º 7
0
    protected void FilterButton_Click(object sender, EventArgs e)
    {
        TreeListNodeIterator iterator = new TreeListNodeIterator(EmployeeTreeList.RootNode);

        EmployeeTreeList.CollapseAll();
        while (iterator.Current != null)
        {
            CheckNode(iterator.Current);
            iterator.GetNext();
        }
    }
Ejemplo n.º 8
0
        protected void SetNodeSelectionSettings(ASPxTreeList treeList)
        {
            TreeListNodeIterator iterator = treeList.CreateNodeIterator();
            TreeListNode         node;

            while (true)
            {
                node = iterator.GetNext();
                if (node == null)
                {
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        public List <TreeListNode> getAllDepartmentNode()
        {
            List <TreeListNode>  nodes    = new List <TreeListNode>();
            TreeListNodeIterator iterator = new TreeListNodeIterator(trlDepartment.RootNode);

            while (iterator.Current != null)
            {
                if (iterator.Current != trlDepartment.RootNode)
                {
                    nodes.Add(iterator.Current);
                }
                iterator.GetNext();
            }

            return(nodes);
        }
Ejemplo n.º 10
0
        void SetNodeSelectionSettings()
        {
            TreeListNodeIterator iterator = NavigatorVisibleTreeList.CreateNodeIterator();
            TreeListNode         node;

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

                node.AllowSelect = !node.HasChildren;
            }
        }
    protected void treeList_DataBound(object sender, EventArgs e)
    {
        ArrayList            level2Nodes = new ArrayList();
        TreeListNodeIterator iterator    = new TreeListNodeIterator(treeList.RootNode);

        while (iterator.Current != null)
        {
            if (iterator.Current != treeList.RootNode)
            {
                if (iterator.Current.Level == 2)
                {
                    level2Nodes.Add(iterator.Current.Key);
                }
            }
            iterator.GetNext();
        }

        treeList.JSProperties.Add("cp_level2Nodeslist", level2Nodes);
    }
Ejemplo n.º 12
0
        private DataTable GetSelectedMenu(ASPxTreeList treelist)
        {
            DataTable dtSel = new DataTable();

            try
            {
                dtSel.Columns.Add("Name");


                TreeListNodeIterator iterator = treelist.CreateNodeIterator();
                TreeListNode         node;

                TreeListColumn columnId = treelist.Columns["Name"];

                while (true)
                {
                    node = iterator.GetNext();

                    if (node == null)
                    {
                        break;
                    }
                    if (node.Selected)
                    {
                        DataRow dr = dtSel.NewRow();

                        dr["Name"] = node.GetValue("Name");
                        dtSel.Rows.Add(dr);
                    }
                }
            }
            catch (Exception ex)
            {
                //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
                //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
                //    ", Error: " + ex.ToString());
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }

            return(dtSel);
        }
Ejemplo n.º 13
0
        private List <String> getSelectedRows()
        {
            //System.Collections.ArrayList<String> list = new System.Collections.ArrayList<String>();
            List <String>        list     = new List <String>();
            TreeListNodeIterator iterator = LogFilesTree.CreateNodeIterator();
            TreeListNode         node;

            while (true)
            {
                node = iterator.GetNext();
                if (node == null)
                {
                    break;
                }
                if (node.Selected && !Convert.ToBoolean(node["isFolder"].ToString()))
                {
                    list.Add(node["FullPath"].ToString());
                }
            }

            return(list);
        }
Ejemplo n.º 14
0
        protected void SelectTree(ASPxTreeList treelist, DataTable dtSel)
        {
            TreeListNodeIterator iterator = treelist.CreateNodeIterator();
            TreeListNode         node;

            for (int i = 0; i < dtSel.Rows.Count; i++)
            {
                while (true)
                {
                    node = iterator.GetNext();
                    if (node == null)
                    {
                        break;
                    }

                    if (dtSel.Rows[i]["Name"].ToString() == node.GetValue("Name").ToString())
                    {
                        node.Selected = true;
                    }
                }
                iterator.Reset();
            }
        }
    bool ProcessNodes(TreeListNode startNode, string keyToCheck)
    {
        var result = true;

        if (startNode == null)
        {
            return(false);
        }
        TreeListNodeIterator iterator = new TreeListNodeIterator(startNode);

        while (iterator.Current != null)
        {
            if (!CheckCurrentNodeKey(iterator.Current, keyToCheck))
            {
                iterator.GetNext();
            }
            else
            {
                result = false;
                break;
            }
        }
        return(result);
    }
Ejemplo n.º 16
0
        public void fillServersTreeList()
        {
            try
            {
                ServersTreeList.CollapseAll();
                CollapseAllSrvButton.Image.Url = "~/images/icons/add.png";
                CollapseAllSrvButton.Text      = "Expand All";
                if (Session["DataServers"] == null)
                {
                    DataTable DataServersTree = VSWebBL.ConfiguratorBL.ELSBL.Ins.GetServersFromProcedure();
                    Session["DataServers"] = DataServersTree;
                }
                ServersTreeList.DataSource = (DataTable)Session["DataServers"];
                ServersTreeList.DataBind();

                DataTable dtSel = VSWebBL.ConfiguratorBL.ELSBL.Ins.GetSelectedServers(EventKey);
                if (dtSel.Rows.Count > 0)
                {
                    TreeListNodeIterator iterator = ServersTreeList.CreateNodeIterator();
                    TreeListNode         node;
                    for (int i = 0; i < dtSel.Rows.Count; i++)
                    {
                        if (Convert.ToInt32(dtSel.Rows[i]["ServerID"]) == 0 && Convert.ToInt32(dtSel.Rows[i]["LocationID"]) == 0)
                        {
                            //select all
                            while (true)
                            {
                                node = iterator.GetNext();
                                if (node == null)
                                {
                                    break;
                                }
                                node.Selected = true;
                            }
                        }
                        else if (Convert.ToInt32(dtSel.Rows[i]["ServerID"]) == 0 && (Convert.ToInt32(dtSel.Rows[i]["LocationID"]) != 0))
                        {
                            //parent selected
                            while (true)
                            {
                                node = iterator.GetNext();
                                if (node == null)
                                {
                                    break;
                                }
                                if ((Convert.ToInt32(dtSel.Rows[i]["LocationID"]) == Convert.ToInt32(node.GetValue("actid"))) && node.GetValue("tbl").ToString() == "Locations")
                                {
                                    node.Selected = true;
                                }
                                else if (node.GetValue("LocId").ToString() != "")
                                {
                                    if ((Convert.ToInt32(dtSel.Rows[i]["LocationID"]) == Convert.ToInt32(node.GetValue("LocId"))) && node.GetValue("tbl").ToString() != "Locations")
                                    {
                                        node.Selected = true;
                                    }
                                }
                            }
                        }
                        else if (Convert.ToInt32(dtSel.Rows[i]["ServerID"]) != 0 && (Convert.ToInt32(dtSel.Rows[i]["LocationID"]) != 0))
                        {
                            //specific selected
                            while (true)
                            {
                                node = iterator.GetNext();
                                if (node == null)
                                {
                                    break;
                                }
                                if ((Convert.ToInt32(dtSel.Rows[i]["ServerID"]) == Convert.ToInt32(node.GetValue("actid"))) &&
                                    node.GetValue("tbl").ToString() != "Locations")
                                {
                                    node.Selected = true;
                                }
                            }
                        }
                        iterator.Reset();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
            }
        }
Ejemplo n.º 17
0
        private void RemoveRestricted()
        {
            string    uname        = "";
            DataTable dt           = new DataTable();
            DataTable AllServersDT = new DataTable();
            DataTable ServerRestrictedDataTable = new DataTable();

            if (Request.QueryString["FullName"] != null && Request.QueryString["FullName"] != "")
            {
                uname = Request.QueryString["FullName"].ToString();
            }
            if (Session["AllServerAccessList"] != null && Session["AllServerAccessList"] != "")
            {
                AllServersDT = (DataTable)Session["AllServerAccessList"];
            }
            ServerRestrictedDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.GetAllServersNotVisible(uname);
            if (AllServersDT.Rows.Count > 0)
            {
                dt = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetServersFromProcedure();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        if (row.ItemArray[5].ToString() == "7")
                        {
                            row.Delete();
                        }
                    }
                    dt.AcceptChanges();
                }
                ServerAccessTreeList.DataSource = dt;
                ServerAccessTreeList.DataBind();
                if (ServerRestrictedDataTable.Rows.Count > 0)
                {
                    List <int> ServerID   = new List <int>();
                    List <int> LocationID = new List <int>();
                    foreach (DataRow resser in ServerRestrictedDataTable.Rows)
                    {
                        foreach (DataRow allrow in AllServersDT.Rows)
                        {
                            if (resser["ID"].ToString() == allrow["actid"].ToString())
                            {
                                if (allrow["locid"] != null && allrow["locid"].ToString() != "" && resser["LocId"].ToString() == allrow["locid"].ToString())
                                {
                                    ServerID.Add(AllServersDT.Rows.IndexOf(allrow));
                                }
                            }
                        }
                    }
                    foreach (int Id in ServerID)
                    {
                        AllServersDT.Rows[Id].Delete();
                    }
                    AllServersDT.AcceptChanges();
                    try
                    {
                        TreeListNodeIterator iterator = ServerAccessTreeList.CreateNodeIterator();
                        TreeListNode         node;
                        string locid     = "";
                        string actid     = "";
                        string srvtypeid = "";
                        while (true)
                        {
                            node = iterator.GetNext();
                            if (node == null)
                            {
                                break;
                            }
                            if (node.Level == 2)
                            {
                                if (node.GetValue("LocId") != null)
                                {
                                    locid     = node.GetValue("LocId").ToString();
                                    actid     = node.GetValue("actid").ToString();
                                    srvtypeid = node.GetValue("srvtypeid").ToString();
                                    DataRow[] foundrows = AllServersDT.Select("LocId=" + locid + " AND actid=" + actid + " AND srvtypeid=" + srvtypeid);
                                    if (foundrows.Length > 0)
                                    {
                                        node.Selected = true;
                                    }
                                }
                            }
                        }
                        ServerAccessTreeList.ExpandAll();
                        Session["ServerAccessList"] = AllServersDT;
                    }
                    catch (Exception ex)
                    {
                        Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                        throw ex;
                    }
                }
                else
                {
                    ServerAccessTreeList.SelectAll();
                }
            }
        }
Ejemplo n.º 18
0
        //public void fillNodesTreeListbycellID(int id)
        //{
        //    //Session["DataEvents"] = null;
        //    try
        //    {
        //        int cellid = Convert.ToInt32(id);
        //        //string id = Convert.ToString(cellid);
        //        NodesTreeList.CollapseAll();
        //        CollapseAllButton.Image.Url = "~/images/icons/add.png";
        //        CollapseAllButton.Text = "Expand All";
        //        if (Session["DataEvents123"] == null)
        //        {
        //            DataTable bycelldata = VSWebBL.SecurityBL.webspehereImportBL.Ins.FetserversbycellID(cellid);
        //            //DataTable bycelldata = VSWebBL.SecurityBL.webspehereImportBL.Ins.FetserversbycellID(cellid);
        //            //DataTable DataServersTree = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetServersFromProcedure();
        //            Session["DataEvents123"] = bycelldata;
        //            NodesTreeList.DataSource = (DataTable)Session["DataEvents123"];
        //            NodesTreeList.DataBind();
        //        }
        //        else
        //        {
        //            if(Page.IsPostBack)
        //            {
        //                Session["DataEvents123"] = null;
        //                NodesTreeList.DataSource = "";
        //                NodesTreeList.DataBind();
        //                NodesTreeList.ClearNodes();
        //            }
        //        }
        //        NodesTreeList.DataSource = (DataTable)Session["DataEvents123"];
        //        NodesTreeList.DataBind();

        //            //DataTable DataEventsTree = VSWebBL.SecurityBL.webspehereImportBL.Ins.GetnodesserversFromProcedure();

        //            //DataTable DataServersTree = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetServersFromProcedure();
        //            //if (bycelldata.Rows.Count > 0)
        //            //{
        //            //bycelldata = (DataTable)Session["DataEvents123"];
        //            //    NodesTreeList.DataSource = bycelldata;

        //            //    NodesTreeList.DataBind();

        //            //}
        //            //else
        //            //{


        //            //Session["DataEvents1"] = bycelldata;

        //            //NodesTreeList.DataSource = bycelldata;
        //            //NodesTreeList.RefreshVirtualTree();
        //            //NodesTreeList.DataBind();
        //            //NodesTreeList.LayoutChanged();
        //            //NodesTreeList.Nodes.Clear();
        //            //NodesTreeList.ClearNodes();
        //            }



        //    catch (Exception ex)
        //    {
        //        //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
        //        //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
        //        //    ", Error: " + ex.ToString());

        //        //6/27/2014 NS added for VSPLUS-634
        //        Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
        //    }
        //}

        //public void fillNodesTreeListbycellIDfromsession()
        //{
        //    try
        //    {
        //        //int cellid = Convert.ToInt32(id);
        //        ////string id = Convert.ToString(cellid);
        //        //NodesTreeList.CollapseAll();
        //        //CollapseAllButton.Image.Url = "~/images/icons/add.png";
        //        //CollapseAllButton.Text = "Expand All";
        //        //if (Session["DataEvents"] == null)
        //        //{
        //        //    //DataTable DataEventsTree = VSWebBL.SecurityBL.webspehereImportBL.Ins.GetnodesserversFromProcedure();
        //        //    DataTable bycelldata = VSWebBL.SecurityBL.webspehereImportBL.Ins.FetserversbycellID(cellid);
        //        //    //DataTable DataServersTree = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetServersFromProcedure();
        //        //    Session["DataEvents"] = bycelldata;
        //        //}
        //        //DataTable bycelldata = VSWebBL.SecurityBL.webspehereImportBL.Ins.FetserversbycellID(cellid);
        //        DataTable DataEvents = new DataTable();
        //        if (Session["DataEvents123"]== null)
        //        {
        //            if (Session["DataEvents123"] != "" && Session["DataEvents123"] != null)
        //                DataEvents = Session["DataEvents123"] as DataTable;
        //            NodesTreeList.DataSource = DataEvents;
        //            NodesTreeList.DataBind();
        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
        //        //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
        //        //    ", Error: " + ex.ToString());

        //        //6/27/2014 NS added for VSPLUS-634
        //        Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
        //    }
        //}
        //public void FillWebsphereNodeStatusGrid(int id)
        //{

        //    DataTable dt = new DataTable();

        //    dt = VSWebBL.DashboardBL.WebsphereBL.Ins.GetWebsphereNodeStatus(id);
        //    WebsphereNodesgridview.DataSource = dt;
        //    WebsphereNodesgridview.DataBind();



        //}
        private DataTable GetSelectedEvents(int CellID)
        {
            DataTable dtSel = new DataTable();

            try
            {
                dtSel.Columns.Add("CellID");
                dtSel.Columns.Add("ServerID");
                dtSel.Columns.Add("NodeID");
                dtSel.Columns.Add("Enabled");
                dtSel.Columns.Add("NodeName");
                dtSel.Columns.Add("Status");
                dtSel.Columns.Add("HostName");



                //10/16/2014 NS added
                //dtSel.Columns.Add("ConsecutiveFailures");
                //string selValues = "";
                TreeListNodeIterator iterator = NodesTreeList.CreateNodeIterator();
                TreeListNode         node;
                //TreeListColumn columnActid = EventsTreeList.Columns["actid"];
                TreeListColumn columnActid    = NodesTreeList.Columns["actid"];
                TreeListColumn columnSrvId    = NodesTreeList.Columns["SrvId"];
                TreeListColumn columnTbl      = NodesTreeList.Columns["tbl"];
                TreeListColumn columnNodeName = NodesTreeList.Columns["NodeName"];
                TreeListColumn columnStatus   = NodesTreeList.Columns["Status"];
                TreeListColumn columnHostName = NodesTreeList.Columns["HostName"];
                while (true)
                {
                    node = iterator.GetNext();

                    if (node == null)
                    {
                        break;
                    }


                    //if (node.Level == 1 && node.ParentNode.Selected)
                    //{
                    //    // root node selected ie All Events selected
                    //    DataRow dr = dtSel.NewRow();
                    //    dr["CellID"] = CellID;
                    //    dr["ServerID"] = 0;// node.GetValue("actid");
                    //    dr["NodeID"] = 0;//node.GetValue("SrvId");
                    //    dr["Enabled"] = true;
                    //    dtSel.Rows.Add(dr);
                    //    break;
                    //}
                    //else if (node.Level == 1 && node.ParentNode.Selected == false && node.Selected)
                    //{
                    //    // level 1 node selected ie One Servertype selected and all events under it

                    //    DataRow dr = dtSel.NewRow();
                    //    dr["CellID"] = CellID;
                    //    dr["ServerID"] = 0; //node.GetValue("actid");
                    //    dr["NodeID"] = ((System.Data.DataRowView)(node.DataItem)).Row.ItemArray[3];//node.GetValue("SrvId");
                    //    dr["Enabled"] = true;
                    //    dtSel.Rows.Add(dr);
                    //}
                    ////else if (node.Level == 1 && node.ParentNode.Selected == false && node.HasChildren)
                    ////{
                    ////    // level 1 node selected ie One Servertype selected and all events under it

                    ////    DataRow dr = dtSel.NewRow();
                    ////    dr["CellID"] = CellID;
                    ////    dr["ServerID"] = node.GetValue("actid");
                    ////    dr["NodeID"] = ((System.Data.DataRowView)(node.DataItem)).Row.ItemArray[3];//node.GetValue("SrvId");
                    ////    dr["Enabled"] = true;
                    ////    dtSel.Rows.Add(dr);
                    ////}
                    //else
                    if (node.Level == 2)
                    {
                        if (node.Selected)
                        {
                            DataRow dr = dtSel.NewRow();
                            dr["CellID"]   = CellID;
                            dr["ServerID"] = node.GetValue("actid");
                            dr["NodeID"]   = node.GetValue("SrvId");
                            dr["NodeName"] = node.GetValue("Name");
                            dr["Status"]   = node.GetValue("Status");
                            dr["HostName"] = node.GetValue("HostName");
                            dr["Enabled"]  = true;



                            //10/16/2014 NS added
                            //dr["ConsecutiveFailures"] = node.GetValue("ConsecutiveFailures");
                            dtSel.Rows.Add(dr);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
                //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
                //    ", Error: " + ex.ToString());

                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
            }
            return(dtSel);
        }
Ejemplo n.º 19
0
        private void GetDeSelectedServers(Dictionary <string, string> dictionary, DataTable locSel)
        {
            string uid       = "";
            string separator = "###$$$###";

            if (Request.QueryString["UserID"] != null && Request.QueryString["UserID"] != "")
            {
                uid = Request.QueryString["UserID"].ToString();
            }
            try
            {
                locSel.Columns.Add("UserID");
                locSel.Columns.Add("LocationID");
                TreeListNodeIterator iterator = ServerAccessTreeList.CreateNodeIterator();
                TreeListNode         node;
                int    counter = 0;
                string locid   = "";

                while (true)
                {
                    node = iterator.GetNext();
                    if (node == null)
                    {
                        break;
                    }
                    counter = 0;
                    //Loop through child nodes. If all of the child nodes are de-selected, add a location to the list
                    //of restrictions
                    if (node.HasChildren)
                    {
                        foreach (TreeListNode childNode in node.ChildNodes)
                        {
                            if (!childNode.Selected)
                            {
                                counter += 1;
                                locid    = childNode.GetValue("locid").ToString();
                            }
                        }
                        //If the de-selected number of nodes is the same as the total number of child nodes, add a location to the
                        //list
                        if (counter == node.ChildNodes.Count)
                        {
                            if (locid != "")
                            {
                                DataRow locdr = locSel.NewRow();
                                locdr["UserID"]     = uid;
                                locdr["LocationID"] = locid;
                                locSel.Rows.Add(locdr);
                                DataColumn[] keyColumns = new DataColumn[1];
                                keyColumns[0]     = locSel.Columns["LocationID"];
                                locSel.PrimaryKey = keyColumns;
                            }
                        }
                    }
                    if (node.Level == 2) //(node.ParentNode.Selected==false)
                    {
                        if (!node.Selected)
                        {
                            locid = node.GetValue("locid").ToString();
                            DataRow[] foundrows = locSel.Select("LocationID=" + locid + "");
                            if (foundrows.Length == 0)
                            {
                                dictionary.Add("'" + node.GetValue("ServerType") + "'" + separator + "'" + node.GetValue("Name") + "'", "'" + node.GetValue("Name") + "'");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
        }
Ejemplo n.º 20
0
        private DataTable GetSelectedMenu(ASPxTreeList treelist)
        {
            DataTable dtSel = new DataTable();

            //5/8/2014 NS added
            DataColumn[] keys = new DataColumn[1];
            DataColumn   column;

            try
            {
                dtSel.Columns.Add("ID");
                //5/8/2014 NS added
                column           = dtSel.Columns["ID"];
                keys[0]          = column;
                dtSel.PrimaryKey = keys;

                TreeListNodeIterator iterator = treelist.CreateNodeIterator();
                TreeListNode         node;
                //5/8/2014 NS added
                TreeListNode parent;
                DataRow      founddr;

                TreeListColumn columnId = treelist.Columns["ID"];

                while (true)
                {
                    node = iterator.GetNext();

                    if (node == null)
                    {
                        break;
                    }
                    if (node.Selected)
                    {
                        DataRow dr = dtSel.NewRow();

                        dr["ID"] = node.GetValue("ID");
                        dtSel.Rows.Add(dr);
                        //5/8/2014 NS added
                        parent = node.ParentNode;
                        if (parent != null)
                        {
                            if (parent.Key.ToString() != "")
                            {
                                founddr = dtSel.Rows.Find(parent.GetValue("ID"));
                                if (founddr == null)
                                {
                                    dr       = dtSel.NewRow();
                                    dr["ID"] = parent.GetValue("ID");
                                    dtSel.Rows.Add(dr);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
                //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
                //    ", Error: " + ex.ToString());
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }

            return(dtSel);
        }
Ejemplo n.º 21
0
        //public void fillEventsTreeList()
        //{
        //    try
        //    {

        //        EventsTreeList.CollapseAll();
        //        CollapseAllButton.Image.Url = "~/images/icons/add.png";
        //        CollapseAllButton.Text = "Expand All";
        //        if (Session["DataEvents"] == null)
        //        {
        //            DataTable DataEventsTree = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetEventsFromProcedure();
        //            Session["DataEvents"] = DataEventsTree;
        //        }
        //        EventsTreeList.DataSource = (DataTable)Session["DataEvents"];
        //        EventsTreeList.DataBind();

        //        DataTable dtSel = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetSelectedEventsfortemplate(Convert.ToInt32(Session["id"].ToString()));
        //        string s = dtSel.Rows[0]["EventID"].ToString();
        //        string[] words = s.Split(',');

        //        DataTable dt = new DataTable();


        //        dt.Columns.Add("EventID");


        //        foreach (string str in words)
        //        {
        //            DataRow drow = dt.NewRow();   // Here you will get an actual instance of a DataRow
        //            drow["EventID"] = str;   // Assign values
        //            dt.Rows.Add(drow);             // Don't forget to add the row to the DataTable.
        //        }
        //        if (dtSel.Rows.Count > 0)
        //        {
        //            TreeListNodeIterator iterator = EventsTreeList.CreateNodeIterator();
        //            TreeListNode node;
        //            for (int i = 0; i < dtSel.Rows.Count; i++)
        //            {
        //                if (Convert.ToInt32(dtSel.Rows[i]["EventID"]) == 0 && Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) == 0)
        //                {
        //                    //select all
        //                    while (true)
        //                    {
        //                        node = iterator.GetNext();
        //                        if (node == null) break;
        //                        node.Selected = true;
        //                    }
        //                }
        //                else if (Convert.ToInt32(dtSel.Rows[i]["EventID"]) == 0 && (Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) != 0))
        //                {
        //                    //parent selected
        //                    while (true)
        //                    {
        //                        node = iterator.GetNext();
        //                        if (node == null) break;
        //                        if ((Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) == Convert.ToInt32(node.GetValue("actid"))) && node.GetValue("tbl").ToString() == "ServerTypes")
        //                        {
        //                            node.Selected = true;
        //                        }
        //                        else if (node.GetValue("SrvId").ToString() != "")
        //                        {
        //                            if ((Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) == Convert.ToInt32(node.GetValue("SrvId"))) && node.GetValue("tbl").ToString() != "ServerTypes")
        //                            {
        //                                node.Selected = true;
        //                            }
        //                        }
        //                    }
        //                }
        //                else if (Convert.ToInt32(dtSel.Rows[i]["EventID"]) != 0 && (Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) != 0))
        //                {
        //                    //specific selected
        //                    while (true)
        //                    {

        //                        node = iterator.GetNext();
        //                        if (node == null) break;
        //                        if ((Convert.ToInt32(dtSel.Rows[i]["EventID"]) == Convert.ToInt32(node.GetValue("actid"))) && node.GetValue("tbl").ToString() != "ServerTypes")
        //                        {
        //                            node.Selected = true;
        //                        }

        //                    }
        //                }
        //                iterator.Reset();
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
        //        //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
        //        //    ", Error: " + ex.ToString());

        //        //6/27/2014 NS added for VSPLUS-634
        //        Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
        //    }
        //}
        public void fillEventsTreeList()
        {
            int j;

            try
            {
                Session["DataEvents"] = null;
                EventsTreeList.ClearNodes();
                EventsTreeList.RefreshVirtualTree();
                EventsTreeList.CollapseAll();
                CollapseAllButton.Image.Url = "~/images/icons/add.png";
                CollapseAllButton.Text      = "Expand All";
                if (Session["DataEvents"] == null)
                {
                    DataTable DataEventsTree = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetEventsFromProcedure();
                    Session["DataEvents"] = DataEventsTree;
                }
                EventsTreeList.DataSource = (DataTable)Session["DataEvents"];
                EventsTreeList.DataBind();
                if (Request.QueryString["Key"] != null)
                {
                    dtSel = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetSelectedEventsfortemplate(Convert.ToInt32(Session["id"].ToString()));
                    //for (j = 0; j < dtSel.Rows.Count; j++)
                    //    {
                    //        string eventsid = dtSel.Rows[j]["ServerTypeID"].ToString();
                    //        lastid += eventsid + ",";

                    //    }

                    //    while (lastid.EndsWith(","))
                    //        lastid = lastid.Substring(0, lastid.Length - 1);
                    //    Session["lastid2"] = lastid;

                    if (dtSel.Rows.Count > 0)
                    {
                        TreeListNodeIterator iterator = EventsTreeList.CreateNodeIterator();
                        TreeListNode         node;
                        for (int i = 0; i < dtSel.Rows.Count; i++)
                        {
                            if (Convert.ToInt32(dtSel.Rows[i]["EventID"]) == 0 && Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) == 0)
                            {
                                //select all
                                while (true)
                                {
                                    node = iterator.GetNext();
                                    if (node == null)
                                    {
                                        break;
                                    }
                                    node.Selected = true;
                                }
                            }
                            else if (Convert.ToInt32(dtSel.Rows[i]["EventID"]) == 0 && (Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) != 0))
                            {
                                //parent selected
                                while (true)
                                {
                                    node = iterator.GetNext();
                                    if (node == null)
                                    {
                                        break;
                                    }
                                    if ((Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) == Convert.ToInt32(node.GetValue("actid"))) && node.GetValue("tbl").ToString() == "ServerTypes")
                                    {
                                        node.Selected = true;
                                    }
                                    else if (node.GetValue("SrvId").ToString() != "")
                                    {
                                        if ((Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) == Convert.ToInt32(node.GetValue("SrvId"))) && node.GetValue("tbl").ToString() != "ServerTypes")
                                        {
                                            node.Selected = true;
                                        }
                                    }
                                }
                            }
                            else if (Convert.ToInt32(dtSel.Rows[i]["EventID"]) != 0 && (Convert.ToInt32(dtSel.Rows[i]["ServerTypeID"]) != 0))
                            {
                                //specific selected
                                while (true)
                                {
                                    node = iterator.GetNext();
                                    if (node == null)
                                    {
                                        break;
                                    }
                                    if ((Convert.ToInt32(dtSel.Rows[i]["EventID"]) == Convert.ToInt32(node.GetValue("actid"))) && node.GetValue("tbl").ToString() != "ServerTypes")
                                    {
                                        node.Selected = true;
                                    }
                                }
                            }
                            iterator.Reset();
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " +
                //    Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name +
                //    ", Error: " + ex.ToString());

                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
            }
        }
Ejemplo n.º 22
0
 void ProcessNodes(TreeListNode startNode, ASPxTreeList list)
 {
     if (startNode == null) return;
     TreeListNodeIterator iterator = new TreeListNodeIterator(startNode);
     while (iterator.Current != null)
     {
         GetParentNodeKey(iterator.Current, list);
         iterator.GetNext();
     }
 }
Ejemplo n.º 23
0
        private DataTable GetSelectedServers(int EventKey)
        {
            DataTable dtSel = new DataTable();

            try
            {
                dtSel.Columns.Add("EventKey");
                dtSel.Columns.Add("ServerID");
                dtSel.Columns.Add("LocationID");
                dtSel.Columns.Add("ServerTypeID");

                TreeListNodeIterator iterator = ServersTreeList.CreateNodeIterator();
                TreeListNode         node;

                TreeListColumn columnActid     = ServersTreeList.Columns["actid"];
                TreeListColumn columnSrvId     = ServersTreeList.Columns["LocId"];
                TreeListColumn columnTbl       = ServersTreeList.Columns["tbl"];
                TreeListColumn columnSrvTypeId = ServersTreeList.Columns["srvtypeid"];
                while (true)
                {
                    node = iterator.GetNext();

                    if (node == null)
                    {
                        break;
                    }
                    //if (node.Level == 1 && node.ParentNode.Selected)
                    //{
                    //    // root node selected ie All Servers selected
                    //    DataRow dr = dtSel.NewRow();
                    //    dr["EventKey"] = EventKey;
                    //    dr["ServerID"] =  node.GetValue("actid");
                    //    dr["LocationID"] = node.GetValue("LocId");
                    //    dr["ServerTypeID"] = node.GetValue("srvtypeid");
                    //    dtSel.Rows.Add(dr);
                    //    break;
                    //}
                    //else if (node.Level == 1 && node.ParentNode.Selected == false && node.Selected)
                    //{

                    //    DataRow dr = dtSel.NewRow();
                    //    dr["EventKey"] = EventKey;
                    //    dr["ServerID"] = node.GetValue("actid");
                    //    dr["LocationID"] = ((System.Data.DataRowView)(node.DataItem)).Row.ItemArray[3];// node.GetValue("LocId");
                    //    dr["ServerTypeID"] = node.GetValue("srvtypeid");
                    //    dtSel.Rows.Add(dr);
                    //}
                    //else
                    if (node.Level == 2)                     //(node.ParentNode.Selected==false)
                    {
                        if (node.Selected)
                        {
                            DataRow dr = dtSel.NewRow();
                            dr["EventKey"]     = EventKey;
                            dr["ServerID"]     = node.GetValue("actid");
                            dr["LocationID"]   = node.GetValue("LocId");
                            dr["ServerTypeID"] = node.GetValue("srvtypeid");
                            dtSel.Rows.Add(dr);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
            }

            return(dtSel);
        }