Perfoms the database operations used by form1_main
Inheritance: Form1_main
        private void chart1_MouseClick(object sender, MouseEventArgs e)
        {
            //--Check of enable or dissable the cell click
            if (FlagForDissableLeftAndRightClicksInChart == 1)
            {
                //FlagForDissableLeftAndRightClicksInChart = 0;
                return;//DO not proceed forward
            }
            
            if(flagForEditComfortZoneGraphically == 1)
            {

                //First click then 1 second click then 2
                if ((Cursor == Cursors.SizeWE || Cursor == Cursors.SizeNS))
                {
                    if (selectedSeriesForMoveForEditComfortZone != "")
                    {
                        // Cursor = Cursors.SizeWE;
                        // selectedSeriesForMoveForEditComfortZone = "Vertical_Temp_Left_Side";
                        flagForBorderLineSelectedForMoveForEditCF += 1;
                        comfortZoneBorderSeriesCurrentlySelected = selectedSeriesForMoveForEditComfortZone;
                    }

                }

                if (flagForBorderLineSelectedForMoveForEditCF == 0)
                {
                    ////If the button is clicked outside then we have flagForBorderLineSelectedForMoveForEditCF = 3
                    //this should be done only when clicked outside the chart so use condition
                    double xValue = chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.X);
                    double yValue = chart1.ChartAreas[0].AxisY.PixelPositionToValue(e.Y);
                    double hum = CalculateHumidityFromXandYCoordinate(xValue, yValue);//This gets the humidity 

                    if (( hum < int.Parse(listchartComfortZoneInfoSingle[0].min_hum) || hum > int.Parse(listchartComfortZoneInfoSingle[0].max_hum)) ||(xValue < int.Parse(listchartComfortZoneInfoSingle[0].min_temp) || xValue> int.Parse(listchartComfortZoneInfoSingle[0].max_temp))) 
                    {
                        flagForBorderLineSelectedForMoveForEditCF = 3;
                    }
                   
                }

                if (flagForBorderLineSelectedForMoveForEditCF == 3)
                {
                    /*
                   Means create new chart if the data is updated to new values  
                   */
                    
                    //Checking if current value matches with previous values or not if so then do not do anything
                    if ( ( minTemperatureForNewComfortZoneCreate != 0 )&& ( maxTemperatureForNewComfortZoneCreate != 0) && (minHumidityForNewComfortZoneCreate != 0) &&( maxHumidityForNewComfortZoneCreate != 0))
                    {
                        //If the values has changed then default then only change else no change 
                        //Lets get the previous chart value to make new chart 
                        string name = listchartComfortZoneInfoSingle[0].name;
                        int minTempOfPrevComfortzone = int.Parse(listchartComfortZoneInfoSingle[0].min_temp);
                        int maxTempOfPrevComfortzone = int.Parse(listchartComfortZoneInfoSingle[0].max_temp);
                        int minHumidityOfPrevComfortzone = int.Parse(listchartComfortZoneInfoSingle[0].min_hum);
                        int maxHumidityOfPrevComfortzone = int.Parse(listchartComfortZoneInfoSingle[0].max_hum);
                        Color prevComfortzoneColor = listchartComfortZoneInfoSingle[0].colorValue;

                        if (((minTemperatureForNewComfortZoneCreate == minTempOfPrevComfortzone) && (maxTemperatureForNewComfortZoneCreate == maxTempOfPrevComfortzone) && (minHumidityForNewComfortZoneCreate == minHumidityOfPrevComfortzone) && (maxHumidityForNewComfortZoneCreate == maxHumidityOfPrevComfortzone)))
                        {
                            //If equal do not do any thing 
                            //Refreshing the chart
                            if (dataGridView1.Rows.Count > 0)  //If there is data then only do this one
                            {
                                //set parameters of your event args
                                var eventArgs = new DataGridViewCellEventArgs(1, dataGridView1.CurrentCell.RowIndex);
                                // or setting the selected cells manually before executing the function
                                dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Selected = true;
                                dataGridView1_CellClick(sender, eventArgs);
                            }

                        }
                        else {
                            //If they do not match then only create new comfort zone and assign them the value
                            /*Steps "
                            1.Clear the existing chart first
                            2.Create the new chart with new values and new name 
                            3.Update the chart list 
                            */
                            // MessageBox.Show("Chart creating and updating");

                            //Clearing the border lines 
                            ClearSeriesInChart("Vertical_Temp_Left_Side");
                            ClearSeriesInChart("Vertical_Temp_Right_Side");
                            ClearSeriesInChart("Horizontal_Hum_Down_Side");
                            ClearSeriesInChart("Horizontal_Hum_Upper_Side");


                            //Clearing the chart 
                            ClearComfortZone(double.Parse(listchartComfortZoneInfoSingle[0].min_temp), double.Parse(listchartComfortZoneInfoSingle[0].max_temp), double.Parse(listchartComfortZoneInfoSingle[0].min_hum), double.Parse(listchartComfortZoneInfoSingle[0].max_hum));

                            //We need to generate name
                            //First splite if underscore is present
                            string[] word = name.Split('_');


                            string newComfortZoneName = "";
                            do
                            {
                                newComfortZoneName = word[0] + "_" + countForComfortZone++;
                            } while (newComfortZoneName == name);


                            PlotComfortZone(minTemperatureForNewComfortZoneCreate, maxTemperatureForNewComfortZoneCreate, minHumidityForNewComfortZoneCreate, maxHumidityForNewComfortZoneCreate, prevComfortzoneColor, newComfortZoneName);

                            //Now we need to insert new comfort zone now  
                            InsertComfortZoneValue(newComfortZoneName, minTemperatureForNewComfortZoneCreate, maxTemperatureForNewComfortZoneCreate, minHumidityForNewComfortZoneCreate, maxHumidityForNewComfortZoneCreate, prevComfortzoneColor);

                            //After inserting updating the comfort zone info as well
                            insertOrUpdateComfortChartSetting(chartDetailList[indexOfChartSelected].chartID, temporaryComfortZoneID_Store);


                            //--Refresh the comfort zone

                            if (dataGridView1.Rows.Count > 0)  //If there is data then only do this one
                            {
                                //set parameters of your event args
                                var eventArgs = new DataGridViewCellEventArgs(1, dataGridView1.CurrentCell.RowIndex);
                                // or setting the selected cells manually before executing the function
                                dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Selected = true;
                                dataGridView1_CellClick(sender, eventArgs);
                            }



                        }
                        flagForEditComfortZoneGraphically = 0;//Resetting flag


                    }
                }









                    //Now we do others task

                    //This one is last one when released go back to 0 initial state not selected
                    if (flagForBorderLineSelectedForMoveForEditCF== 2)
                {
                    flagForBorderLineSelectedForMoveForEditCF = 0;
                }





            }
            else { 

            //This flagForDisconnectClick is for the line not node
            if (flagForDisconnectClick == 1)
            {
                  //--This one is for line
                if (flagNodeSelectedForConnect == 1)  //Node selected for connect 
                {
                    //--Here we need to do the resetting of the datas in the arraylist and replotting it ....
                    //--This function does the resetting the line properties...
                    ResettingLines();//--Calling the resetting the lines..

                    ReDrawingLineAndNode();

                    //--Again resetting the values as well ..
                    chart1.Series.Remove(addDottedSeries);//--lets remove the indicator if present 
                    flagForDisconnectClick = 0;
                    flagNodeSelectedForConnect = 0;

                }
            }
            else {
                //--This function is used for nodeSelection and releasing node to desired place 
                //--This gets triggered based on mouse select and release..
                //Updating values in database  //This part is of node movement and update not line
                if (flagForInsertOrUpdateDataToDB == 1)
                {
                    for (int x = 0; x < menuStripNodeInfoValues.Count; x++)
                    {
                            // UpdateNodeInfoToDB(menuStripNodeInfoValues[x].id, menuStripNodeInfoValues[x].xVal, menuStripNodeInfoValues[x].yVal, menuStripNodeInfoValues[x].source, menuStripNodeInfoValues[x].name, menuStripNodeInfoValues[x].label, menuStripNodeInfoValues[x].colorValue, menuStripNodeInfoValues[x].showItemText, menuStripNodeInfoValues[x].marker_Size);
                            DatabaseOperations Obj1 = new DatabaseOperations();
                            Obj1.UpdateNodeInfoToDBWithNewParameters(CurrentSelectedBuilding,menuStripNodeInfoValues[x].id, menuStripNodeInfoValues[x].xVal, menuStripNodeInfoValues[x].yVal, menuStripNodeInfoValues[x].temperature_source, menuStripNodeInfoValues[x].humidity_source, menuStripNodeInfoValues[x].name, menuStripNodeInfoValues[x].colorValue, menuStripNodeInfoValues[x].marker_Size,(int)menuStripNodeInfoValues[x].airFlow);
                    }
                }
                NodeSelectionAndRelease(e);
                //The node update function should be placed here and the calling 
                //to the redrawing function has to be done  after that.

            }


            }//Close of else of edit mode
        }//Close of mouse click event 
        int airFlowValueGlobal = 1000; //This will be updated 
        public void plot_on_graph_values_process_diagram(double xval, double yval)
        {
            //chart1.Series.Clear();


            try
            {


                series1.ChartType = SeriesChartType.Point;
                //int r, g, b;

                series1.MarkerSize = 20;
                series1.MarkerStyle = MarkerStyle.Circle;
                series1.Points.AddXY(xval, yval);
                string s = "source :\nTemperature Source " + temperature_sourceGlobal + "\nHumidity Source" + humidity_sourceGlobal + "\n Name : " + tbName;
                series1.Points[index].Color = colorValue;
                series1.Points[index].ToolTip = s;

                string labelStringValue = null;
                //labeling part
                //if (comboboxItemText == "Label")
                //{
                //    //label is selected
                //    labelStringValue = tbLabel;
                //}
                //else if (comboboxItemText == "Name")
                //{
                    //Name is selected
                    labelStringValue = tbName;
                //}
                //else
                //{
                //    //Source is selected
                //    labelStringValue = tbSource;
                //}

                series1.Points[index].Label = labelStringValue;

                //  MessageBox.Show("value xval =" + xval + ",yval = " + yval);
                //series1.Points[index_series++].Color = colorValue;//blue
                //    MessageBox.Show("end re");
                //index_series++;
                //series1.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //now lets move on to storing those values and futher porcessing it...


            //we need to get this a unique id 
            string unique_id_for_node = selectedBuildingList[0].BuildingName + GetGUID();//This is the unique id 


            //the value is added...
            menuStripNodeInfoValues.Add(new TempDataType
            {
                id = unique_id_for_node,
                xVal = xval,
                yVal = yval,
               // source = tbSource,
               temperature_source = temperature_sourceGlobal,
               humidity_source = humidity_sourceGlobal,
                name = tbName,
               // label = tbLabel,
                colorValue = colorValue,
               // showItemText = comboboxItemText,
                marker_Size = markerSize  ,
                airFlow = airFlowValueGlobal


            });

            //--Inserting the node values in the database sqlite


            if (flagForInsertOrUpdateDataToDB == 1)
            {
                //do only if the  flag is raised.

                // InsertNodeInfoToDB(unique_id_for_node, xval, yval, tbSource, tbName, tbLabel, colorValue, comboboxItemText, markerSize, deviceInstanceValue, deviceIP, deviceParam1ID, deviceParam2ID, device_param1_info_for_node, device_param2_info_for_node, object_param1_identifier_type, object_param2_identifier_type);
                //--New code is added to here
                DatabaseOperations ObjDbOperation = new DatabaseOperations();
                //  MessageBox.Show("Building Name= " + selectedBuildingList[0].BuildingName);
               // MessageBox.Show(unique_id_for_node+"xval = "+ xval+" yval"+ yval+"temp "+ temperature_sourceGlobal+"hum="+ humidity_sourceGlobal+",name="+ tbName+",col="+ colorValue+",size=" +markerSize +",air="+airFlowValueGlobal.ToString());
                ObjDbOperation.InsertNodeInfoToDBWithoutDeviceInfo(CurrentSelectedBuilding, chartDetailList[indexForWhichChartIsSelected].chart_respective_nodeID, unique_id_for_node, xval, yval, temperature_sourceGlobal, humidity_sourceGlobal, tbName, colorValue, markerSize, airFlowValueGlobal.ToString());
               // MessageBox.Show("Operation Complete Test");
            //InsertNodeInfoToDBWithoutDeviceInfo(unique_id_for_node,)
            }



            //the liine plot part is only done when ther is two points or more
            if (index > 0)
            {




                double startHumidity1 = 0;
                double startEnthalpy1 = 0;
                double endHumidity1 = 0;//--this is for the start and end humidity print in the tooltip
                double endEnthalpy1 = 0;

                //now lets plot lines between tow points...
                Series newLineSeries = new Series("LineSeries" + index);
                //string nameSeries = newLineSeries.Name;

                //--If the series already present lets remove from the chart ok ol :)
                if (chart1.Series.IndexOf(newLineSeries.Name) != -1)
                {
                    //MessageBox.Show("Series exits");
                    //--This  means the series is present....
                    chart1.Series.RemoveAt(chart1.Series.IndexOf(newLineSeries.Name));
                }

                string unique_id_for_line = selectedBuildingList[0].BuildingName + GetGUID();//This is the unique id 



                //--Lets store the nodeline info as well
                menuStripNodeLineInfoValues.Add(new lineNodeDataType
                {
                    //--Id of this ..
                    ID = unique_id_for_line,
                    // prevNodeId = menuStripNodeInfoValues[index - 1].id, //previousNodeIndexForLineInput
                    prevNodeId = menuStripNodeInfoValues[previousNodeIndexForLineInput].id,
                    nextNodeId = menuStripNodeInfoValues[index].id,
                    lineColorValue = menuStripNodeInfoValues[previousNodeIndexForLineInput].colorValue,
                    lineSeriesID = newLineSeries,
                    lineThickness = 3, //default thickness is 3
                    name = lineName,
                    status = lineStatus_ON_OFF

                });


                //--Adding to db
                if (flagForInsertOrUpdateDataToDB == 1)
                {
                    //--Insert the values when the flag is raised.
                    //InsertLineInfoToDB(unique_id_for_line, menuStripNodeInfoValues[index - 1].id, menuStripNodeInfoValues[index].id, menuStripNodeInfoValues[index - 1].colorValue, newLineSeries, menuStripNodeLineInfoValues[index - 1].lineThickness);
                    // InsertLineInfoToDB(unique_id_for_line, menuStripNodeInfoValues[index - 1].id, menuStripNodeInfoValues[index].id, menuStripNodeInfoValues[index - 1].colorValue, newLineSeries,3);
                    InsertLineInfoToDB(unique_id_for_line, menuStripNodeInfoValues[previousNodeIndexForLineInput].id, menuStripNodeInfoValues[index].id, menuStripNodeInfoValues[previousNodeIndexForLineInput].colorValue, newLineSeries, 3);
                }



                //newSeries.MarkerStyle = MarkerStyle.Triangle;
                newLineSeries.ChartType = SeriesChartType.Line;
                //newLineSeries.MarkerStyle = MarkerStyle.Circle;
                //newLineSeries.MarkerStyle = MarkerStyle.Star6;
                newLineSeries.MarkerBorderWidth.Equals(15);
                newLineSeries.MarkerSize.Equals(35);
                newLineSeries.BorderWidth.Equals(15);
                // newLineSeries.SetCustomProperty(newLineSeries.MarkerSize.ToString(),newLineSeries.MarkerSize.Equals(25).ToString());
                newLineSeries.Color = menuStripNodeInfoValues[index].colorValue;

                //--this sets the initial values of humidity and enthalpy
                //CalculateHumidityEnthalpy((double)menuStripNodeInfoValues[index - 1].xVal, (double)menuStripNodeInfoValues[index - 1].yVal);//previousNodeIndexForLineInput


                CalculateHumidityEnthalpy((double)menuStripNodeInfoValues[previousNodeIndexForLineInput].xVal, (double)menuStripNodeInfoValues[previousNodeIndexForLineInput].yVal);//previousNodeIndexForLineInput
                startHumidity1 = Math.Round(humidityCalculated, 2);//--Fro showing only up to 2 dec. eg."34.52"
                startEnthalpy1 = Math.Round(enthalpyCalculated, 2);
                double startSpecificVolume1 = SpecificVolumeReturn;
                //--This calculates the end humidity and the enthalpy values..
                CalculateHumidityEnthalpy((double)menuStripNodeInfoValues[index].xVal, (double)menuStripNodeInfoValues[index].yVal);
                endHumidity1 = Math.Round(humidityCalculated, 2);
                endEnthalpy1 = Math.Round(enthalpyCalculated, 2);
                double endSpecificVolume1 = SpecificVolumeReturn;
                double enthalpyChange = endEnthalpy1 - startEnthalpy1;

                // string sequenceDetected = menuStripNodeInfoValues[index - 1].name + " to " + menuStripNodeInfoValues[index].name;
                string sequenceDetected = menuStripNodeInfoValues[previousNodeIndexForLineInput].name + " to " + menuStripNodeInfoValues[index].name;


                //string tooltipString = "Sequence :  " + sequenceDetected + " \n" + "                 start             end \n" + "Temp         :" + Math.Round(menuStripNodeInfoValues[index - 1].xVal, 2) + "               " + Math.Round(menuStripNodeInfoValues[index].xVal, 2) + "\nHumidity :" + startHumidity1 + "           " + endHumidity1 + "\nEnthalpy : " + startEnthalpy1 + "           " + endEnthalpy1 + "\nEnthalpy Change:" + enthalpyChange;
                
                //=====================================THisi used========================//

                //--this sets the initial values of humidity and enthalpy
                //CalculateHumidityEnthalpy(temporaryNodeValueStoreForRedrawLine[0].xVal, temporaryNodeValueStoreForRedrawLine[0].yVal);
                //startHumidity1 = Math.Round(humidityCalculated, 2);
                //startEnthalpy1 = Math.Round(enthalpyCalculated, 2);
              
                //--This calculates the end humidity and the enthalpy values..
                //CalculateHumidityEnthalpy((double)temporaryNodeValueStoreForRedrawLine[1].xVal, (double)temporaryNodeValueStoreForRedrawLine[1].yVal);
                //endHumidity1 = Math.Round(humidityCalculated, 2);
                //endEnthalpy1 = Math.Round(enthalpyCalculated, 2);
              

                // MessageBox.Show("Start hum" + startHumidity1 + " end enth" + endEnthalpy1);
                //MessageBox.Show("menustripinfovalues[prevNodeID].xVal=" + menuStripNodeInfoValues[prevNodeID].xVal + "menuStripNodeInfoValues[nextNodeID].yVal=" + menuStripNodeInfoValues[nextNodeID].yVal + "menuStripNodeInfoValues[nextNodeID].xVal = "+ menuStripNodeInfoValues[nextNodeID].xVal + " menuStripNodeInfoValues[nextNodeID].yVal" + menuStripNodeInfoValues[nextNodeID].yVal);

               // double enthalpyChange = endEnthalpy1 - startEnthalpy1;

               // string sequenceDetected = temporaryNodeValueStoreForRedrawLine[0].name + " to " + temporaryNodeValueStoreForRedrawLine[1].name;

               // string tooltipString = "";
                string ZeroLine = "Process:  " + lineName + " ";
                string FirstLine = @"Parameters                      " + "Units               " + menuStripNodeInfoValues[previousNodeIndexForLineInput].name + "                  " + menuStripNodeInfoValues[index].name;
                string SecondLine = @"DBT                                   " + "\x00B0 C                   " + Math.Round(menuStripNodeInfoValues[previousNodeIndexForLineInput].xVal, 2) + "                           " + Math.Round(menuStripNodeInfoValues[index].xVal, 2);
                string ThirdLine = @"Relative Humidity           " + "%                     " + startHumidity1 + "                     " + endHumidity1;
                string FourthLine = @"Humidity Ratio                " + "Kg/Kg dryair  " + Math.Round(menuStripNodeInfoValues[previousNodeIndexForLineInput].yVal, 2) + "                       " + Math.Round(menuStripNodeInfoValues[index].yVal, 2);
                string FifthLine = "Volume Flow Rate           " + "m\xB3/s                " + Math.Round(menuStripNodeInfoValues[previousNodeIndexForLineInput].airFlow, 2) + "                      " + Math.Round(menuStripNodeInfoValues[index].airFlow, 2);

                string SixthLine = "Specific Volume              " + "m\xB3/Kg             " + startSpecificVolume1 + "                    " + endSpecificVolume1;
                double massFlowRate1 = menuStripNodeInfoValues[previousNodeIndexForLineInput].airFlow / startSpecificVolume1;
                double massFlowRate2 = menuStripNodeInfoValues[index].airFlow / endSpecificVolume1;

                string SeventhLine = @"Mass flow rate(dry air)   " + "Kg(dry air)/s   " + Math.Round(massFlowRate1, 2) + "                        " + Math.Round(massFlowRate2, 2);
                string EighthLine = @"Enthalpy                           " + "KJ/Kg              " + startEnthalpy1 + "                       " + endEnthalpy1;
                double totalEnthalpyFlow1 = massFlowRate1 * startEnthalpy1;
                double totalEnthalpyFlow2 = massFlowRate2 * endEnthalpy1;
                string NinthLine = @"Total Enthalpy Flow         " + "KJ/s                " + Math.Round(totalEnthalpyFlow1, 2) + "                      " + Math.Round(totalEnthalpyFlow2, 2);
                double heatChange = totalEnthalpyFlow2 - totalEnthalpyFlow1;
                string TenthLine = @"Heat Change                    " + "KW                  " + Math.Round(heatChange, 2) + "                     ";
               string tooltipString = ZeroLine + "\n" + FirstLine + "\n" + SecondLine + "\n" + ThirdLine + "\n" + FourthLine + "\n" + FifthLine + "\n" + SixthLine + "\n" + SeventhLine + "\n" + EighthLine + "\n" + NinthLine + "\n" + TenthLine;
                newLineSeries.ToolTip = tooltipString;

                //=============================end of this is used======================//

                //newSeries.MarkerStyle = MarkerStyle.Circle;
                //newSeries.Points.AddXY(menuStripNodeInfoValues[index - 1].xVal, menuStripNodeInfoValues[index].xVal, menuStripNodeInfoValues[index - 1].yVal, menuStripNodeInfoValues[index].yVal);
                //newLineSeries.Points.Add(new DataPoint(menuStripNodeInfoValues[index - 1].xVal, menuStripNodeInfoValues[index - 1].yVal));
                newLineSeries.Points.Add(new DataPoint(menuStripNodeInfoValues[previousNodeIndexForLineInput].xVal, menuStripNodeInfoValues[previousNodeIndexForLineInput].yVal));
                //double mid_point_XValue = (menuStripNodeInfoValues[index - 1].xVal + menuStripNodeInfoValues[index].xVal)/ 2;
                //double mid_point_YValue = (menuStripNodeInfoValues[index - 1].yVal + menuStripNodeInfoValues[index].yVal) / 2;
                double mid_point_XValue = (menuStripNodeInfoValues[previousNodeIndexForLineInput].xVal + menuStripNodeInfoValues[index].xVal) / 2;
                double mid_point_YValue = (menuStripNodeInfoValues[previousNodeIndexForLineInput].yVal + menuStripNodeInfoValues[index].yVal) / 2;

                newLineSeries.Points.Add(new DataPoint(mid_point_XValue, mid_point_YValue));
                newLineSeries.Points.Add(new DataPoint(menuStripNodeInfoValues[index].xVal, menuStripNodeInfoValues[index].yVal));

                if(lineStatus_ON_OFF == 1)
                {
                    newLineSeries.Points[1].Color = colorValue;
                    newLineSeries.Points[1].Label = lineName;
                }
                chart1.Series.Add(newLineSeries);
                chart1.Series[newLineSeries.Name].BorderWidth = 3;


            }



            index++;
            previousNodeIndexForLineInput = IndexOfPreviousNodeForLineFunction();


        }//close of buttons
        public void AddMixNodeBetweenTwoNodes()
        {
            //Steps: 
            /*
            1.Identify node1 and node2,
            2. CALCULATE THE mid point using section  formula
           (x1,y1)-------------------------------(x2,y2)
                  <------m-->P(x,y)<------n----->  

           P(x,y) = [(m*x2+n*x1)/(m+n),(m*y2+n*y1)/(m+n)]

            */

            //============Lets check first=======

            if(indexOfPrevPointForLineMovement == ""|| indexOfNextNodeForLineMovement == "")
            {
                return;//If index seleted is empty return
            }





            mixCorrespondingNodeValuesList.Clear();

            //--ADDING NODE1 info
            foreach(var node in menuStripNodeInfoValues)
            {
                //--Now lets find which node is being found
              if(node.id == indexOfPrevPointForLineMovement)
                {
                    //Previous node is found ie node1

                    mixCorrespondingNodeValuesList.Add(new TempDataType
                    {
                        id = node.id,
                        name= node.name,
                        xVal = node.xVal,
                        yVal = node.yVal,
                        temperature_source = node.temperature_source ,
                        humidity_source = node.humidity_source,
                        colorValue = node.colorValue ,
                        airFlow =  node.airFlow,
                        marker_Size =  node.marker_Size,
                        lastUpdatedDate =  node.lastUpdatedDate

                    });//This is the node of previous node found
                    break;
                }
              
            }

            //Adding node2 info
            foreach (var node in menuStripNodeInfoValues)
            {
                //--Now lets find which node is being found
                if (node.id == indexOfNextNodeForLineMovement)
                {
                    //Previous node is found ie node1

                    mixCorrespondingNodeValuesList.Add(new TempDataType
                    {
                        id = node.id,
                        name = node.name,
                        xVal = node.xVal,
                        yVal = node.yVal,
                        temperature_source = node.temperature_source,
                        humidity_source = node.humidity_source,
                        colorValue = node.colorValue,
                        airFlow = node.airFlow,
                        marker_Size = node.marker_Size,
                        lastUpdatedDate = node.lastUpdatedDate

                    });//This is the node of previous node found
                    break;
                }

            }//Close of for each..


            //Now let x_mix,y_mix contain the mix value of node
            double m = mixCorrespondingNodeValuesList[0].airFlow;
            double n = mixCorrespondingNodeValuesList[1].airFlow;
            double x1 = mixCorrespondingNodeValuesList[0].xVal;
            double y1 = mixCorrespondingNodeValuesList[0].yVal;

            //x2,y2;
            double x2 = mixCorrespondingNodeValuesList[1].xVal;
            double y2 = mixCorrespondingNodeValuesList[1].yVal;
                                                          


            double x_mix = ((n * x2) + (m * x1)) / (m + n);
            double y_mix = ((n * y2) + (m * y1)) / (m + n);
            //Now we know the coordinates we need to plot now..

            string idForNode = GetGUID();//This get the id
            int mixAirFlowContent = (int)(m + n);




            //Finding appropriate name
            string mixNodeName = UniqueMixName();


            //--Now insert into db first then only plot the values



            //--Now lets update the values 
            DatabaseOperations ObjDbOperation = new DatabaseOperations();
            //  MessageBox.Show("Building Name= " + selectedBuildingList[0].BuildingName);
            // MessageBox.Show(unique_id_for_node+"xval = "+ xval+" yval"+ yval+"temp "+ temperature_sourceGlobal+"hum="+ humidity_sourceGlobal+",name="+ tbName+",col="+ colorValue+",size=" +markerSize +",air="+airFlowValueGlobal.ToString());
            ObjDbOperation.InsertNodeInfoToDBWithoutDeviceInfo(CurrentSelectedBuilding, chartDetailList[indexForWhichChartIsSelected].chart_respective_nodeID, idForNode, x_mix, y_mix, "Mix","Mix", mixNodeName, Color.Blue, 20, mixAirFlowContent.ToString());

            //--Now inserting the node info
            ObjDbOperation.InsertMixNodeInfo(CurrentSelectedBuilding,chartDetailList[indexForWhichChartIsSelected].chartID, idForNode, indexOfPrevPointForLineMovement, indexOfNextNodeForLineMovement);//Insertion operation

            //Now plotting the values
                             
            //=================Now refreshing the data =======================//
            //indexOfChartSelected = e.RowIndex;    //This value is changed 
            LoadNodeAndLineFromDB(indexOfChartSelected);   //Lets make it passing the stirngs 

            //flagForInsertOrUpdateDataToDB = 1;
            //--This is also completed..
            ReDrawingLineAndNode();  //Done checking bbk modif: changing to alex db 

             //====================End of data refresh

        }