////<update/add> public void addClass() { foreach (string[] s in dbcmd.getValues("SELECT `class_id`,`fk_day`,`panel_name`,`fk_subject`,`fk_instructor`,`fk_time`,`fk_etime`,`fk_room` FROM `tbl_class` WHERE `class_id` = '2' AND `fk_day` = '" + dbcmd.getData("SELECT `day_id` FROM `tbl_day` WHERE `description` = '" + day + "'") + "' ORDER BY `fk_time` ASC")) { if (!day_cntnr.Controls.ContainsKey(s[1])) { Class_box cbc = new Class_box(); cbc.onControlCountChanged += _onControlCountChanged; cbc.onClassUpdate += updateClass; cbc.setParet(this); onControlCountChanged(); cbc.Dock = DockStyle.Top; day_cntnr.Controls.Add(cbc); day_cntnr.Controls.SetChildIndex(cbc, 1); cbc.setSection(s[0]); cbc.setDay(s[1]); cbc.setPanelname(s[2]); cbc.setSubjetcode(s[3]); cbc.setInstructor(s[4]); cbc.setStartingTime(s[5]); cbc.setEndingTime(s[6]); cbc.setRoom(s[7]); onControlCountChanged(); } else { continue; } } }
private void button_add_day_Click(object sender, EventArgs e) { Class_box cbc = new Class_box(); cbc.onClassUpdate += updateClass; cbc.onControlCountChanged += _onControlCountChanged; onControlCountChanged(); day_cntnr.Controls.Add(cbc); cbc.Dock = DockStyle.Top; day_cntnr.Controls.SetChildIndex(cbc, 1); cbc.setPanelname(panelname + "_" + day + "_" + ctrlname()); cbc.setSection(section); cbc.setDay(dbcmd.getData("SELECT `day_id` FROM `sstss_data`.`tbl_day` WHERE `description` = '" + day + "'")); }