コード例 #1
0
        private void btnZuJuan_Click(object sender, EventArgs e)
        {
            string existsResult = string.Empty;

            try
            {
                if (cboSubject.SelectedIndex == 0)
                {
                    PublicClass.ShowMessageOk("请选择一门考试科目,在进行后续操作。");
                    return;
                }
                PublicClass.SubjectName = cboSubject.SelectedValue.ToString();
                PublicClass.JobType     = JobType.TiKu;
                InitialStudentDir();
                InitialSubjectProp();
                InitialKaoShiFangShi();
                PublicClass.oSubjectProp.PresetPaperID = Convert.ToInt32(lbTaoJuan.SelectedValue);
                PublicClass.VideoFilePath = string.Format(@"{0}\SowerTestClient\Video\{1}_{2}\", Application.StartupPath, PublicClass.StudentCode, DirFileHelper.GetFileNameNoExtension(PublicClass.oSubjectProp.MediaPackageFileName));
                frmBusicWorkMain busicWorkMain = this.ParentForm as frmBusicWorkMain;
                existsResult = bService.ExistsTopicDB(PublicClass.oSubjectProp.TopicDBCode, PublicClass.oSubjectProp.TopicDBVersion);
                if (existsResult == "-1")
                {
                    Msg.ShowInformation("在作业中心->练习题库列表中没有添加该文件,请联系授课老师进行添加。");
                    return;
                }
                //模拟练习
                if (rdoExercise.Checked)
                {
                    PublicClass.oSubjectProp.ExamMode = "1";
                    PublicClass.SowerExamPlugn.SetParaValue(PublicClass.StudentDir, "题库信息", "考试模式", "1");

                    frmExamInfo examInfo = new frmExamInfo();
                    examInfo.Show();
                    busicWorkMain.Hide();
                }
                //正式考试
                if (rdoExam.Checked)
                {
                    PublicClass.oSubjectProp.ExamMode = "2";
                    PublicClass.SowerExamPlugn.SetParaValue(PublicClass.StudentDir, "题库信息", "考试模式", "2");

                    frmExamSubject examSubject = new frmExamSubject();
                    CommonUtil.subjectIndex = cboSubject.SelectedIndex;
                    examSubject.Show();
                    busicWorkMain.Hide();
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(frmExercise), ex);
                CommonUtil.WriteLog(ex);
                PublicClass.ShowErrorMessageOk(ex.Message);
            }
        }
コード例 #2
0
ファイル: frmDownWork.cs プロジェクト: flower1990/KXLHWClient
        private void btnDoJob_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvResult.SelectedRows.Count == 0) return;
                M_MyJob myJob = dgvResult.SelectedRows[0].DataBoundItem as M_MyJob;
                PublicClass.oMyJob = myJob;
                PublicClass.JobType = JobType.ShiJuan;
                PublicClass.VideoFilePath = string.Format(@"{0}\SowerTestClient\Video\{1}_{2}\",
                    Application.StartupPath, PublicClass.StudentCode, DirFileHelper.GetFileNameNoExtension(myJob.VideoFilePath));

                //作业限定时间&&当前时间小于作业发布开始时间
                if (myJob.HWSubmitTimeType.ToLower() == "true" &&       //true:限时,false:不限时
                    Globals.ServerTime < DateTime.Parse(myJob.ExamStartDateTime))
                {
                    PublicClass.ShowMessageOk("还没有到做作业的时间,先休息休息吧!");
                    return;
                }

                //作业限定时间&&不允许补交作业&&当前时间大于作业提交截止时间
                if (myJob.HWSubmitTimeType.ToLower() == "true" &&       //true:限时,false:不限时
                    myJob.IsPay.ToLower() == "false" &&           //true:允许补交作业,false:不允许补交作业
                    Globals.ServerTime > DateTime.Parse(myJob.ExamEndDateTime))
                {
                    PublicClass.ShowMessageOk("对不起,您已经过了交作业时间。\n请联系老师允许您补交作业!");
                    return;
                }

                //不允许重复提交&&作业已经提交
                if (myJob.IsAllowReSubmitScore.ToLower() == "false" &&
                    myJob.ScoreSubmitted == "1")
                {
                    PublicClass.ShowMessageOk("对不起,您已经提交过作业,不能重复提交!");
                    return;
                }

                //允许重复提交&&大于重复提交次数
                if (myJob.IsAllowReSubmitScore.ToLower() == "true" &&
                    myJob.AllowReSubmitScoreCount <= myJob.SubmittedCount &&
                    myJob.AllowReSubmitScoreCount != -1)
                {
                    PublicClass.ShowMessageOk(string.Format("对不起,您只能提交{0}次成绩!", myJob.AllowReSubmitScoreCount));
                    return;
                }

                string envFilePath = string.Format(@"{0}\SowerTestClient\Paper\Account\{1}", Application.StartupPath, myJob.EnvFileName);
                string requireEnvFile = string.IsNullOrEmpty(myJob.RequireEnvFile) == true ? "false" : myJob.RequireEnvFile.ToLower();
                if (requireEnvFile == "true" && !File.Exists(envFilePath))
                {
                    PublicClass.ShowMessageOk(string.Format("对不起,没有检测到账套文件{0}。\n请您进行手动添加!", myJob.EnvFileName));
                    return;
                }

                InitialStudentDir();

                InitialSubjectProp();

                InitialKaoShiFangShi();

                frmExamInfo examInfo = new frmExamInfo();
                examInfo.Show();

                frmBusicWorkMain busicWorkMain = this.ParentForm as frmBusicWorkMain;
                busicWorkMain.Hide();
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(frmDownWork), ex);
                CommonUtil.WriteLog(ex);
            }
        }