示例#1
0
        public void LayoutTable(string id, string tableid)
        {
            m_TableID    = tableid;
            m_TempleteID = id;
            Test_Table_Templete        tabletemplete     = SystemManager.Instance.Services.Test_Table_TempleteService.GetModel(int.Parse(id));
            List <Test_Field_Templete> Fieldtempletelist = SystemManager.Instance.Services.Test_Field_TempleteService.GetModelList("F_PID=" + id);


            Test_Table testTable = SystemManager.Instance.Services.Test_TableService.GetModel(int.Parse(tableid));
            List <Library.Model.Test_Field> testFields = SystemManager.Instance.Services.Test_FieldService.GetModelList("F_PID=" + tableid);

            if (!string.IsNullOrEmpty(tabletemplete.F_Banner))
            {
                Banner_1_Edit bannerEdit = new Banner_1_Edit();
                bannerEdit.LoadTemplete(tabletemplete);
                bannerEdit.LoadData(testTable);
                XGrid.Children.Add(bannerEdit);
                m_BannerEdit = bannerEdit;
            }

            m_Control = new GridAutoControl();
            m_Control.LayoutEditGrid(tabletemplete, Fieldtempletelist);
            m_Control.LoadData(testFields);
            XGrid.Children.Add(m_Control);
        }
示例#2
0
        public void LoadData(int templeteid, int id)
        {
            Test_Table_Templete        tabletemplete     = SystemManager.Instance.Services.Test_Table_TempleteService.GetModel(templeteid);
            List <Test_Field_Templete> Fieldtempletelist = SystemManager.Instance.Services.Test_Field_TempleteService.GetModelList("F_PID=" + templeteid);


            Test_Table testTable = SystemManager.Instance.Services.Test_TableService.GetModel(id);
            List <Library.Model.Test_Field> testFields = SystemManager.Instance.Services.Test_FieldService.GetModelList("F_PID=" + id);


            TextBlock txtBander = new TextBlock();

            string[] values = testTable.F_BannerContent.Split('$');
            txtBander.FontSize   = double.Parse(tabletemplete.F_ShowFontSize.ToString());
            txtBander.Foreground = new SolidColorBrush(tabletemplete.ShowFontColor);
            txtBander.Margin     = new Thickness(0, 10, 0, 10);
            foreach (string value in values)
            {
                if (string.IsNullOrEmpty(value))
                {
                    txtBander.Text += "--- ";
                }
                else
                {
                    txtBander.Text += value + " ";
                }
            }

            XGrid.Children.Add(txtBander);
            GridAutoControl m_Control = new GridAutoControl();

            m_Control.LayoutShowGrid(tabletemplete, Fieldtempletelist, testFields);
            XGrid.Children.Add(m_Control);
        }
示例#3
0
 internal void LoadData(Test_Table testTable)
 {
     string[] Inputs = testTable.F_BannerContent.Split('$');
     for (int i = 0; i < index; i++)
     {
         object o = GetObjectByName("txt" + i);
         if (o != null)
         {
             TextBox txt = o as TextBox;
             if (txt != null)
             {
                 txt.Text = Inputs[i];
             }
         }
     }
 }
示例#4
0
        private void BtnSetIsShow_Click(object sender, RoutedEventArgs e)
        {
            DataRow row = this.GridView.GetFocusedDataRow();

            if (row != null)
            {
                int        id = int.Parse(row["F_ID"].ToString());
                Test_Table tb = Library.Controller.SystemManager.Instance.Services.Test_TableService.GetModel(id);
                tb.F_IsShow = 1;
                Library.Controller.SystemManager.Instance.Services.Test_TableService.Update(tb);
                BandGridData();
            }
            else
            {
                MessageBox.Show("请选择一行数据!");
            }
        }
