Example #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (cmbAnswer.SelectedValue != null)
            {
                StudioMResource.QandAForSupplier qa = new StudioMResource.QandAForSupplier();
                qa.SupplierBrandID   = int.Parse(cmbSupplier.SelectedValue.ToString());
                qa.SupplierBrandName = cmbSupplier.Text;
                qa.QuestionID        = int.Parse(cmbQuestion.SelectedValue.ToString());
                qa.QuestionText      = cmbQuestion.Text;
                qa.AnswerID          = int.Parse(cmbAnswer.SelectedValue.ToString());
                qa.AnswerText        = cmbAnswer.Text;

                foreach (var item in sr.StudioMQuestion)
                {
                    if (item.QuestionID == int.Parse(cmbQuestion.SelectedValue.ToString()))
                    {
                        qa.AnswerType = item.AnswerType;
                        break;
                    }
                }

                sr.AddStudioMAttributes(qa);
            }
            else
            {
                MessageBox.Show("Please select an answer for the question.");
            }
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if ((cmbAnswer.Text.ToUpper().Contains("SINGLE SELECTION") || cmbAnswer.Text.ToUpper().Contains("MULTIPLE SELECTION")))
            {
                if (cmbAnswer.SelectedValue == null)
                {
                    MessageBox.Show("Please select an answer for the question.");
                }
                return;
            }

            StudioMResource.QandAForSupplier qa = new StudioMResource.QandAForSupplier();
            qa.SupplierBrandID   = int.Parse(cmbSupplier.SelectedValue.ToString());
            qa.SupplierBrandName = cmbSupplier.Text;
            qa.QuestionID        = int.Parse(cmbQuestion.SelectedValue.ToString());
            qa.QuestionText      = cmbQuestion.Text;
            qa.Mandatory         = currentquestionmandatory;
            if (cmbAnswer.SelectedValue != null)
            {
                qa.AnswerID   = int.Parse(cmbAnswer.SelectedValue.ToString());
                qa.AnswerText = cmbAnswer.Text;
            }
            else
            {
                qa.AnswerID   = 0;
                qa.AnswerText = "";
            }


            foreach (var item in sr.StudioMQuestion)
            {
                if (item.QuestionID == int.Parse(cmbQuestion.SelectedValue.ToString()))
                {
                    qa.AnswerType = item.AnswerType;
                    break;
                }
            }

            sr.AddStudioMAttributes(qa);
        }