private void LoadClasses() { this.classUC.flpClassList.Controls.Clear(); List <Class> list = SQLConnections.QueryClasses(this.TeacherID); foreach (Class cls in list) { var template = Utils.Clone <ClassButtonTemplate>(new ClassButtonTemplate()); template.labelID.Text = cls.ID; template.labelName.Text = cls.Name; template.ClassObject = cls; this.classUC.flpClassList.Controls.Add(template); } }
public ReportClassSelect(DateTime start, DateTime end) { InitializeComponent(); this.teacherID = MainTeacherForm.MainForm.TeacherID; this.start = start; this.end = end; // Load avaiable subjects this.avaialableClasses = SQLConnections.QueryClasses(teacherID); // Load combobox foreach (var cls in this.avaialableClasses) { this.cbSubjects.Items.Add(cls.ID + " - " + cls.Name); } }
public void GenerateDefautValues() { // Generate combobox this.cbTAHour.Items.Clear(); for (int i = 0; i <= 99; i++) { this.cbTAHour.Items.Add(i); } this.cbTAMinute.Items.Clear(); for (int i = 0; i <= 59; i++) { this.cbTAMinute.Items.Add(i); } this.cbTASecond.Items.Clear(); for (int i = 0; i <= 59; i++) { this.cbTASecond.Items.Add(i); } this.cbLimitTimes.Items.Clear(); for (int i = 1; i <= 99; i++) { this.cbLimitTimes.Items.Add(i); } this.cbQuestionAmount.Items.Clear(); for (int i = 1; i <= 999; i++) { this.cbQuestionAmount.Items.Add(i); } this.cbSTDay.Items.Clear(); this.cbEDDay.Items.Clear(); for (int i = 1; i <= 31; i++) { this.cbSTDay.Items.Add(i); this.cbEDDay.Items.Add(i); } this.cbSTMonth.Items.Clear(); this.cbSTMonth.Items.Clear(); for (int i = 1; i <= 12; i++) { this.cbSTMonth.Items.Add(i); this.cbEDMonth.Items.Add(i); } int currentYear = DateTime.Now.Year; this.cbSTYear.Items.Clear(); this.cbEDYear.Items.Clear(); for (int i = currentYear; i <= currentYear + 100; i++) { this.cbSTYear.Items.Add(i); this.cbEDYear.Items.Add(i); } // Answers this.rtbAnswers = new List <RichTextBox>() { rtbAnswer1, rtbAnswer2, rtbAnswer3, rtbAnswer4, rtbAnswer5 }; this.btnIsTrues = new List <RadioButton>() { btnIsTrue1, btnIsTrue2, btnIsTrue3, btnIsTrue4, btnIsTrue5 }; this.answerDefaults = new Dictionary <RichTextBox, string>(); answerDefaults.Add(rtbAnswer1, "Điền câu trả lời thứ nhất"); answerDefaults.Add(rtbAnswer2, "Điền câu trả lời thứ hai"); answerDefaults.Add(rtbAnswer3, "Điền câu trả lời thứ ba (Không bắt buộc)"); answerDefaults.Add(rtbAnswer4, "Điền câu trả lời thứ nhất (Không bắt buộc)"); answerDefaults.Add(rtbAnswer5, "Điền câu trả lời thứ nhất (Không bắt buộc)"); // QA this.allQA = new List <RichTextBox> (); this.allQA.Add(rtbQuestion); foreach (var rtba in rtbAnswers) { this.allQA.Add(rtba); } // Defaults this.rtbQuestion.Text = questionDefault; foreach (KeyValuePair <RichTextBox, string> e in answerDefaults) { e.Key.Text = e.Value; } // Class this.availableClasses = SQLConnections.QueryClasses(MainTeacherForm.MainForm.TeacherID); cbClass.Items.Clear(); foreach (var cls in this.availableClasses) { cbClass.Items.Add(cls.ID + " " + cls.Name); } // Order this.cbOrder.Text = ""; // Questions this.dgvQuestions.Rows.Clear(); }