private void loadDataForSection(byte typ_prierezu) { //MessageBox.Show("loadDataForSection()"+typ_prierezu); // Data from DATA1-SECTIONS_VAR2 - Variable string sql = "Select * from sections_var2 where csprofshape_var like '" + typ_prierezu + "'"; dat_reader = dat_conn.getDBReader(sql); dat_reader.Read(); dat_reader.GetValues(collection1); // Data from DATA1-SECTIONS_VAR2 - Variable Table Name sql = "Select * from sections_var2 where id_sections_var2 like '1'"; dat_reader = dat_conn.getDBReader(sql); dat_reader.Read(); dat_reader.GetValues(collection2); // Data from DATA1-SECTIONS_VAR2 - Units sql = "Select * from sections_var2 where id_sections_var2 like '3'"; dat_reader = dat_conn.getDBReader(sql); dat_reader.Read(); dat_reader.GetValues(collection3); // SECTION VARIABLES CHECKED LIST BOX 1 //prvych 5 stlpcov v databaze vynechavame info1 = new CheckedListInfo(); for (int i = 5; i < collection1.Count(); i++) { if (!collection1[i].ToString().Equals("")) { info1.ZoznamPremennych.Add(collection1[i].ToString()); info1.ZoznamZobrazPremennych.Add(collection2[i].ToString()); info1.ZoznamJednotiek.Add(collection3[i].ToString()); info1.ZoznamZasktPrem.Add(false); } } zozChLInfos[typ_prierezu, 0] = info1; this.SaveData(); }
public void loadDataUserInputandResult(byte typ_pr) { info2 = new CheckedListInfo(); //MessageBox.Show("loadDataUserInputandResult"+typ_prierezu); // Checked List Box2 - USER DATA for (int i = 0; i < checkedListBox3.Items.Count; i++) { info2.ZoznamPremennych.Add(checkedListBox3.Items[i].ToString()); info2.ZoznamZasktPrem.Add(false); } info3 = new CheckedListInfo(); // Checked List Box3 - CENEX DATA - OUTPUT for (int i = 0; i < checkedListBox4.Items.Count; i++) { info3.ZoznamPremennych.Add(checkedListBox4.Items[i].ToString()); info3.ZoznamZasktPrem.Add(false); } zozChLInfos[typ_pr, 1] = this.info2; zozChLInfos[typ_pr, 2] = info3; this.SaveData(); }
private void LoadData() { //MessageBox.Show("LoadData()"); try { FileStream fsIn = new FileStream("checkList.dat", FileMode.Open); BinaryFormatter binF2 = new BinaryFormatter(); this.zozChLInfos = (CheckedListInfo[,])binF2.Deserialize(fsIn); fsIn.Close(); //MessageBox.Show("load" + typ_prierezu.ToString()); this.info1 = (CheckedListInfo)zozChLInfos[typ_prierezu, 0]; this.info2 = (CheckedListInfo)zozChLInfos[typ_prierezu, 1]; this.info3 = (CheckedListInfo)zozChLInfos[typ_prierezu, 2]; // STEEL this.infoSteel = (CheckedListInfo)zozChLInfos[0, 0]; //reserved place for info about Steel } catch (FileNotFoundException) //ak nie je najdeny subor "checkList.dat" { //pre kazdy prierez zavolame merodu loadDataForSection a loadDataUserInputandResult(i); for (byte i = 1; i <= 10; i++) { this.loadDataForSection(i); this.loadDataUserInputandResult(i); } this.loadDataForSteel(); } catch (NullReferenceException) { } }