Example #1
0
        public void fillEventsTreefromSession()
        {
            DataTable DataEvents = new DataTable();

            try
            {
                if (Session["DataEvents"] != "" && Session["DataEvents"] != null)
                {
                    DataEvents = (DataTable)Session["DataEvents"];
                }
                if (DataEvents.Rows.Count > 0)
                {
                    DataEvents.PrimaryKey = new DataColumn[] { DataEvents.Columns["ID"] };
                }
                EventsTreeList.DataSource = DataEvents;
                EventsTreeList.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);
            }
        }
Example #2
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);
            }
        }