WFA_psychometric_chart.Form1_main.LoadNode_LineAndDeviceInfoFromDB C# (CSharp) Method

LoadNode_LineAndDeviceInfoFromDB() public method

This function is for getting node info , correspoing device info for particular node,and line info this is required for saving in xml formate.
public LoadNode_LineAndDeviceInfoFromDB ( int indexValue ) : void
indexValue int index of the chart selected
return void
        public void LoadNode_LineAndDeviceInfoFromDB(int indexValue)
        {
          
            //*************************************Commented uncomment later**********************//
            
            
            ////Based on this row index we need to update the values and redraw lines..

            //// listForDataFromDB.Clear();//Lets clear the node...

            ////Lets identify the node
            //// int id = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
            ////int id = e.RowIndex;//This index is used to identify which cell or chart is clicked.
            //int id = indexValue;//This index is used to identify which cell or chart is clicked.
            ///*
            //Now lets find the chart line id and chart node id 
            //*/
            //string chartNodeGroupID = chartDetailList[id].chart_respective_nodeID;//This is for the node
            //string chartLineGroupID = chartDetailList[id].chart_respective_lineID;//This is for the line


            ////--Reset the context menu stip first..
            //lineInfoForSavingToXML.Clear();
            ////--Reset the context menu stip first..
            //nodeInfoForSavingToXML.Clear();



            //string databasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            //string databaseFile = databasePath + @"\db_psychrometric_project.s3db";
            //string connString = @"Data Source=" + databaseFile + ";Version=3;";

            ///*
            //Table name for line and node values...
            //ie: 
            //"tbl_"+ buildingname+ "_node_value"
            //"tbl_"+ buildingname+ "_line_value"
            //*/
            //string nodeTableName = "tbl_" + selectedBuildingList[0].BuildingName + "_node_value";
            //string lineTableName = "tbl_" + selectedBuildingList[0].BuildingName + "_line_value";
            //string deviceTableName = "tbl_" + selectedBuildingList[0].BuildingName + "_device_info_for_node";


            //using (SQLiteConnection connection = new SQLiteConnection(connString))
            //{
            //    connection.Open();



            //    SQLiteDataReader reader = null;
            //    string queryString = "SELECT *  from " + nodeTableName + " WHERE chart_respective_nodeID = @chartnodeID";


            //    SQLiteCommand command = new SQLiteCommand(queryString, connection);
            //    command.Parameters.AddWithValue("@chartnodeID", chartNodeGroupID);//This is the group id that is used to identify each node



            //    int count = 0;
            //    reader = command.ExecuteReader();
            //    while (reader.Read())
            //    {
            //        nodeInfoForSavingToXML.Add(new TempDataType
            //        {
            //            id = reader["nodeID"].ToString(), //This is just changed code : bbk305
            //            xVal = double.Parse(reader["xValue"].ToString()),
            //            yVal = double.Parse(reader["yValue"].ToString()),
            //            source = reader["source"].ToString(),
            //            name = reader["name"].ToString(),
            //            label = reader["label"].ToString(),
            //            colorValue = ColorTranslator.FromHtml(reader["colorValue"].ToString()),
            //            showItemText = reader["showTextItem"].ToString(),
            //            marker_Size = int.Parse(reader["nodeSize"].ToString())


            //        });

            //    }

            //    //--Resetting the index value...

            //    //if (nodeInfoForSavingToXML.Count > 0)
            //    //{
            //    //    count = nodeInfoForSavingToXML.Count;//--This is used for udpdating the index values..
            //    //}
            //    //else
            //    //{
            //    //    count = 0;
            //    //}
            //    ////--Resetting the actual index value
            //    //index = count; //Index is set to the count values of the node

            //    //--Adding data form the line node values...
            //    SQLiteDataReader reader2x = null;
            //    string queryString2x = "SELECT *  from  " + lineTableName + " WHERE chart_respective_lineID = @lineID";
            //    //--Testing..
            //    //   MessageBox.Show("CurrentLineTableFromDB = " + currentLineTableFromDB);

            //    SQLiteCommand command2x = new SQLiteCommand(queryString2x, connection);
            //    command2x.Parameters.AddWithValue("@lineID", chartLineGroupID);//This is the group id that is used to identify each node


            //    //int count2 = 0;
            //    reader2x = command2x.ExecuteReader();
            //    while (reader2x.Read())
            //    {
            //        lineInfoForSavingToXML.Add(new lineNodeDataType
            //        {
            //            ID = reader2x["lineID"].ToString(),//This is just change code :bbk305
            //            prevNodeId = reader2x["prevNodeId"].ToString(),
            //            nextNodeId = reader2x["nextNodeId"].ToString(),
            //            lineColorValue = ColorTranslator.FromHtml(reader2x["lineColorValue"].ToString()),
            //            lineSeriesID = new Series(reader2x["lineSeriesId"].ToString()),
            //            lineThickness = int.Parse(reader2x["thickness"].ToString())
            //        });

            //    }
            //    //count2 = menuStripNodeLineInfoValues.Count-1; //--This is used for udpdating the index values..

            //    //   MessageBox.Show("count line data in menuStripNodeLineInfoValues = " + menuStripNodeLineInfoValues.Count);

            //}//close of using..

            ////***********************************************thsi one if for pulling device info*************************************//

            ////--Reset the context menu stip first..
            //deviceInfoForSavingToXML.Clear();

            //foreach (var node in nodeInfoForSavingToXML)
            //{
            //    if (node.source == "Device")
            //    {

            //        using (SQLiteConnection connection = new SQLiteConnection(connString))
            //        {
            //            connection.Open();

            //            SQLiteDataReader reader = null;
            //            string queryString = "SELECT *  from " + deviceTableName + " WHERE nodeID = @nodeID";

            //            SQLiteCommand command = new SQLiteCommand(queryString, connection);
            //            command.Parameters.AddWithValue("@nodeID", node.id);//This is the group id that is used to identify each node



            //            //int count = 0;
            //            reader = command.ExecuteReader();
            //            while (reader.Read())
            //            {
            //                deviceInfoForSavingToXML.Add(new dt_for_device_info
            //                {
            //                    nodeID = reader["nodeID"].ToString(),
            //                    device_instance_id = reader["device_instanceID"].ToString(),
            //                    ip = reader["IP"].ToString(),
            //                    param1id = reader["param1ID"].ToString(),
            //                    param2id = reader["param2ID"].ToString(),
            //                    param1info = reader["param1_info"].ToString(),
            //                    param2info = reader["param2_info"].ToString(),
            //                    param1_id_type = reader["param1_identifier_type"].ToString(),
            //                    param2_id_type = reader["param2_identifier_type"].ToString()

            //                });
            //            }
            //        }//close of using..


            //    } //close of if


            //}//close of foreach


       //*********************************end : Uncomment this later*****************//


        }
Form1_main