Exemplo n.º 1
0
        public void GetCsore(string examguid)
        {
            if (Data.ExamScore.Get_All_ExamScore().Count() > 0)
            {
                var ss = Data.ExamScore.Get_All_ExamScore(new { ExamGuid = examguid }).Max(x => x.ExamID);
                if (ss != 0)
                {
                    VExamScore = Data.ExamScore.Get_ExamScore(ss);

                    ListVexamRecord = Data.ExamRecord.Get_All_ExamRecord(ss);
                    ListVexamRecord = ListVexamRecord.Where(x => x.ExamID == ss.ToString()).ToList();
                }
            }
        }
Exemplo n.º 2
0
        public void GetExamListInfo(int id, string name, string test, string examid)
        {
            var usercode = "";

            if (Data.ExamScore.Get_All_ExamScore().Count() > 0)
            {
                var usersheet = Data.ExamUsersFromehr.Get_ExamUsersFromehr(new { EamilUsername = name });
                if (usersheet != null)
                {
                    usercode = usersheet.UserCode;
                }
                var ss = Data.ExamScore.Get_All_ExamScore(new { CreateUser = usercode, ExamGuid = examid });
                if (ss.Count() > 0)
                {
                    ID         = ss.FirstOrDefault().ExamID;
                    VExamScore = Data.ExamScore.Get_ExamScore(ID);

                    ListVexamRecord = Data.ExamRecord.Get_All_ExamRecord(ID);
                    ListVexamRecord = ListVexamRecord.Where(x => x.ExamID == ID.ToString()).ToList();
                }
            }
            if (ID != 0)
            {
                foreach (var item in ListVexamRecord.Where(x => x.ExamID == ID.ToString()))
                {
                    var output = new string[] { };
                    var list   = new string[] { };

                    var option = "";
                    //if (item.CorrectAnsower == item.HideAnsower)
                    //{
                    //    isright = true;
                    //}
                    List <LAnsower> answ = new List <LAnsower>();
                    if (item.OptionA != null || item.OptionAPicNum != null)
                    {
                        answ.Add(new LAnsower
                        {
                            ansower     = item.OptionA,
                            ansowerflag = item.CorrectAnsower,
                            ansowerpic  = item.OptionAPicNum
                        });
                    }
                    if (item.OptionB != null || item.OptionBPicNum != null)
                    {
                        answ.Add(new LAnsower
                        {
                            ansower     = item.OptionB,
                            ansowerflag = item.CorrectAnsower,
                            ansowerpic  = item.OptionBPicNum
                        });
                    }
                    if (item.OptionC != null || item.OptionCPicNum != null)
                    {
                        answ.Add(new LAnsower
                        {
                            ansower     = item.OptionC,
                            ansowerflag = item.CorrectAnsower,
                            ansowerpic  = item.OptionCPicNum
                        });
                    }
                    if (item.OptionD != null || item.OptionDPicNum != null)
                    {
                        answ.Add(new LAnsower
                        {
                            ansower     = item.OptionD,
                            ansowerflag = item.CorrectAnsower,
                            ansowerpic  = item.OptionDPicNum
                        });
                    }
                    if (item.OptionE != null || item.OptionEPicNum != null)
                    {
                        answ.Add(new LAnsower
                        {
                            ansower     = item.OptionE,
                            ansowerflag = item.CorrectAnsower,
                            ansowerpic  = item.OptionEPicNum
                        });
                    }
                    if (item.OptionF != null || item.OptionFPicNum != null)
                    {
                        answ.Add(new LAnsower
                        {
                            ansower     = item.OptionF,
                            ansowerflag = item.CorrectAnsower,
                            ansowerpic  = item.OptionFPicNum
                        });
                    }
                    if (item.Type == "0")
                    {
                        if (item.WriteAnsower != null)
                        {
                            list   = item.WriteAnsower.Split(';');
                            option = list.FirstOrDefault();
                            var ss = "";
                            if (!string.IsNullOrEmpty(option))
                            {
                                if (option.Equals("A"))
                                {
                                    ss = "0";
                                }
                                else if (option.Equals("B"))
                                {
                                    ss = "1";
                                }
                                else if (option.Equals("C"))
                                {
                                    ss = "2";
                                }
                                else if (option.Equals("D"))
                                {
                                    ss = "3";
                                }
                                else if (option.Equals("E"))
                                {
                                    ss = "4";
                                }
                                option = ss;
                            }
                        }
                    }
                    else if (item.Type == "1")
                    {
                        if (item.WriteAnsower != null)
                        {
                            var listnum = "";
                            output = item.WriteAnsower.Split(';');
                            var tt = "";
                            foreach (var w in output)
                            {
                                if (!string.IsNullOrEmpty(w))
                                {
                                    if (w.Equals("A"))
                                    {
                                        tt = "0";
                                    }
                                    else if (w.Equals("B"))
                                    {
                                        tt = "1";
                                    }
                                    else if (w.Equals("C"))
                                    {
                                        tt = "2";
                                    }
                                    else if (w.Equals("D"))
                                    {
                                        tt = "3";
                                    }
                                    else if (w.Equals("E"))
                                    {
                                        tt = "4";
                                    }

                                    listnum += tt + ';';
                                }
                            }
                            output = listnum.Split(';');
                        }
                    }

                    examList.Add(new ExamScoreInfo
                    {
                        ExamID           = ID.ToString(),
                        TopicTitle       = item.TopicTitle,
                        TopicNum         = item.TopicNum,
                        ansowerList      = answ,
                        isright          = item.IsRight,
                        Type             = item.Type,
                        selectItem       = output,
                        selectOption     = option,
                        CorrectAnsower   = item.CorrectAnsower,
                        WriteItem        = item.WriteAnsower,
                        TopicTitlePicNum = item.TopicTitlePicNum,
                        Remark           = item.Remark,
                        TopicTitlePic    = item.TopicTitlePicNum,
                        DeRemark         = item.DaRemark
                    });
                }
            }
        }