protected void TextBox2_TextChanged(object sender, EventArgs e) { QuestionBankEntities qb = new QuestionBankEntities(); FILLINTHEBLANK ft = new FILLINTHEBLANK(); int id = (int)(ViewState["data"]); if (TextBox2.Text != null) { ft.ANSWER = TextBox2.Text; TextBox2.Text = ""; } ft.QUESTIONS = id; qb.FILLINTHEBLANKs.Add(ft); qb.SaveChanges(); TextBox1.Visible = false; TextBox2.Visible = false; Label1.Visible = true; Label2.Visible = true; Label3.Visible = false; Label4.Visible = false; }
protected void Button1_Click(object sender, EventArgs e) { QuestionBankEntities db = new QuestionBankEntities(); FILLINTHEBLANK ft = new FILLINTHEBLANK(); QUESTION qt = new QUESTION(); Label1.Text = qt.QUESTIONTEXT; Label2.Text = ft.ANSWER; // db.QUESTIONS.Where(w => w.ID ).First(); //List<Question> lst = db.Questions.Where(w => w.id > 1 && w.id < 10).ToList(); //Question questiontoFetch = db.Questions.Where(w => w.id == 5).First(); // submit //Label1.Text = f.Question; //Label2.Text = f.Answer; //if (Session["data"] != null) //{ // list = (List<FITB>)Session["data"]; //} //if (f.Question != null && f.Answer != null) //{ // list.Add(f); //} //Session["data"] =list; Button1.Visible = false; }
protected void TextBox1_TextChanged(object sender, EventArgs e) { QuestionBankEntities qb = new QuestionBankEntities(); QUESTION qt = new QUESTION(); if (TextBox1.Text != null) { qt.QUESTIONTEXT = TextBox1.Text; TextBox1.Text = ""; } qb.QUESTIONS.Add(qt); qb.SaveChanges(); int id = qt.ID; ViewState["data"] = id; }
protected void AddOption_Click(object sender, EventArgs e) { //MCQQuestion pre = Session["data"] as MCQQuestion; //MCQOption op = new MCQOption(); // use op with status and option QuestionBankEntities db = new QuestionBankEntities(); OPTION op = new OPTION(); int id = (int)(ViewState["data"]); op.QUESTIONS = id; if (TextBox1.Text != null) { op.OOPTION = TextBox1.Text; Label2.Text = op.OOPTION + "<br/>"; if (CheckBox1.Checked) { op.OSTATUS = true; Label3.Text = "yes"; } else { op.OSTATUS = false; Label3.Text = "no"; } db.OPTIONS.Add(op); db.SaveChanges(); //pre.Options.Add(op); //Session["data"] = pre; Panel1.Visible = false; TextBox1.Visible = true; //panel3 items AddOption.Visible = true; CheckBox1.Visible = true; NoMoreOption.Visible = true; } }
protected void QuestionAddButton_Click(object sender, EventArgs e) { //DreamBirdEntities db = new DreamBirdEntities(); //Question question = new Question(); //string questionText = "MyString"; //question.QuestionText = questionText; //db.Questions.Add(question); //db.SaveChanges(); //int id = question.id; //List<Question> lst = db.Questions.Where(w => w.id > 1 && w.id < 10).ToList(); //Question questiontoFetch = db.Questions.Where(w => w.id == 5).First(); QuestionBankEntities db = new QuestionBankEntities(); QUESTION q = new QUESTION(); if (QuestionTextBox.Text != null) { ////////////////// q.QUESTIONTEXT = QuestionTextBox.Text; QuestionLabel.Text = q.QUESTIONTEXT; db.QUESTIONS.Add(q); db.SaveChanges(); int id = q.ID; ViewState["data"] = id; //////////////////// Panel2.Visible = true; Panel1.Visible = false; TextBox1.Visible = true; //panel3 items AddOption.Visible = true; CheckBox1.Visible = true; QuestionTextBox.Text = ""; Button1.Visible = false; NoMoreOption.Visible = true; } }