示例#5
0
 public static Common.Business.Test_Table Fetch(Test_Table data)
 {
     Common.Business.Test_Table item = (Common.Business.Test_Table)Activator.CreateInstance(typeof(Common.Business.Test_Table));
     //using (ObjectFactory.BypassPropertyChecks(item))
     {
         item.Year     = data.Year;
         item.ProjCode = data.ProjCode;
         item.TaskCode = data.TaskCode;
         item.FundCode = data.FundCode;
         item.ProjName = data.ProjName;
         item.TaskName = data.TaskName;
         item.FundName = data.FundName;
         item.Test     = data.Test;
     }
     ObjectFactory.MarkAsChild(item);
     ObjectFactory.MarkOld(item);
     return(item);
 }
示例#6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string            sTitile = m_BannerEdit.GetValue();
            List <Test_Field> l       = m_Control.GetFields();

            Test_Table table = new Test_Table();

            table.F_TempleteID    = int.Parse(m_TempleteID);
            table.F_Time          = DateTime.Now;
            table.F_BannerContent = sTitile;
            table.F_IsShow        = 1;

            SystemManager.Instance.Services.Test_TableService.UpdateClearShow(table.F_TempleteID.Value);
            int tableid = SystemManager.Instance.Services.Test_TableService.Add(table);

            foreach (Test_Field f in l)
            {
                f.F_PID = tableid;
                SystemManager.Instance.Services.Test_FieldService.Add(f);
            }

            MessageBox.Show("添加成功!");
        }
