Example #1
0
        public ActionResult ExamPage(string IsTest = null, string RuleName = null)
        {
            var model = new ExamPageModel();

            model.IsTest   = IsTest;
            model.RuleName = RuleName;
            var username = this.UserNameContext;
            var usercode = Data.ExamUsersFromehr.Get_ExamUsersFromehr(new { EamilUsername = username });

            if (usercode != null)
            {
                var detail = Data.ExamUserDetailInfo.Get_ExamUserDetailInfo(new { UserCode = usercode.UserCode, RuleName = RuleName, IsStop = false, IsExam = false });
                if (detail != null)
                {
                    var dtdate = DateTime.Now.ToString("yyyy-MM-dd");
                    var ddate  = "";
                    ddate = Convert.ToDateTime(detail.ExamDate).ToString("yyyy-MM-dd");
                    if (dtdate != ddate)
                    {
                        model.IsExam = "未到考试时间,不可考试";
                    }
                    else
                    {
                        model.ExamFailResult = model.GetExamBankNum(RuleName);
                    }
                }
                else
                {
                    model.ExamFailResult = "没有考试资格";
                }
            }
            return(View(model));
        }
Example #2
0
        public ActionResult Test(string data, string RuleName)
        {
            var model    = new ExamPageModel();
            var username = this.UserNameContext;

            model.GetListExam(data, RuleName, username);
            return(Json(new { examList = model.examList, ListBankView = model.ListBankView, nowItem = model.nowItem, total = model.total, model.VExamUserInfo }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
 public ActionResult InsertScore(ExamPageModel model)
 {
     try
     {
         var examguid = "";
         if (model.VExamUserInfo.IsTest == false)
         {
             var set = Data.ExamScore.Get_All_ExamScore(new { CreateUser = model.VExamUserInfo.UserName, IsTest = false, ExamSubject = model.VExamUserInfo.ExamSubject });
             if (set.Count() == 0)
             {
                 model.GetExam();
                 examguid = model.InsertScoreData(model);
                 var name = this.UserNameContext;
                 model.InsertRecoredData(model, name, examguid);
             }
             else
             {
                 var      date = set.FirstOrDefault().CreateDate;
                 DateTime da   = DateTime.Now;
                 TimeSpan ts   = da.Subtract(Convert.ToDateTime(date)).Duration();
                 if (ts.TotalMinutes > 10)
                 {
                     model.GetExam();
                     examguid = model.InsertScoreData(model);
                     var name = this.UserNameContext;
                     model.InsertRecoredData(model, name, examguid);
                 }
             }
         }
         else
         {
             model.GetExam();
             examguid = model.InsertScoreData(model);
             var name = this.UserNameContext;
             model.InsertRecoredData(model, name, examguid);
         }
         return(Json(new { examList = model, examid = examguid }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         var TestModel = new advt_Attachment();
         TestModel.name = ex.Message;
         Data.advt_Attachment.Insert_advt_Attachment(TestModel, null, new string[] { "id" });
         throw;
     }
 }
Example #4
0
 public ActionResult FinishTopic(ExamPageModel model)
 {
     model.GetExam();
     return(Json(new { examList = model.examList, ListBank = model.ListBankView, nowItem = model.nowItem, total = model.total }, JsonRequestBehavior.AllowGet));
 }