public DictantStudentModel(Dictant dictant, User user) { currentStudent = new StudentDAO(); currentDictant = dictant; CurrentUser = user; currentStudent.getPositionAndAnswer(currentDictant.ID, out positions, out answers); }
public TeacherDictantModel(Dictant dictant) { currentTeacher = new TeacherDAO(); currentDictant = dictant; if (currentDictant != null) { currentTeacher.getPositionAndAnswer(currentDictant.ID, out positions, out answers); } }
public Dictant getDictantByID(int id_dictant) { Dictant dictant = null; var list = ExecuteQuery("select * from Dictant where id_dictant=" + id_dictant); if (list.Count > 0) { dictant = new Dictant(); dictant.ID = Convert.ToInt32(list[0][0]); dictant.Text = list[0][1].ToString(); dictant.Header = list[0][2].ToString(); } return(dictant); }
public List <Dictant> getAllDictants() { var list = ExecuteQuery("select * from Dictant"); List <Dictant> allDictants = new List <Dictant>(); for (int i = 0; i < list.Count; i++) { var dictant = new Dictant(); dictant.ID = Convert.ToInt32(list[i][0]); dictant.Text = list[i][1].ToString(); dictant.Header = list[i][2].ToString(); dictant.StudentText = list[i][3].ToString(); allDictants.Add(dictant); } return(allDictants); }
public void saveDictant(string text, string header, List <int> positions, List <string> answers) { StringBuilder stdText = new StringBuilder(text); for (int i = 0; i < positions.Count; i++) { stdText.Remove(positions[i], answers[i].Length); stdText.Insert(positions[i], new string('δΈ€', answers[i].Length)); } if (currentDictant != null) { currentTeacher.editDictant(CurrentDictant.ID, text, header, positions, answers, stdText); } else { currentTeacher.addNewDictant(text, header, positions, answers, stdText); currentDictant = currentTeacher.getDictantByID(currentTeacher.GetMaxId("Dictant")); } }
public DictantStudentForm(Dictant dictant, User currentUser, ChoiseStudentForm previousForm) { InitializeComponent(); previousForm.Dispose(); new DictantStudentPresenter().Init(this, new DictantStudentModel(dictant, currentUser)); }
void f_choiseThisDictant(Dictant dictant) { _f.Hide(); new DictantStudentForm(dictant, _m.CurrentUser, _f).ShowDialog(); }
public TeacherDictantForm(Dictant dictant, ChoiseTeacherForm previousForm) { previousForm.Dispose(); InitializeComponent(); new TeacherDictantPresenter().Init(this, new TeacherDictantModel(dictant)); }
public void deleteThisDictant(Dictant dictant) { currentTeacherDAO.deleteDictant(dictant.ID); avialableDictants = currentTeacherDAO.getAllDictants(); }
void f_editThisDictant(Dictant dictant) { _f.Hide(); new TeacherDictantForm(dictant, _f).ShowDialog(); }
private void f_deleteThisDictant(Dictant dictant) { _m.deleteThisDictant(dictant); _f.showHeadersDictants(_m.AvialableDictants); }