private void Button_Click_2(object sender, RoutedEventArgs e) { WorkWithForm wwf = new WorkWithForm(); wwf.RemoveQuestion(Convert.ToInt32((dgView.Columns[0].GetCellContent(dgView.SelectedItem) as TextBlock).Text)); }
private void Button_Click_1(object sender, RoutedEventArgs e) { ///<summary> ///Логика добавления вопросов /// </summary> WorkWithForm wwf = new WorkWithForm(); if (move == "Редактирование") { //string result = ""; //wwf.che(); int idVoprosa = Convert.ToInt32((dgView.Columns[0].GetCellContent(dgView.SelectedItem) as TextBlock).Text); if (cbTypeQuestion.SelectedItem.ToString() == "Последовательность") { wwf.ZamenaZnach(tbConstStr1, tblStr1.Text, 0, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr2, tblStr2.Text, 1, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr3, tblStr3.Text, 2, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr4, tblStr4.Text, 3, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr5, tblStr5.Text, 4, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr6, tblStr6.Text, 5, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); } else if (cbTypeQuestion.SelectedItem.ToString() == "Несколько вариантов") { wwf.ZamenaZnach(tbConstStr1, chbStr1.IsChecked.ToString(), 0, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr2, chbStr2.IsChecked.ToString(), 1, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr3, chbStr3.IsChecked.ToString(), 2, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr4, chbStr4.IsChecked.ToString(), 3, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr5, chbStr5.IsChecked.ToString(), 4, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr6, chbStr6.IsChecked.ToString(), 5, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); } else if (cbTypeQuestion.SelectedItem.ToString() == "Один вариант") { wwf.ZamenaZnach(tbConstStr1, rbStr1.IsChecked.ToString(), 0, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr2, rbStr2.IsChecked.ToString(), 1, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr3, rbStr3.IsChecked.ToString(), 2, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr4, rbStr4.IsChecked.ToString(), 3, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr5, rbStr5.IsChecked.ToString(), 4, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr6, rbStr6.IsChecked.ToString(), 5, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); } else if (cbTypeQuestion.SelectedItem.ToString() == "Закрытый вопрос" || cbTypeQuestion.SelectedItem.ToString() == "Соответствие") { wwf.ZamenaZnach(tbConstStr1, tbStrSootv1.Text, 0, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr2, tbStrSootv2.Text, 1, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr3, tbStrSootv3.Text, 2, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr4, tbStrSootv4.Text, 3, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr5, tbStrSootv5.Text, 4, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); wwf.ZamenaZnach(tbConstStr6, tbStrSootv6.Text, 5, idVoprosa, tbnameTest.Text, tbFormulirovka.Text, typeVopr); } wwf.Obnova(dgView); } else { // WorkWithForm wwf = new WorkWithForm(); if (cbTypeQuestion.SelectedItem.ToString() == "Последовательность") { wwf.checkConstStroka(tbConstStr1, tblStr1.Text); wwf.checkConstStroka(tbConstStr2, tblStr2.Text); wwf.checkConstStroka(tbConstStr3, tblStr3.Text); wwf.checkConstStroka(tbConstStr4, tblStr4.Text); wwf.checkConstStroka(tbConstStr5, tblStr5.Text); wwf.checkConstStroka(tbConstStr6, tblStr6.Text); } else if (cbTypeQuestion.SelectedItem.ToString() == "Несколько вариантов") { wwf.checkConstStroka(tbConstStr1, chbStr1.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr2, chbStr2.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr3, chbStr3.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr4, chbStr4.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr5, chbStr5.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr6, chbStr6.IsChecked.ToString()); } else if (cbTypeQuestion.SelectedItem.ToString() == "Один вариант") { wwf.checkConstStroka(tbConstStr1, rbStr1.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr2, rbStr2.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr3, rbStr3.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr4, rbStr4.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr5, rbStr5.IsChecked.ToString()); wwf.checkConstStroka(tbConstStr6, rbStr6.IsChecked.ToString()); } else if (cbTypeQuestion.SelectedItem.ToString() == "Закрытый вопрос" || cbTypeQuestion.SelectedItem.ToString() == "Соответствие") { wwf.checkConstStroka(tbConstStr1, tbStrSootv1.Text); wwf.checkConstStroka(tbConstStr2, tbStrSootv2.Text); wwf.checkConstStroka(tbConstStr3, tbStrSootv3.Text); wwf.checkConstStroka(tbConstStr4, tbStrSootv4.Text); wwf.checkConstStroka(tbConstStr5, tbStrSootv5.Text); wwf.checkConstStroka(tbConstStr6, tbStrSootv6.Text); } qlists.Add(new Question() { idQuestion = idQuestion++, quest = tbFormulirovka.Text, typeQuestion = typeVopr, optionQuestions = wwf.es }); index = 0; dgView.ItemsSource = qlists.Select(spisokVoprosov => new { k = index++, spisokVoprosov.quest }).ToList(); //Подчищаем строки tbFormulirovka.Text = "Введите формулировку вопроса"; tbConstStr1.Clear(); tbConstStr2.Clear(); tbConstStr3.Clear(); tbConstStr4.Clear(); tbConstStr5.Clear(); tbConstStr6.Clear(); } }