예제 #1
0
 /// <summary>
 /// load the structure of the page configuration
 /// </summary>
 /// <param name="configuration">structure of the page configuration</param>
 public WebSettings(DataTable configuration)
 {
     Template = "Vitality";
     mSUtil   = new MSUtils();
     try
     {
         string connStr = "server=localhost;user=root;database=ms;port=3306;password="******"@tipoCliente",1);
         //parametros.Add(MSParameter);
         DataTable dt = mSUtil.ExecuteStopProcedureSelect(connStr, "GetWebSettings", parametros, configuration);
         foreach (DataRow row in dt.Rows)
         {
             if (row["wse_key"].ToString() == "Template")
             {
                 Template = row["wse_value"].ToString();
             }
         }
     }
     catch (Exception ex)
     {
         Template = "Vitality";
         mSUtil.ConsoleLogError("WebSettings.cs;WebSettings", ex);
     }
 }
예제 #2
0
        /// <summary>
        /// 加载用户数据和题的信息
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="questionRecordId"></param>
        private void UpdateData(string exercise_record_id, long questionId)
        {
            var student     = APP.StudySession.GetStudyStudent(StudentId);
            var studentView = new ViewModels.StudentView(student);

            var questionRecord = APP.IDatas.ErPaperPracticeRecordQuestionSealUp
                                 .Where(m => m.paper_practice_record_id == exercise_record_id && m.source_question_id == questionId)
                                 .Select(m => new { m.first_step_stem, m.start_practice_time })
                                 .FirstOrDefault();

            mPageData.StudentId = StudentId;
            mPageData.Name      = studentView.Name;
            mPageData.Face      = studentView.Face;
            if (questionRecord != null)
            {
                mPageData.QuestionTitle = questionRecord.first_step_stem;
            }
            if (this.IsShowAnswer)
            {
                var mButtonAnswer = APP.IDatas.ErStudentButtonAnswerOriginalRecord
                                    .Where(m => m.student_id == this.StudentId && m.exercise_record_id == exercise_record_id && m.question_id == questionId && m.step_number == 1)
                                    .Select(m => new
                {
                    m.is_submit,
                    m.button_item,
                    m.create_time,
                    m.step_number
                }).OrderBy(m => m.create_time).ToList();

                if (mButtonAnswer.Count > 0)
                {
                    var lastResult = mButtonAnswer.Where(m => m.is_submit).OrderByDescending(m => m.create_time).Select(m => new { m.button_item, m.create_time }).FirstOrDefault();
                    if (lastResult != null)
                    {
                        var lastTime = (lastResult.create_time.Value - questionRecord.start_practice_time.Value).ToString(@"m'\''s'\'\''");
                        mPageData.IsSubmitAnswerText = $"提交答案:{lastResult.button_item},总共用时:" + lastTime;
                    }
                    else
                    {
                        mPageData.IsSubmitAnswerText = "提交答案:未提交";
                    }
                    var submits = mButtonAnswer.Where(m => m.is_submit).OrderBy(m => m.create_time).ToList();
                    var list    = new List <string>();
                    for (var i = 0; i < submits.Count; i++)
                    {
                        var item     = submits[i];
                        var lastTime = (item.create_time.Value - questionRecord.start_practice_time.Value).ToString(@"m'\''s'\'\''");
                        list.Add($"第{MSUtils.NumberToChinese(i + 1)}次提交答案:用时{lastTime}");
                    }
                    mPageData.AnswerText = list.ToJoin(";");
                }
                else
                {
                    mPageData.IsSubmitAnswerText = "提交答案:未提交";
                    mPageData.AnswerText         = "未做题";
                }
            }
        }
예제 #3
0
 /// <summary>
 /// 获取文件/目录的真实路径,不管是不是虚拟路径
 /// </summary>
 /// <param name="path">文件路径</param>
 /// <param name="isCreateFolder">如果目录不存在则创建 true-创建 false-不创建</param>
 /// <returns></returns>
 public static string GetTruePath(string path, bool isCreateFolder)
 {
     if (isCreateFolder)
     {
         string folder = IsFilePath(path) ? GetFolderName(path) : path;
         if (!IsFolderExists(folder))
         {
             CreateFolder(folder);
         }
     }
     return(MSUtils.GetMapPath(path));
 }
예제 #4
0
 public IActionResult Index()
 {
     try
     {
         mSUtil = new MSUtils();
         var webSetting = new WebSettings(mSUtil.WebSettingConfiguration);
         return(View(webSetting));
     }
     catch (Exception ex)
     {
         mSUtil.ConsoleLogError("HomeController.cs;Index", ex);
         return(View());
     }
 }
예제 #5
0
        private void InitEvents()
        {
            //退出
            this.btnExit.Click += (s, e) =>
            {
                var ret = MSMessageBox.ShowModal(MSMessageBox.MSMessageBoxButton.YesOrNo, "友情提示", "您确定要退出做题吗?");
                if (ret == MSMessageBox.MessageResult.Yes)
                {
                    ExitAnswerClick?.Invoke(this, e);
                }
            };

            //收缩
            this.btnCollect.Click += (s, e) =>
            {
                this.Height             = 97;
                this.toolBg.ImageSource = MSUtils.GetLocalImage("/Assets/Images/bg-tool-close.png");
            };

            //展开
            this.MouseLeftButtonDown += (s, e) =>
            {
                point.X = this.Margin.Left;
                point.Y = this.Margin.Top;
            };
            this.MouseLeftButtonUp += (s, e) =>
            {
                var x = point.X - this.Margin.Left;
                var y = point.Y - this.Margin.Top;
                if (x < 1 && x > -1 && y < 1 && y > -1)
                {
                    this.Height             = 446;
                    this.toolBg.ImageSource = MSUtils.GetLocalImage("/Assets/Images/bg-tool-open.png");
                }
            };

            //配置
            this.btnSettings.Click += (s, e) =>
            {
                var win = new StudySettingsWindow();
                win.ShowDialog();
            };
        }
예제 #6
0
 public StudentView(ApiModels.Student student)
 {
     StudentId = student.id;
     Name      = student.name;
     Face      = MSUtils.GetStudentFace(student.imgUrl, student.gender);
 }
예제 #7
0
 /// <summary>
 /// 加载指定的网址
 /// </summary>
 /// <param name="urlOrPath"></param>
 public void LoadUrl(string urlOrPath)
 {
     Chrome.Load(MSUtils.LoadWebPath(urlOrPath));
 }