示例#1
0
        protected void btnSinavOlustur_Click(object sender, EventArgs e)
        {
            int    i      = 0;
            Result result = new Result();
            int    ExID   = 0;

            Entity.Question question    = new Entity.Question();
            QuestionDAL     questionDal = new QuestionDAL();

            foreach (var item in SagPanel.Controls)
            {
                if (i == 0)//sınav oluşturup onun ID'sini alcam ve başka bir tabloda sınavın sorularını tutcam.
                {
                    string title = DropDownListBasliklar.SelectedItem.ToString();
                    result = exDal.addExam(title, LiteralDescription.Text);
                    ExID   = result.returnID;
                }
                if (item is TextBox)
                {
                    TextBox txt = (TextBox)item;
                    if (txt.ID.Substring(0, 4) == "txtS")
                    {
                        question.question = txt.Text;
                    }
                    if (txt.ID.Substring(0, 4) == "txtA")
                    {
                        question.optionA = txt.Text;
                    }
                    if (txt.ID.Substring(0, 4) == "txtB")
                    {
                        question.optionB = txt.Text;
                    }
                    if (txt.ID.Substring(0, 4) == "txtC")
                    {
                        question.optionC = txt.Text;
                    }
                    if (txt.ID.Substring(0, 4) == "txtD")
                    {
                        question.optionD = txt.Text;
                    }
                }
                if (item is DropDownList)
                {
                    question.ExamID     = ExID;
                    question.trueOption = ((DropDownList)item).SelectedValue;
                    questionDal.AddQuestion(question);
                    question = new Entity.Question();
                }
                i++;
            }
            Response.Redirect("SinavOl.aspx?SinavID=" + ExID.ToString());
        }
 public static void AddQuestion(Question question)
 {
     QuestionDAL.AddQuestion(question);
 }
示例#3
0
 public void addQuestion(int testid, String question, String type, String answer)
 {
     QuestionDAL.AddQuestion(testid, question, type, answer);
 }
示例#4
0
 public long AddQuestion(QuestionDTO Question)
 {
     Questiondal = new QuestionDAL();
     return(Questiondal.AddQuestion(Question));
 }