private void frmTest_Load(object sender, EventArgs e) { currentTest = new Test(); // !!!!!!!!!!! currentTest = db.GetTest(1); // !!!!!!!!!!! List <QuestionType> lq = db.GetListQuestionTypes(true); cmbQuestionTypes.DisplayMember = "Name"; cmbQuestionTypes.ValueMember = "idQuestionType"; cmbQuestionTypes.DataSource = lq; cmbQuestionTypes.SelectedValue = "close"; RefreshUi(); }
internal frmQuestion(QuestionFormType Type, Question Question, SchoolSubject Subject, Class Class, Topic Topic) { InitializeComponent(); DbAndBusiness db = new DbAndBusiness(Commons.PathAndFileDatabase); TreeMpttDb dbMptt = new TreeMpttDb(db); // fills the lookup tables' combos List <QuestionType> listQuestions = db.GetListQuestionTypes(true); cmbQuestionType.DisplayMember = "Name"; cmbQuestionType.ValueMember = "idQuestionType"; cmbQuestionType.DataSource = listQuestions; List <SchoolSubject> listSubjects = db.GetListSchoolSubjects(true); cmbSchoolSubject.DisplayMember = "Name"; cmbSchoolSubject.ValueMember = "idSchoolSubject"; cmbSchoolSubject.DataSource = listSubjects; currentClass = Class; currentSubject = Subject; currentQuestion = Question; formType = Type; if (formType == QuestionFormType.EditOneQuestion) { currentQuestion = db.GetQuestionById(Question.IdQuestion); } if (Topic != null) { currentTopic = db.GetTopicById(Topic.Id); if (currentTopic.Id != 0) { txtTopic.Text = dbMptt.GetTopicPath(currentTopic.Id); } } //if (Subject != null) // idSchoolSubject = Subject.IdSchoolSubject; }