WFA_psychometric_chart.Form1_main.LoadDataFromFileToDBConfiguration C# (CSharp) Method

LoadDataFromFileToDBConfiguration() public method

public LoadDataFromFileToDBConfiguration ( ) : void
return void
        public void LoadDataFromFileToDBConfiguration()
        {
            //--This helps in loading function 

            //--Now required function and tables 

            //--nothing just clearing the values
            //--Resetting values first
            //chartInfoPulledForSaving.Clear();
            //nodeInfoPulledForSaving.Clear();
            //lineInfoPulledForSaving.Clear();
            //deviceInfoPulledForSaving.Clear();
            //comfortZoneInforForEachChartForSaving.Clear();
            //ComfortZonesDetailForSaving.Clear();


            //--This reads the value of data form db lets use list for storing the data
            string chartTableName = "tbl_chart_detail";
            string nodeTableName = "tbl_node_value";
            string lineTableName = "tbl_line_value";
            string tableNameDevice = "tbl_device_info_for_node";//currentNodeTableFromDB; 
            string tableForComfortZoneSetting = "tbl_chart_comfort_zone_setting";
            string tableForCF_Detail = "tbl_comfort_zone_detail";
            string tableForMixNode = "tbl_mix_node_info";

           
            OpenFileDialog theDialog = new OpenFileDialog();
            theDialog.Title = "Open s3db File";
            theDialog.Filter = "s3db files|*.s3db";
            theDialog.InitialDirectory = @"C:\";
            if (theDialog.ShowDialog() == DialogResult.OK)
            {
               // MessageBox.Show(theDialog.FileName.ToString());
                //here we are going to read the data and all the function 

                //lets get the id values...
                //string databasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string databaseFile = theDialog.FileName;
                string pathToFile =@"Data Source=" + databaseFile + ";Version=3;";

                // MessageBox.Show("BBK TEST Hellow,PATH = "+pathToFile);


                //Test(pathToFile);
                //return;

                //--This function reads the data
                //####### TASK1 :Read data
                // try {
               // MessageBox.Show("read data"); 
                ReadDataForSavingConfiguration_For_Load(pathToFile, chartTableName, nodeTableName, lineTableName, tableNameDevice, tableForComfortZoneSetting, tableForCF_Detail, tableForMixNode);//This reads all the data

               // MessageBox.Show("finish read data");
                //}catch(Exception ex)
                //{
                //    MessageBox.Show("Exception data : " + ex.Data + ",\nexp mess:" + ex.Message + "\nexp source" + ex.Source + "exp " + ex);
                //}
                // MessageBox.Show("Hellow END");

                //######### TASK2: Delete data
                //--Now removing the table datas form db 
                // string tableName = "tbl_" + selectedBuildingList[0].BuildingName + "_device_info_for_node";// "tbl_" ++"_node_value";
                string databasePath1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string databaseFileName1 = databasePath1 + @"\db_psychrometric_project.s3db";

                //--Table names
                string chartTableName1 = "tbl_" + selectedBuildingList[0].BuildingName + "_chart_detail";
                string nodeTableName1 = "tbl_" + selectedBuildingList[0].BuildingName + "_node_value";
                string lineTableName1 = "tbl_" + selectedBuildingList[0].BuildingName + "_line_value";
                string tableNameDevice1 = "tbl_" + selectedBuildingList[0].BuildingName + "_device_info_for_node";//currentNodeTableFromDB; 
                string tableForComfortZoneSetting1 = "tbl_" + selectedBuildingList[0].BuildingName + "_chart_comfort_zone_setting";
                string tableForCF_Detail1 = "tbl_" + selectedBuildingList[0].BuildingName + "_comfort_zone_detail";
                string tableformixnode = "tbl_" + selectedBuildingList[0].BuildingName + "_mix_node_info";

                DeleteAllDataFromTable(databaseFileName1, chartTableName1);
                DeleteAllDataFromTable(databaseFileName1, nodeTableName1);
                DeleteAllDataFromTable(databaseFileName1, lineTableName1);
                DeleteAllDataFromTable(databaseFileName1, tableNameDevice1);
                DeleteAllDataFromTable(databaseFileName1, tableForComfortZoneSetting1);
                DeleteAllDataFromTable(databaseFileName1, tableForCF_Detail1);
                DeleteAllDataFromTable(databaseFileName1, tableformixnode);

                //####### TASK3 : Writing to db 
                //Now writing the data to db

                string chartTableNamex = "tbl_" + selectedBuildingList[0].BuildingName + "_chart_detail";
                string nodeTableNamex = "tbl_" + selectedBuildingList[0].BuildingName + "_node_value";
                string lineTableNamex = "tbl_" + selectedBuildingList[0].BuildingName + "_line_value";
                string tableNameDevicex = "tbl_" + selectedBuildingList[0].BuildingName + "_device_info_for_node";//currentNodeTableFromDB; 
                string tableForComfortZoneSettingx = "tbl_" + selectedBuildingList[0].BuildingName + "_chart_comfort_zone_setting";
                string tableForCF_Detailx = "tbl_" + selectedBuildingList[0].BuildingName + "_comfort_zone_detail";
                string tableformixnodex = "tbl_" + selectedBuildingList[0].BuildingName + "_mix_node_info";

               // MessageBox.Show("Loading Here mix table "+ tableformixnodex+"dbfILE NAME"+ databaseFileName1);

                InsertForSavingConfiguration_For_Load(databaseFileName1, chartTableNamex, nodeTableNamex, lineTableNamex, tableNameDevicex, tableForComfortZoneSettingx, tableForCF_Detailx, tableformixnodex);


               // MessageBox.Show("InsertioncOMPLETE");
                //--Pulling data and plotting values--
                //DataGridView_Show_Data();
                //Now reloading the data 
               PullDataAndPlot();

            }
        }
Form1_main