Esempio n. 1
0
        public List <OEEntity.Question> GetAll()
        {
            List <OEEntity.Question> ques = new List <OEEntity.Question>();

            OEEntity.Question qobj;

            OEEntity.DataSets.OE.QuestionDataTable qdt = mydataset.Question;

            foreach (OEEntity.DataSets.OE.QuestionRow item in qdt.Rows)
            {
                qobj          = new OEEntity.Question();
                qobj.qid      = item.qid;
                qobj.marks    = item.marks;
                qobj.question = item.name;

                qobj.options = orepo.GetAllByID(item.qid);


                qobj.coptions = orepo.GetCOptionByQID(item.qid);



                ques.Add(qobj);
            }
            return(ques);
        }
Esempio n. 2
0
 public void AddQuestion(OEEntity.Question q)
 {
     taQues.AddQuestion(q.question, q.marks);
     taQues.Fill(mydataset.Question);
     q.qid = GetByQues(q.question);
     orepo.addOptions(q);
 }
Esempio n. 3
0
        public static void call1()
        {
            int total = 0, Testtotal = 0;

            OEBL.TestManager         tm = new TestManager();
            List <OEEntity.Question> ques = tm.GetQuestions();

            List <OEEntity.Question> reslist = new List <Question>();

            OEEntity.Question res;


            Console.WriteLine("Welcome to the Test\n\n\n");

            foreach (OEEntity.Question item in ques)
            {
                res          = new OEEntity.Question();
                res.question = item.question;
                res.qid      = item.qid;
                res.marks    = item.marks;
                res.options  = new List <OEEntity.Option>();
                res.coptions = new List <Option>(); res.options = new List <Option>();

                Console.WriteLine(item.question + "\t\t(" + item.marks + ") marks");
                foreach (OEEntity.Option op in item.options)
                {
                    Console.WriteLine(op.oid + ". " + op.option);
                }

                Console.WriteLine("\nEnter yout choice");
                int choice = Int16.Parse(Console.ReadLine());

                foreach (OEEntity.Option op in item.options)
                {
                    if (choice == op.oid)
                    {
                        res.options.Add(op);
                    }
                }
                foreach (OEEntity.Option cop in item.coptions)
                {
                    res.coptions.Add(cop);
                }

                Console.Clear();
                reslist.Add(res);
            }

            Console.WriteLine(tm.GetReport(reslist));
        }
Esempio n. 4
0
        public Question GetByID(byte qid)
        {
            OEEntity.Question qobj;

            OEEntity.DataSets.OE.QuestionDataTable qdt = mydataset.Question;

            foreach (OEEntity.DataSets.OE.QuestionRow item in qdt.Rows)
            {
                if (qid == item.qid)
                {
                    qobj          = new OEEntity.Question();
                    qobj.qid      = item.qid;
                    qobj.marks    = item.marks;
                    qobj.question = item.name;

                    qobj.options = orepo.GetAllByID(item.qid);

                    qobj.coptions = orepo.GetCOptionByQID(item.qid);
                    return(qobj);
                }
            }
            return(new OEEntity.Question());
        }
Esempio n. 5
0
        private void frmEva_Load(object sender, EventArgs e)
        {
            OEBL.TestManager         tm   = new TestManager();
            List <OEEntity.Question> ques = tm.GetQuestions();

            reslist      = new List <Question>();
            customChecks = new List <CheckBox>();
            OEEntity.Question res;

            //dataGridView1.DataSource = ques;
            //DataGridViewCheckBoxColumn cbxc=new DataGridViewCheckBoxColumn();
            ////DataGridView
            //cbxc.
            ////cbxc.Text = "Edit";
            //dataGridView1.Columns.Add(cbxc);

            dp = 100;
            List <Label> customLabels = new List <Label>();

            foreach (OEEntity.Question item in ques)
            {
                res          = new OEEntity.Question();
                res.question = item.question;
                res.qid      = item.qid;
                res.marks    = item.marks;
                res.options  = new List <OEEntity.Option>();
                res.coptions = new List <Option>(); res.options = new List <Option>();
                foreach (OEEntity.Option cop in item.coptions)
                {
                    res.coptions.Add(cop);
                }


                Label label2 = new Label();
                label2.Location = new System.Drawing.Point(500, dp);
                label2.Font     = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                label2.Name     = item.qid.ToString();
                label2.Text     = item.qid + ". " + item.question + "                     (" + item.marks + ") marks";
                label2.Size     = new System.Drawing.Size(700, 25);
                customLabels.Add(label2);
                Controls.Add(label2);

                dp += 30;
                foreach (OEEntity.Option op in item.options)
                {
                    CheckBox dynamicCheckBox = new CheckBox();
                    dynamicCheckBox.Left   = 20;
                    dynamicCheckBox.Top    = 20;
                    dynamicCheckBox.Width  = 300;
                    dynamicCheckBox.Height = 30;

                    // Set background and foreground
                    //dynamicCheckBox.BackColor = Color.Orange;
                    dynamicCheckBox.ForeColor = Color.Brown;

                    dynamicCheckBox.Text     = op.option;
                    dynamicCheckBox.Name     = item.qid + "," + op.oid;
                    dynamicCheckBox.Location = new System.Drawing.Point(530, dp);
                    dynamicCheckBox.Size     = new System.Drawing.Size(700, 25);
                    dynamicCheckBox.Font     = new Font("Georgia", 12);
                    customChecks.Add(dynamicCheckBox);
                    Controls.Add(dynamicCheckBox);

                    dp += 30;
                }
                dp += 50;
                reslist.Add(res);
            }

            Button bn = new Button();

            bn.Location = new System.Drawing.Point(650, dp);
            bn.Font     = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            bn.Name     = "btnSubmit";
            bn.Text     = "Submit";
            bn.Size     = new System.Drawing.Size(100, 25);
            bn.Click   += new System.EventHandler(this.bn_Click);
            Controls.Add(bn);
        }