} //--Close of method /// <summary> /// it checks weather the data is present or not and if not present /// it inserts new data /// </summary> private void ReadDataPresentOrNotThenInsertBuildingValue() { if (ReadDataForBuildingSelectedFromPsychrometric() == false) { //--If there is no data selected we need to insert the new data string databasePath1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string databaseFile = databasePath1 + @"\db_psychrometric_project.s3db"; Form1_main f1 = new Form1_main(); //--new database file //SQLiteConnection.CreateFile(databaseFile); //--now lets create the tables using (SQLiteConnection m_dbConnection = new SQLiteConnection($"Data Source={databaseFile};Version=3;")) { m_dbConnection.Open(); string sql_stringx = "insert into tbl_building_location ( selection ,country ,state,city ,street,longitude,latitude ,elevation ,BuildingName ,EngineeringUnits ) VALUES( @sel ,@con,@state ,@city,@stre , @lng ,@lat,@elev ,@bname ,@engUnit )"; SQLiteCommand command9 = new SQLiteCommand(sql_stringx, m_dbConnection); command9.CommandType = CommandType.Text; command9.Parameters.AddWithValue("@sel", "1"); command9.Parameters.AddWithValue("@con", f1.BuildingSelected[0].country); command9.Parameters.AddWithValue("@state", f1.BuildingSelected[0].state); command9.Parameters.AddWithValue("@city", f1.BuildingSelected[0].city); command9.Parameters.AddWithValue("@stre", f1.BuildingSelected[0].street); command9.Parameters.AddWithValue("@lng", f1.BuildingSelected[0].longitude); command9.Parameters.AddWithValue("@lat", f1.BuildingSelected[0].latitude); command9.Parameters.AddWithValue("@elev", f1.BuildingSelected[0].elevation); command9.Parameters.AddWithValue("@bname", f1.BuildingSelected[0].Building_Name); command9.Parameters.AddWithValue("@engUnit", f1.BuildingSelected[0].EngineeringUnits); command9.ExecuteNonQuery(); } } }
private void btnGoBack_Click(object sender, EventArgs e) { Form1_main f1 = new Form1_main(); f1.Close(); this.Close(); }
public Application_Form4(Form1_main form1) //:this() { this.form1 = form1;//defined in top.. InitializeComponent(); this.Disposed += new System.EventHandler(this.Application_Form4_Disposed); }
/// <summary> /// Functions helps to load teh values that hare dissabled in the list /// </summary> public void LoadDataFromDB() { //--We need to pass the buildingName value Form1_main f1 = new Form1_main(); f1.CheckSelectedBuilding(); string buildingName = f1.selectedBuildingList[0].BuildingName; // f1.CurrentSelectedBuilding;//f1.selectedBuildingList[0].BuildingName; buildingNameGlobal = buildingName; // MessageBox.Show("BuildingName = " + buildingNameGlobal); if (buildingNameGlobal == "") { //If no building is selected then do not go futher return; } PullChartList(buildingName); // MessageBox.Show("number of list value items = " + chartDetailListForDissabledValue.Count); //--Now lets load the values in the database fillDataGridView();//This will load the values form db // } }
public form_app_timer_historical_plot(Form1_main form1) { this.form1 = form1; InitializeComponent(); this.Disposed += new System.EventHandler(this.form_app_timer_Disposed); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //==Before any thign lets run this code because we need language values which is set by this =================// Form1_main f1 = new Form1_main(); f1.FindPathOfBuildingDBNewVersion(); string selectedBuildingFromT3000 = f1.BuildingSelected[0].Building_Name;//This stores the building name selected in alex part string databasePath1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string databaseFile1 = databasePath1 + @"\db_psychrometric_project.s3db"; DatabaseOperation db_op = new DatabaseOperation(); if (File.Exists(databaseFile1)) { //file exist so dont create the database //MessageBox.Show("File exist section"); db_op.sqlite_database_creation_For_UpdateCondition(selectedBuildingFromT3000); //MessageBox.Show("finish of sqlite_database_creation_For_UpdateCondition "); //--This one is for checking if the data is present or not if not presnet then create db_op.ReadDataForBuildingSelectedFromPsychrometric(); //--We find selected building in Psychro metric database BuildingIdentificationClass bic = new BuildingIdentificationClass(); if (db_op.listBuildingSelectedInfo[0].BuildingName != "") { bic.CheckingAndUpdatingBuildingDataFromT3000ToPsychro(selectedBuildingFromT3000, db_op.listBuildingSelectedInfo[0].BuildingName); } else { //The previous building selected in Psy is empty MessageBox.Show("Internal Error no building is selected. Program will run default building settings"); db_op.UpdateIDOneSelectBuildingInPsychro(); db_op.SelectBuildingInPsychro("Default_Building");//Selecting the default building } } else { //MessageBox.Show("Internal database not found. Creating fresh database"); //this.Close(); if (selectedBuildingFromT3000 != "") { //--sqlite new databse creation if (f1.BuildingSelected[0].Building_Name != "" && f1.BuildingSelected[0].country != "" && f1.BuildingSelected[0].city != "") { f1.sqlite_database_creation(selectedBuildingFromT3000); } else { if (MessageBox.Show("Please enter the building location information first in T300 and then restart the application.\n Do you want to continue with the default settings", "Chose an option", MessageBoxButtons.YesNo) == DialogResult.Yes) { string buildingName = "Default_Building"; //--Seprate code is required because first time when application starts no //--Building info provided so we have to go with default settings f1.sqlite_database_creationWithDefaultSettingsOnly(buildingName);//Passing BuildingName //Previous code doesnot selecte default building so to select default building do this on db_op.SelectBuildingInPsychro(buildingName); } else { string databasePath133 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string databaseFile = databasePath133 + @"\db_psychrometric_project.s3db"; if (File.Exists(databaseFile)) { File.Delete(databaseFile); } Environment.Exit(0); Application.Exit(); }//Close of else } } else { //End the application MessageBox.Show("Could not create new databse.Closing!"); Application.Exit();//Close the application } } //===================End of this section=======================// //Show the language select dialog MultiLang.SelectLanguage frmLang = new MultiLang.SelectLanguage(); //MessageBox.Show("frm lang" + frmLang); frmLang.LoadSettingsAndShow(); frmLang.Dispose(); frmLang = null; Application.Run(new Form1_main()); }
public EditNodeLineForm(Form1_main b) { this.bcs = b; InitializeComponent(); dataGridView1.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(dataGridView1_EditingControlShowing); }
public Form_Input_For_Seriespoint(Form1_main fm_p_d) { this.F1 = fm_p_d; InitializeComponent(); this.Disposed += new System.EventHandler(this.Form_Input_For_Seriespoint_Disposed); }
public form_heat_map(Form1_main formx) { this.form1 = formx; InitializeComponent(); this.Disposed += new System.EventHandler ( this.form_heat_map_Disposed ); }
public DataGridViewDisplay(Form1_main formx) { this.form1 = formx; InitializeComponent(); }
public TrashBox(Form1_main f) { f1 = f; InitializeComponent(); }
private void CB_Device_SelectedIndexChanged(object sender, EventArgs e) { try { //now on index change // groupBox3.Enabled = true; //Lets clear the combobox first CB_param_temp.Items.Clear(); CB_param_hum.Items.Clear(); parameterValFromBacnet.Clear();//Clearing the list value if (CB_Device.SelectedIndex > -1) { //This one is if the timer is running then stop the timer second time if (flagForTimer == 1) { //Timer is already set so dissable it first and then reenable... _Timer.Enabled = false; _Timer.Elapsed -= HandleTick; //new System.EventHandler(HandleTick); _Timer.Dispose(); flagForTimer = 0;//Timer dissabled } //On this index change the we need to get the values from the int indexSelectedDevice = CB_Device.SelectedIndex; int instanceId = copyOfMainControllerList[indexSelectedDevice].controllerInstanceId; //(int)device_info[indexSelectedDevice].deviceInstance;//Device instance selected. // MessageBox.Show("Instaneid = " + instanceId); //===============For regulare update=============// deviceInstanceValuTemp = instanceId;//This one is for regular update //================end of for regular update=====// //This uint has to be converted to int because that is what is required... //Checking if the device is online or offline if (CheckDeviceOnlineOffline(deviceInstanceValuTemp, 0) == true) { // MessageBox.Show("Checking online status become true"); //return; DeviceConnection db = new DeviceConnection(); //We need to scan for the device first and then parameter db.ScanForDevice(); //db.ScanForParameters(24649); db.ScanForParameters(instanceId);//This will return the parameters // MessageBox.Show("Count = " + db.parameterListValue.Count); //Now we can use the value strored int the db.parameterList1 string s = ""; foreach (var bac in db.parameterListValue) { parameterValFromBacnet.Add(new parameter_class1 { device_object_name = bac.device_object_name, indexID = bac.indexID, presentValue = bac.presentValue , object_identifier_type = bac.object_identifier_type }); // s += bac.device_object_name + "," + bac.presentValue + "\n"; } // MessageBox.Show("value = " + s); //Now that we have the parameter list lets display the list in the combobox... // string s = ""; //foreach (var item in parameterValFromBacnet) //{ // CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID); // CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID); // // CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID); // // s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n"; //} //======================Temperature and humidity filtering here========================// //**************************First Temperature filtering*******************************// //--Here we need to scan form th e T3000 database and then publish the list which is there /* Task : 1.Read the data from the alex db 2.Find only TEMPERATURE VALUE 3.Filter and display only temperature values */ Form1_main f = new Form1_main(); string path_to_alexdb = f.PathToT3000BuildingDB;// PathToT3000BuildingDB; ReadDataFromAlexDatabase("INPUTable"); //--Now the actual temperature filtering Starts here========================// //--This only filteres temperature inside alex db FilterOnlyTemperatureAndHumidityFromAlexDBValue();//Returns FilteredTemperatureValueList as a result //--Returns AfterFilteringFromAlexValueListOfValues FilterDataForDisplayInList();//Filteres value form alex db and give new value to insert to list teurns:AfterFilteringFromAlexValueListOfValues foreach (var item in AfterFilteringFromAlexValueListOfValues) { CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID + "[Value = " + item.presentValue + "]"); // CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID); // CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID); // s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n"; } //*************************End of temperature filtering****************************// //************************Humidity Filtering***************************************// //--This only filteres temperature inside alex db FilterOnlyHumidityFromAlexDBValue();//Returns FilteredTemperatureValueList as a result //--Returns AfterFilteringFromAlexValueListOfValues FilterDataForDisplayInListForHumidity();//Filteres value form alex db and give new value to insert to list teurns:AfterFilteringFromAlexValueListOfValues foreach (var item in AfterFilteringFromAlexValueListOfValuesForHumidityOnly) { //CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID + "[" + item.presentValue + "]"); CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID + "[Value = " + item.presentValue + "]"); // CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID); // CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID); // s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n"; } //************************End of humidity filtering****************************// CB_param_temp.Enabled = true; CB_param_hum.Enabled = true; //MessageBox.Show("ENd of the true"); //TEST } else { //Show device is offline lb_device_status.Text = "disconnected"; } }//Close of if }catch(Exception ex) { MessageBox.Show(ex.Message); } }
public Form_input_by_temp_hum_for_main(Form1_main f) { F1 = f; InitializeComponent(); }
//:this() public Application_Form4(Form1_main form1) { this.form1 = form1;//defined in top.. InitializeComponent(); this.Disposed += new System.EventHandler ( this.Application_Form4_Disposed ); }
private void CB_Device_SelectedIndexChanged(object sender, EventArgs e) { //--This is when the controller is selected and value is added to it //--This load the data form the device rather then access db /* Steps : 1. Get the data and then pull the value */ groupBox3.Enabled = true; //Lets clear the combobox first CB_param_temp.Items.Clear(); // CB_param_hum.Items.Clear(); parameterValFromBacnet.Clear();//Clearing the list value if (CB_Device.SelectedIndex > -1) { //On this index change the we need to get the values from the indexSelectedDevice = CB_Device.SelectedIndex; int instanceId = (int)copyOfMainControllerList[indexSelectedDevice].controllerInstanceId;//Device instance selected. deviceInstanceValuTemp = instanceId; // MessageBox.Show("instance id = " + instanceId); // MessageBox.Show("Device checkonline offline = " + CheckDeviceOnlineOffline(deviceInstanceValuTemp, 0)); if (CheckDeviceOnlineOffline(deviceInstanceValuTemp, 0) == true) { //This uint has to be converted to int because that is what is required... DeviceConnection db = new DeviceConnection(); db.ScanForDevice(); db.ScanForParameters(instanceId);//This will return the parameters //resert first device_info.Clear(); foreach (var bn in BACnetClass.DevicesList) { device_info.Add(new DeviceClass { deviceInstance = bn.device_id, deviceIP = bn.device_id + "." + bn.adr.adr[0] + "." + bn.adr.adr[1] + "." + bn.adr.adr[2] + "." + bn.adr.adr[3] }); } // MessageBox.Show("parameterListValue count option = " + db.parameterListValue.Count); //Now we can use the value strored int the db.parameterList1 string s = ""; foreach (var bac in db.parameterListValue) { parameterValFromBacnet.Add(new parameter_class1 { device_object_name = bac.device_object_name, indexID = bac.indexID, presentValue = bac.presentValue, object_identifier_type = bac.object_identifier_type }); // s += "\n"+bac.device_object_name + ",["+ bac.indexID + "]"+ bac.presentValue+",TYPE = "+bac.object_identifier_type; } //MessageBox.Show("Data returned from backnet value =\n " + s); //--Here we need to scan form th e T3000 database and then publish the list which is there /* Task : 1.Read the data from the alex db 2.Find only TEMPERATURE VALUE 3.Filter and display only temperature values */ Form1_main f = new Form1_main(); string path_to_alexdb = f.PathToT3000BuildingDB;// PathToT3000BuildingDB; ReadDataFromAlexDatabase( "INPUTable"); //--This only filteres temperature inside alex db FilterOnlyTemperatureAndHumidityFromAlexDBValue();//Returns FilteredTemperatureValueList as a result //--Returns AfterFilteringFromAlexValueListOfValues FilterDataForDisplayInList();//Filteres value form alex db and give new value to insert to list teurns:AfterFilteringFromAlexValueListOfValues foreach (var item in AfterFilteringFromAlexValueListOfValues) { CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID+ "[Value = " + item.presentValue + "]"); // CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID); // CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID); // s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n"; } CB_param_temp.Enabled = true; //Now that we have the parameter list lets display the list in the combobox... // string s = ""; //foreach (var item in parameterValFromBacnet) //{ // CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID); // // CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID); // // CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID); // // s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n"; //} }//close of the device is online or offline else { MessageBox.Show("Device is offline"); } //TEST // MessageBox.Show("s = " + s); }//Close of if }
public comfort_zone(Form1_main b) { InitializeComponent(); this.bs = b; }
public Form_Input_For_Seriespoint(Form1_main fm_p_d) { this.F1 = fm_p_d; InitializeComponent(); this.Disposed += new System.EventHandler ( this.Form_Input_For_Seriespoint_Disposed ); }
public TrashBox(Form1_main f) { f1 = f; InitializeComponent(); }
public form_heat_map(Form1_main formx) { this.form1 = formx; InitializeComponent(); this.Disposed += new System.EventHandler(this.form_heat_map_Disposed); }
/// <summary> /// Functions helps to load teh values that hare dissabled in the list /// </summary> public void LoadDataFromDB() { //--We need to pass the buildingName value Form1_main f1 = new Form1_main(); f1.CheckSelectedBuilding(); string buildingName = f1.selectedBuildingList[0].BuildingName; // f1.CurrentSelectedBuilding;//f1.selectedBuildingList[0].BuildingName; buildingNameGlobal = buildingName; // MessageBox.Show("BuildingName = " + buildingNameGlobal); if(buildingNameGlobal == "") { //If no building is selected then do not go futher return; } PullChartList(buildingName); // MessageBox.Show("number of list value items = " + chartDetailListForDissabledValue.Count); //--Now lets load the values in the database fillDataGridView();//This will load the values form db // } }
public form_app_timer_historical_plot(Form1_main form1) { this.form1 = form1; InitializeComponent(); this.Disposed += new System.EventHandler ( this.form_app_timer_Disposed ); }
int deviceInstanceValuTemp = 0; //This for particular device private void CB_Device_SelectedIndexChanged(object sender, EventArgs e) { //--This is when the controller is selected and value is added to it //--This load the data form the device rather then access db /* * Steps : * 1. Get the data and then pull the value */ groupBox3.Enabled = true; //Lets clear the combobox first CB_param_temp.Items.Clear(); // CB_param_hum.Items.Clear(); parameterValFromBacnet.Clear();//Clearing the list value if (CB_Device.SelectedIndex > -1) { //On this index change the we need to get the values from the indexSelectedDevice = CB_Device.SelectedIndex; int instanceId = (int)copyOfMainControllerList[indexSelectedDevice].controllerInstanceId;//Device instance selected. deviceInstanceValuTemp = instanceId; // MessageBox.Show("instance id = " + instanceId); // MessageBox.Show("Device checkonline offline = " + CheckDeviceOnlineOffline(deviceInstanceValuTemp, 0)); if (CheckDeviceOnlineOffline(deviceInstanceValuTemp, 0) == true) { //This uint has to be converted to int because that is what is required... DeviceConnection db = new DeviceConnection(); db.ScanForDevice(); db.ScanForParameters(instanceId); //This will return the parameters //resert first device_info.Clear(); foreach (var bn in BACnetClass.DevicesList) { device_info.Add(new DeviceClass { deviceInstance = bn.device_id, deviceIP = bn.device_id + "." + bn.adr.adr[0] + "." + bn.adr.adr[1] + "." + bn.adr.adr[2] + "." + bn.adr.adr[3] }); } // MessageBox.Show("parameterListValue count option = " + db.parameterListValue.Count); //Now we can use the value strored int the db.parameterList1 string s = ""; foreach (var bac in db.parameterListValue) { parameterValFromBacnet.Add(new parameter_class1 { device_object_name = bac.device_object_name, indexID = bac.indexID, presentValue = bac.presentValue, object_identifier_type = bac.object_identifier_type }); // s += "\n"+bac.device_object_name + ",["+ bac.indexID + "]"+ bac.presentValue+",TYPE = "+bac.object_identifier_type; } //MessageBox.Show("Data returned from backnet value =\n " + s); //--Here we need to scan form th e T3000 database and then publish the list which is there /* * Task : * 1.Read the data from the alex db * 2.Find only TEMPERATURE VALUE * 3.Filter and display only temperature values */ Form1_main f = new Form1_main(); string path_to_alexdb = f.PathToT3000BuildingDB;// PathToT3000BuildingDB; ReadDataFromAlexDatabase("INPUTable"); //--This only filteres temperature inside alex db FilterOnlyTemperatureAndHumidityFromAlexDBValue();//Returns FilteredTemperatureValueList as a result //--Returns AfterFilteringFromAlexValueListOfValues FilterDataForDisplayInList();//Filteres value form alex db and give new value to insert to list teurns:AfterFilteringFromAlexValueListOfValues foreach (var item in AfterFilteringFromAlexValueListOfValues) { CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID + "[Value = " + item.presentValue + "]"); // CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID); // CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID); // s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n"; } CB_param_temp.Enabled = true; //Now that we have the parameter list lets display the list in the combobox... // string s = ""; //foreach (var item in parameterValFromBacnet) //{ // CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID); // // CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID); // // CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID); // // s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n"; //} }//close of the device is online or offline else { MessageBox.Show("Device is offline"); } //TEST // MessageBox.Show("s = " + s); }//Close of if }
public Form_handler(Form1_main f) { this.form1Object = f; InitializeComponent(); }
public void CheckingAndUpdatingBuildingDataFromT3000ToPsychro(string buildingNameFromT3000, string buildingNameFromPsychro) { Form1_main f1 = new Form1_main(); DatabaseOperation db_o = new DatabaseOperation(); //Just a check if (buildingNameFromT3000 == "" || buildingNameFromPsychro == "") { //MessageBox.Show($"Values are empty T300building ={buildingNameFromT3000} , and psy = {buildingNameFromPsychro}"); return; } if (buildingNameFromPsychro == buildingNameFromT3000) { //--Matched then select this one db_o.SelectBuildingInPsychro(buildingNameFromT3000); // MessageBox.Show($"Matched db selected = { buildingNameFromPsychro}"); } else { //--Not matched so first check data present or not to select if (CheckDataPresentInPsychro(buildingNameFromT3000)) { // MessageBox.Show("Data present in psycho CheckDataPresentInPsychro is true"); //--Data present, only selection db_o.SelectBuildingInPsychro(buildingNameFromT3000); } else { //--False f1.FindPathOfBuildingDBNewVersion(); if (f1.BuildingSelected[0].country != "" && f1.BuildingSelected[0].Building_Name != "") { // MessageBox.Show("country and building name not empty f1.BuildingSelected[0].country != f1.BuildingSelected[0].Building_Name != is true"); f1.WriteT3000BuildingInfoToPsychoDB("1", f1.BuildingSelected[0].country, f1.BuildingSelected[0].state, f1.BuildingSelected[0].city, f1.BuildingSelected[0].street, f1.BuildingSelected[0].longitude, f1.BuildingSelected[0].latitude, f1.BuildingSelected[0].elevation, f1.BuildingSelected[0].Building_Name, f1.BuildingSelected[0].EngineeringUnits); db_o.SelectBuildingInPsychro(f1.BuildingSelected[0].Building_Name); } else { //--Building info is not present string text = "Current selected building location information is not provided. Input the location information in T3000 in building configuration section.\nDo you wish to continue with default settings?"; if (MessageBox.Show(text, "System configuration warning", MessageBoxButtons.YesNo) == DialogResult.Yes) { //--Yes is click continue with the default settings. string buildingName = "Default_Building"; db_o.SelectBuildingInPsychro(buildingName); } else { //MessageBox.Show("Application close "); //--NO selected f1.Close();//just close the form and the application Environment.Exit(0); Application.Exit(); } } } } }
public comfort_zone(Form1_main b) { InitializeComponent(); this.bs = b; }
public DataGridViewDisplay(Form1_main formx) { this.form1 = formx; InitializeComponent(); }
public Form_input_by_temp_hum_for_main(Form1_main f) { F1 = f; InitializeComponent(); }
public buildingChartSetting(Form1_main f) { this.form1Object = f; InitializeComponent(); }