コード例 #1
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();
            }
        }
コード例 #2
0
ファイル: AssignFeatures.aspx.cs プロジェクト: ImranVS/SVNGIT
        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();
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
0
ファイル: ELS_Edit.aspx.cs プロジェクト: ImranVS/SVNGIT
        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);
            }
        }