示例#7
0
        public ActionResult TakeTest(Test_Table test, string searchtest, string submittechnology, string technology, string submitdomain, QuestionBank qu, string domain, string checkscore, string _1, string _2, string _3, string _4, string _5, string _6, string _7, string _8, string _9, string _10)
        {
            /*provides dropdown to select domain*/

            /*Lists the technologies after selecting the respective domain*/
            if (domain != null && submittechnology == null)
            {
                DbAccessEntity tec = new DbAccessEntity();



                //fetch technology id
                var techlist = (from p in tec.Technology_Table
                                join q in tec.Domain_Table
                                on p.did equals q.did
                                where q.domain == domain
                                select new
                {
                    Technology = p.technology,
                }).ToList();

                Session["Domain"] = domain;
                var domainlist = (from p in tec.Domain_Table
                                  where p.domain != domain
                                  select new
                {
                    domain = p.domain                           //gets the domain list
                }).ToList();

                List <QuestionBank> li = new List <QuestionBank>();

                foreach (var p in techlist)
                {
                    QuestionBank q = new QuestionBank();
                    q.techlist = p.Technology;
                    li.Add(q);
                }
                qu.domainlist = domain;


                li.Add(qu);
                foreach (var p in domainlist)
                {
                    QuestionBank q = new QuestionBank();
                    q.domainlist = p.domain;
                    li.Add(q);
                }


                return(View(li));                                   //returns the list of domain and technology
            }
            /*submitting the technology and domain and starting the test*/
            else if (submittechnology != null)
            {
                DbAccessEntity db = new DbAccessEntity();

                //fetch technologyID
                var techidquery = (from p in db.Technology_Table
                                   where p.technology == technology
                                   select new
                {
                    Technology = p.tid
                });


                foreach (var p in techidquery)
                {
                    qu.idtech = p.Technology;
                }


                Session["TechnologyID"] = qu.idtech;


                //fetch the questions and options based on TechnologyID
                var query = (from p in db.Question_Bank_Table
                             where p.TechnologyId == qu.idtech
                             select new
                {
                    Question = p.Question,
                    QuestionID = p.QuestionID,
                    Options = p.Options,
                    CorrectAnswer = p.CorrectAnswer
                });
                List <QuestionBank> li = new List <QuestionBank>();
                int no = 1;
                foreach (var p in query)
                {
                    QuestionBank qi = new QuestionBank();
                    qi.QuestionID    = p.QuestionID;
                    qi.Question      = p.Question;
                    qi.qno           = no;
                    qi.CorrectAnswer = p.CorrectAnswer;
                    string[] tempsplit = p.Options.Split(',');
                    qi.Options = tempsplit;
                    li.Add(qi);
                    no++;
                }
                Session["listOfObjects"] = li;
                return(View("TestPage", li));
            }


            /*Checking the score after end of test*/
            else if (checkscore != null)
            {
                qu.idtech = Int32.Parse(Session["TechnologyID"].ToString());
                DbAccessEntity db = new DbAccessEntity();

                //Fetch Domain ID
                var iddomain = (from p in db.Technology_Table
                                where p.tid == qu.idtech
                                select new
                {
                    DomainID = p.did
                });

                foreach (var p in iddomain)
                {
                    qu.count = p.DomainID;
                }


                //Based on the technology ID retrieve the correct answers
                var query = (from p in db.Question_Bank_Table
                             where p.TechnologyId == qu.idtech
                             select new
                {
                    Question = p.Question,
                    QuestionID = p.QuestionID,
                    Options = p.Options,
                    Answer = p.CorrectAnswer
                });

                List <string> correctanswer = new List <string>();


                //Append the selected options and enter into test_table
                string selectedoptions = "";

                foreach (var p in query)
                {
                    qu.qid = qu.qid + p.QuestionID + ",";
                    correctanswer.Add(p.Answer);
                }
                selectedoptions            = _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 + "," + _10;
                Session["selectedoptions"] = selectedoptions;



                /*evaluate the score by checking each of radio button with the correct answer*/
                if (_1 == correctanswer[0])
                {
                    qu.score += 1;
                }
                if (_2 == correctanswer[1])
                {
                    qu.score += 1;
                }
                if (_3 == correctanswer[2])
                {
                    qu.score += 1;
                }
                if (_4 == correctanswer[3])
                {
                    qu.score += 1;
                }
                if (_5 == correctanswer[4])
                {
                    qu.score += 1;
                }
                if (_6 == correctanswer[5])
                {
                    qu.score += 1;
                }
                if (_7 == correctanswer[6])
                {
                    qu.score += 1;
                }
                if (_8 == correctanswer[7])
                {
                    qu.score += 1;
                }
                if (_9 == correctanswer[8])
                {
                    qu.score += 1;
                }
                if (_10 == correctanswer[9])
                {
                    qu.score += 1;
                }

                string userid = Session["userid"].ToString();
                test.UserId = userid;

                test.TechnologyID    = (qu.idtech);
                test.DomainID        = (qu.count);
                test.SelectedOptions = selectedoptions;
                test.Score           = qu.score;
                db.Test_Table.Add(test);

                db.SaveChanges();

                //saving the results of the test in the database
                return(View("TestResult", qu));
            }
            else
            {
                DbAccessEntity tec        = new DbAccessEntity();
                int            i          = 0;
                var            domainlist = (from p in tec.Domain_Table

                                             select new
                {
                    domain = p.domain                       //select domain from domain table
                }).ToList();


                List <QuestionBank> li = new List <QuestionBank>();
                foreach (var p in domainlist)
                {
                    QuestionBank q = new QuestionBank();
                    if (i == 0)
                    {
                        q.domainlist           = p.domain;
                        Session["domaintrack"] = p.domain;
                        li.Add(q);
                    }
                    else
                    {
                        q.domainlist = p.domain;
                        li.Add(q);
                    }
                    i++;
                }
                string firstdomain = Session["domaintrack"].ToString();
                var    techlist    = (from p in tec.Technology_Table
                                      join q in tec.Domain_Table
                                      on p.did equals q.did
                                      where q.domain == firstdomain
                                      select new
                {
                    Technology = p.technology,
                }).ToList();
                foreach (var q in techlist)
                {
                    QuestionBank que = new QuestionBank();
                    que.techlist = q.Technology;
                    li.Add(que);
                }


                return(View(li));
            }
        }