Beispiel #1
0
        /// <summary>
        /// 上传作业成绩
        /// </summary>
        /// <param name="studentCode"></param>
        /// <param name="examSubjectID">科目编号</param>
        /// <param name="scoreDetail">成绩</param>
        /// <returns></returns>
        public string UploadJobScore(string studentCode, M_MyJob job, string scoreDetail, out string uploadResult)
        {
            string         state        = string.Empty;
            string         rXml         = string.Empty;
            string         result       = string.Empty;
            string         message      = string.Empty;
            StringBuilder  sbParam      = new StringBuilder();
            List <M_MyJob> listHomeWork = new List <M_MyJob>();

            sbParam.AppendFormat("<StudentCode>{0}</StudentCode>", studentCode);
            sbParam.AppendFormat("<ClassID>{0}</ClassID>", job.ClassID);
            sbParam.AppendFormat("<ClassName>{0}</ClassName>", job.ClassName);
            sbParam.AppendFormat("<FileID>{0}</FileID>", job.FileID);

            rXml   = publicClass.ReturnRequest(sbParam.ToString(), scoreDetail, Globals.CODE_UploadHWScore);
            result = Globals.SERVICE.examonline(DES.EncryStrHexUTF8(rXml, "sower"), Globals.CODE_UploadHWScore);

            if (publicClass.IsRight(result))
            {
                state   = xmlUnit.GetXmlNodeValue(result, "state");
                message = xmlUnit.GetXmlNodeValue(result, "exsm");
            }
            else
            {
                message = errorMessage;
            }

            uploadResult = message;
            return(state);
        }
Beispiel #2
0
        /// <summary>
        /// 上传试卷
        /// </summary>
        /// <returns></returns>
        public void UploadExamFile(string studentCode, M_MyJob job, string filePath)
        {
            string state    = string.Empty;
            string rXml     = string.Empty;
            string result   = string.Empty;
            string message  = string.Empty;
            string fileName = string.Empty;

            byte[]        fileByte = null;
            StringBuilder sbParam  = new StringBuilder();

            fileName = Path.GetFileName(filePath);
            fileByte = FileOperate.SetFileToByteArray(filePath);
            sbParam.AppendFormat("<Code>{0}</Code>", studentCode);
            sbParam.AppendFormat("<FileName>{0}</FileName>", fileName);
            sbParam.AppendFormat("<FileID>{0}</FileID>", job.FileID);
            sbParam.AppendFormat("<HWID>{0}</HWID>", job.HWID);
            rXml   = publicClass.ReturnRequest(sbParam.ToString(), Globals.CODE_UploadExamFile);
            result = Globals.SERVICE.examupload(rXml, Globals.CODE_UploadExamFile, fileByte);

            if (publicClass.IsRight(result))
            {
                state = xmlUnit.GetXmlNodeValue(result, "state");
            }
            else
            {
                message = errorMessage;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 添加视频文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddVideoFile_Click(object sender, EventArgs e)
        {
            if (dgvResult.SelectedRows.Count == 0)
            {
                return;
            }
            M_MyJob myJob = dgvResult.SelectedRows[0].DataBoundItem as M_MyJob;

            ofdOpenFile.Title            = "视频资源";
            ofdOpenFile.FileName         = "视频资源";
            ofdOpenFile.Filter           = "视频资源|*.zip*";
            ofdOpenFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            DialogResult result = ofdOpenFile.ShowDialog();

            if (result == DialogResult.OK)
            {
                string filePath = ofdOpenFile.FileName;
                string fileName = Path.GetFileName(filePath);
                string fileExt  = Path.GetExtension(filePath).ToLower();
                string copyPath = string.Format(@"{0}\SowerTestClient\Video\{1}_{2}\",
                                                Application.StartupPath, PublicClass.StudentCode, DirFileHelper.GetFileNameNoExtension(filePath));
                string videoFileName = string.IsNullOrEmpty(myJob.VideoFileName) == true ? "" : myJob.VideoFileName.ToLower();
                if (string.IsNullOrEmpty(videoFileName))
                {
                    Msg.ShowInformation(string.Format("作业“{0}”没有添加视频资源,请联系授课教师到作业中心->作业维护发布列表进行添加。", myJob.HWName));
                    return;
                }
                if (fileName.ToLower() != videoFileName)
                {
                    Msg.ShowInformation(string.Format("您添加的视频资源无效,请添加名字为{0}的视频资源。", videoFileName));
                    return;
                }
                try
                {
                    if (fileExt != ".zip")
                    {
                        PublicClass.ShowMessageOk("该文件不是有效的视频资源包,请重新添加!");
                        return;
                    }
                    if (Directory.Exists(copyPath))
                    {
                        DialogResult dialogResult = PublicClass.ShowMessageOKCancel("该视频资源包已经存在,确定要覆盖吗?");
                        if (dialogResult == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                    CommonUtil.ShowProcessing("正在处理中,请稍候...", this, (obj) =>
                    {
                        ZipFileTools.UnZipSZL(filePath, copyPath);
                        dgvResult.SelectedRows[0].Cells["VideoDownLoadState"].Value = "已下载";
                    }, null);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(typeof(frmHomeWork), ex);
                    CommonUtil.WriteLog(ex);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 作业排序
        /// </summary>
        /// <param name="job1"></param>
        /// <param name="job2"></param>
        /// <returns></returns>
        private int SortMyJob(M_MyJob job1, M_MyJob job2)
        {
            if (string.IsNullOrEmpty(job1.CourseName) || string.IsNullOrEmpty(job2.CourseName))
            {
                return(0);
            }
            if (string.IsNullOrEmpty(job1.ChapterName) || string.IsNullOrEmpty(job2.ChapterName))
            {
                return(0);
            }
            if (string.IsNullOrEmpty(job1.HWName) || string.IsNullOrEmpty(job2.HWName))
            {
                return(0);
            }

            if (job1.CourseName.CompareTo(job2.CourseName) != 0)
            {
                return(job1.CourseName.CompareTo(job2.CourseName));
            }
            else if (job1.ChapterName.CompareTo(job2.ChapterName) != 0)
            {
                return(job1.ChapterName.CompareTo(job2.ChapterName));
            }
            else
            {
                return(job1.HWName.CompareTo(job2.HWName));
            }
        }
Beispiel #5
0
        private void FtpDownload(M_MyJob myJob)
        {
            //文件路径
            string filePath = Path.GetDirectoryName(myJob.FilePath).Replace("\\", "//");
            //文件名
            string fileName = Path.GetFileName(myJob.FilePath);
            //复制文件到系统路径
            string copyPath = string.Format(@"{0}\SowerTestClient\Paper\Download\{1}_{2}", Application.StartupPath, PublicClass.StudentCode, fileName);
            //下载文件保存路径
            string savePath = string.Format("{0}\\{1}", Globals.DownLoadDir, fileName);

            FtpWeb ftpWeb = CommonUtil.GetFtpWeb();

            if (ftpWeb != null)
            {
                ftpWeb.Download(Globals.DownLoadDir, fileName, filePath, tsbBar, tsbMessage, "作业下载进度:");
            }

            //复制作业到系统目录
            File.Copy(savePath, copyPath, true);
            //删除下载文件
            File.Delete(savePath);
            //设置已下载状态
            dgvResult.SelectedRows[0].Cells["JobDownLoadState"].Value = "已下载";
            tsbMessage.Text = "作业下载进度:";
            tsbBar.Value    = 0;
            //下载账套文件
            if (ftpWeb != null && myJob.RequireEnvFile.ToLower() == "true" && myJob.IsUpload.ToLower() == "true" && cbIsDownAccount.Checked == true)
            {
                filePath = Path.GetDirectoryName(myJob.EnvFilePath).Replace("\\", "//");
                fileName = myJob.EnvFileName;
                copyPath = string.Format(@"{0}\SowerTestClient\Paper\Account\{1}", Application.StartupPath, fileName);
                savePath = string.Format("{0}\\{1}", Globals.DownLoadDir, fileName);
                ftpWeb.Download(Globals.DownLoadDir, fileName, filePath, tsbBar, tsbMessage, "帐套下载进度:");
                //复制作业到系统目录
                DirFileHelper.Copy(savePath, copyPath);
                //删除临时下载文件
                DirFileHelper.DeleteFile(savePath);
                tsbMessage.Text = "帐套下载进度:";
                tsbBar.Value    = 0;
                dgvResult.SelectedRows[0].Cells["AccountDownLoadState"].Value = "已下载";
            }
            //下载视频文件
            if (ftpWeb != null && myJob.IsUploadVideoFile == true && string.IsNullOrEmpty(myJob.VideoFilePath) == false && cbIsDownVideo.Checked == true)
            {
                filePath = Path.GetDirectoryName(myJob.VideoFilePath).Replace("\\", "//");
                fileName = myJob.VideoFileName;
                copyPath = string.Format(@"{0}\SowerTestClient\Video\{1}_{2}\", Application.StartupPath, PublicClass.StudentCode, DirFileHelper.GetFileNameNoExtension(myJob.VideoFilePath));
                savePath = string.Format("{0}\\{1}", Globals.DownLoadDir, fileName);
                ftpWeb.Download(Globals.DownLoadDir, fileName, filePath, tsbBar, tsbMessage, "视频下载进度:");
                //复制作业到系统目录
                ZipFileTools.UnZipSZL(savePath, copyPath);
                //删除临时下载文件
                DirFileHelper.DeleteFile(savePath);
                tsbMessage.Text = "视频下载进度:";
                tsbBar.Value    = 0;
                dgvResult.SelectedRows[0].Cells["VideoDownLoadState"].Value = "已下载";
            }
        }
Beispiel #6
0
 /// <summary>
 /// 排序
 /// </summary>
 /// <param name="job1"></param>
 /// <param name="job2"></param>
 /// <returns></returns>
 private int SortMyJob(M_MyJob job1, M_MyJob job2)
 {
     if (job1.CourseName.CompareTo(job2.CourseName) != 0)
         return job1.CourseName.CompareTo(job2.CourseName);
     else if (job1.ChapterName.CompareTo(job2.ChapterName) != 0)
         return job1.ChapterName.CompareTo(job2.ChapterName);
     else
         return job1.HWName.CompareTo(job2.HWName);
 }
Beispiel #7
0
        private void btnAddEnvfile_Click(object sender, EventArgs e)
        {
            if (dgvResult.SelectedRows.Count == 0) return;
            M_MyJob myJob = dgvResult.SelectedRows[0].DataBoundItem as M_MyJob;
            ofdOpenFile.Title = "账套文件";
            ofdOpenFile.FileName = "账套文件";
            ofdOpenFile.Filter = "账套文件|*.casf*";
            ofdOpenFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            DialogResult result = ofdOpenFile.ShowDialog();
            if (result == DialogResult.OK)
            {
                string filePath = ofdOpenFile.FileName;
                string fileName = Path.GetFileName(filePath);
                string fileExt = Path.GetExtension(filePath).ToLower();
                string copyPath = string.Format(@"{0}\SowerTestClient\Paper\Account\{1}", Application.StartupPath, fileName);
                string envFileName = string.IsNullOrEmpty(myJob.EnvFileName) == true ? "" : myJob.EnvFileName.ToLower();
                if (string.IsNullOrEmpty(envFileName))
                {
                    Msg.ShowInformation(string.Format("作业“{0}”没有添加账套文件,请联系授课教师到作业中心->作业维护发布列表进行添加。", myJob.HWName));
                    return;
                }
                if (fileName.ToLower() != envFileName)
                {
                    Msg.ShowInformation(string.Format("您添加的帐套文件无效,请添加名字为【{0}】的账套文件。", envFileName));
                    return;
                }
                try
                {
                    if (fileExt != ".casf")
                    {
                        PublicClass.ShowMessageOk("该文件不是有效的账套文件,请重新添加!");
                        return;
                    }

                    if (File.Exists(copyPath))
                    {
                        DialogResult dialogResult = PublicClass.ShowMessageOKCancel("该账套文件已经存在,确定要覆盖吗?");
                        if (dialogResult == DialogResult.Cancel) return;
                    }

                    CommonUtil.ShowProcessing("正在处理中,请稍候...", this, (obj) =>
                    {
                        File.Copy(filePath, copyPath, true);
                        dgvResult.SelectedRows[0].Cells["AccountDownLoadState"].Value = "已下载";
                    }, null);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(typeof(frmHomeWork), ex);
                    CommonUtil.WriteLog(ex);
                }
            }
        }
Beispiel #8
0
        private void dgvResult_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvResult.SelectedRows.Count == 0)
            {
                return;
            }
            M_MyJob myJob = dgvResult.SelectedRows[0].DataBoundItem as M_MyJob;

            cbIsDownAccount.Checked = false;
            cbIsDownVideo.Checked   = false;

            if (myJob.RequireEnvFile.ToLower() == "true" && myJob.IsUpload.ToLower() == "true")
            {
                cbIsDownAccount.Checked = true;
            }

            if (string.IsNullOrEmpty(myJob.VideoFilePath) == false && myJob.IsUploadVideoFile == true)
            {
                cbIsDownVideo.Checked = true;
            }
        }
Beispiel #9
0
        /// <summary>
        /// 添加作业文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddHWFile_Click(object sender, EventArgs e)
        {
            var filePath       = string.Empty;
            var fileName       = string.Empty;
            var copyPath       = string.Empty;
            var unFilePath     = string.Empty;
            var contentPath    = string.Empty;
            var topicDBCode    = string.Empty;
            var topicDBVersion = string.Empty;
            var sExistsHWFile  = string.Empty;

            if (dgvResult.SelectedRows.Count == 0)
            {
                return;
            }
            M_MyJob myJob = dgvResult.SelectedRows[0].DataBoundItem as M_MyJob;

            ofdOpenFile.Title            = "作业文件";
            ofdOpenFile.FileName         = "作业文件";
            ofdOpenFile.Filter           = "作业文件|*.zip*";
            ofdOpenFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            DialogResult result = ofdOpenFile.ShowDialog();

            if (result == DialogResult.OK)
            {
                filePath = ofdOpenFile.FileName;
                fileName = Path.GetFileName(myJob.FilePath);
                copyPath = string.Format(@"{0}\SowerTestClient\Paper\Download\{1}_{2}", Application.StartupPath, PublicClass.StudentCode, fileName);
                try
                {
                    //解压作业文件
                    unFilePath  = string.Format("{0}\\{1}\\data", Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath));
                    contentPath = Directory.GetParent(unFilePath).FullName;
                    PublicClass.SowerExamPlugn.foUnZipFiles(filePath, unFilePath, PublicClass.PasswordUserPaper);
                    topicDBCode    = PublicClass.SowerExamPlugn.GetParaValue(contentPath, "试卷参数", "TopicDBCode");
                    topicDBVersion = PublicClass.SowerExamPlugn.GetParaValue(contentPath, "试卷参数", "TopicDBVersion");
                    sExistsHWFile  = bService.ExistsHWFile(myJob.HWID, topicDBCode, topicDBVersion);
                    if (sExistsHWFile == "-1")
                    {
                        Msg.ShowInformation("该作业文件无效!");
                        return;
                    }
                    if (File.Exists(copyPath))
                    {
                        DialogResult dialogResult = PublicClass.ShowMessageOKCancel("该作业文件已经存在,确定要覆盖吗?");
                        if (dialogResult == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                    CommonUtil.ShowProcessing("正在处理中,请稍候...", this, (obj) =>
                    {
                        File.Copy(filePath, copyPath, true);
                        dgvResult.SelectedRows[0].Cells["JobDownLoadState"].Value = "已下载";
                    }, null);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(typeof(frmHomeWork), ex);
                    CommonUtil.WriteLog(ex);
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// HTTP下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDownLoad_Click(object sender, EventArgs e)
        {
            if (dgvResult.SelectedRows.Count == 0)
            {
                return;
            }
            M_MyJob myJob = dgvResult.SelectedRows[0].DataBoundItem as M_MyJob;

            myJob.StudentCode = PublicClass.StudentCode;

            #region                                           //作业限定时间&&当前时间小于作业发布开始时间
            if (myJob.HWSubmitTimeType.ToLower() == "true" && //1:限时,0:不限时
                Globals.ServerTime < DateTime.Parse(myJob.ExamStartDateTime))
            {
                PublicClass.ShowMessageOk("还没有到作业时间,不允许下载作业。");
                return;
            }
            #endregion

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

            try
            {
                btnDownLoad.Enabled     = false;
                this.ParentForm.Enabled = false;
                if (Globals.DownType == "1")
                {
                    FtpWeb ftpWeb = CommonUtil.GetFtpWeb();
                    if (ftpWeb != null)
                    {
                        FtpDownload(myJob);
                    }
                    else
                    {
                        HttpDownload(myJob);
                    }
                }
                else
                {
                    HttpDownload(myJob);
                }
            }
            catch (Exception ex)
            {
                PublicClass.ShowMessageOk("下载作业出错,错误详情请参考系统日志。");
                LogHelper.WriteLog(typeof(frmHomeWork), ex);
                CommonUtil.WriteLog(ex);
            }
            finally
            {
                btnDownLoad.Enabled     = true;
                this.ParentForm.Enabled = true;
            }
        }
Beispiel #11
0
        private void HttpDownload(M_MyJob myJob)
        {
            //下载地址
            string downLoadUrl = string.Format("{0}/{1}", fileHost, myJob.FilePath.Replace(@"\", @"/"));
            //文件路径
            string filePath = myJob.FilePath;
            //文件名
            string fileName = Path.GetFileName(filePath);
            //复制文件到系统路径
            string copyPath = string.Format(@"{0}\SowerTestClient\Paper\Download\{1}_{2}", Application.StartupPath, PublicClass.StudentCode, fileName);
            //下载文件保存路径
            string savePath = string.Format("{0}\\{1}_{2}", Globals.DownLoadDir, PublicClass.StudentCode, fileName);
            //下载作业
            bool downResult = CommonUtil.DownloadFile(downLoadUrl, savePath, tsbBar, tsbMessage, "作业下载进度:");

            if (downResult)
            {
                //复制作业到系统目录
                File.Copy(savePath, copyPath, true);
                //删除下载文件
                File.Delete(savePath);
                //设置已下载状态
                dgvResult.SelectedRows[0].Cells["JobDownLoadState"].Value = "已下载";
                tsbMessage.Text = "作业下载进度:";
                tsbBar.Value    = 0;
            }
            if (myJob.RequireEnvFile.ToLower() == "true" && myJob.IsUpload.ToLower() == "true" && cbIsDownAccount.Checked == true)
            {
                downLoadUrl = string.Format("{0}/{1}", fileHost, myJob.EnvFilePath.Replace(@"\", @"/"));
                filePath    = myJob.FilePath;
                fileName    = myJob.EnvFileName;
                copyPath    = string.Format(@"{0}\SowerTestClient\Paper\Account\{1}", Application.StartupPath, fileName);
                savePath    = string.Format("{0}\\{1}", Globals.DownLoadDir, fileName);
                downResult  = CommonUtil.DownloadFile(downLoadUrl, savePath, tsbBar, tsbMessage, "帐套下载进度:");
                if (downResult)
                {
                    //复制作业到系统目录
                    DirFileHelper.Copy(savePath, copyPath);
                    //删除临时下载文件
                    DirFileHelper.DeleteFile(savePath);
                    tsbMessage.Text = "账套下载进度:";
                    tsbBar.Value    = 0;
                    dgvResult.SelectedRows[0].Cells["AccountDownLoadState"].Value = "已下载";
                }
            }
            //下载视频文件
            if (string.IsNullOrEmpty(myJob.VideoFilePath) == false && myJob.IsUploadVideoFile == true && cbIsDownVideo.Checked == true)
            {
                downLoadUrl = string.Format("{0}/{1}", fileHost, myJob.VideoFilePath.Replace(@"\", @"/"));
                filePath    = myJob.VideoFilePath;
                fileName    = myJob.VideoFileName;
                copyPath    = string.Format(@"{0}\SowerTestClient\Video\{1}_{2}", Application.StartupPath, PublicClass.StudentCode, Path.GetFileNameWithoutExtension(fileName));
                savePath    = string.Format("{0}\\{1}", Globals.DownLoadDir, fileName);
                downResult  = CommonUtil.DownloadFile(downLoadUrl, savePath, tsbBar, tsbMessage, "视频下载进度:");
                if (downResult)
                {
                    //复制作业到系统目录
                    ZipFileTools.UnZipSZL(savePath, copyPath);
                    //删除临时下载文件
                    DirFileHelper.DeleteFile(savePath);
                    tsbMessage.Text = "视频下载进度:";
                    tsbBar.Value    = 0;
                    dgvResult.SelectedRows[0].Cells["VideoDownLoadState"].Value = "已下载";
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// 还原作业文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRestoreJob_Click(object sender, EventArgs e)
        {
            var          fileName     = string.Empty;
            var          fileFullPath = string.Empty;
            var          myJob        = new M_MyJob();
            var          listMyJob    = new List <M_MyJob>();
            DialogResult dialogResult = ofdOpenFile.ShowDialog();

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            try
            {
                fileFullPath = ofdOpenFile.FileName;
                fileName     = Path.GetFileNameWithoutExtension(fileFullPath);
                InitialStudentDir(fileName);
                CommonUtil.ShowProcessing("正在处理中,请稍候...", this, (obj) =>
                {
                    ZipFileTools.UnZipSZL(fileFullPath, PublicClass.StudentDir);
                    #region 初始化作业信息
                    myJob.JobNo                   = "1";
                    myJob.RealName                = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "RealName");
                    myJob.ShowScore               = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ShowScore");
                    myJob.ShowAnalysis            = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ShowAnalysis");
                    myJob.ExamMode                = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ExamMode");
                    myJob.CreateTime              = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "CreateTime");
                    myJob.IsAllowReSubmitScore    = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "IsAllowReSubmitScore");
                    myJob.AllowReSubmitScoreCount = publicClass.IntParse(PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "AllowReSubmitScoreCount"));
                    myJob.HWSubmitTimeType        = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "HWSubmitTimeType");
                    myJob.CourseName              = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "CourseName");
                    myJob.ChapterName             = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ChapterName");
                    myJob.HWName                  = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "HWName");
                    myJob.EnvFileName             = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "EnvFileName");
                    myJob.FileName                = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "FileName");
                    myJob.FilePath                = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "FilePath");
                    myJob.IsEnable                = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "IsEnable");
                    myJob.IsScoreToCenter         = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "IsScoreToCenter");
                    myJob.ManagerName             = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ManagerName");
                    myJob.IsCaculateTime          = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "IsCaculateTime");
                    myJob.ClassName               = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ClassName");
                    myJob.SpecialtyID             = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "SpecialtyID");
                    myJob.CityID                  = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "CityID");
                    myJob.PublicUserID            = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "PublicUserID");
                    myJob.ExamStartDateTime       = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ExamStartDateTime");
                    myJob.ExamEndDateTime         = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ExamEndDateTime");
                    myJob.IsPay                   = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "IsPay");
                    myJob.IsSingleGrade           = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "IsSingleGrade");
                    myJob.JobDownLoadState        = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "JobDownLoadState");
                    myJob.ScoreSubmitted          = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ScoreSubmitted");
                    myJob.ClassID                 = publicClass.IntParse(PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "ClassID"));
                    myJob.AccountDownLoadState    = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "AccountDownLoadState");
                    myJob.IsUploadAnswerFile      = PublicClass.SowerExamPlugn.GetParaValue(PublicClass.StudentDir, "作业信息", "IsUploadAnswerFile");
                    #endregion
                    listMyJob.Add(myJob);
                    PublicClass.oMyJob  = myJob;
                    PublicClass.JobType = JobType.ShiJuan;
                }, null);
                dgvResult.AutoGenerateColumns = false;
                dgvResult.DataSource          = listMyJob;
                btnDoJob.Enabled = true;
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(frmHomeWork), ex);
            }
        }
Beispiel #13
0
 /// <summary>
 /// 上传作业成绩
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="examSubjectID">科目编号</param>
 /// <param name="scoreDetail">成绩</param>
 /// <returns></returns>
 public string UploadJobScore(string userID, M_MyJob job, string scoreDetail, out string uploadResult)
 {
     return(dal.UploadJobScore(userID, job, scoreDetail, out uploadResult));
 }
Beispiel #14
0
 /// <summary>
 /// 上传试卷
 /// </summary>
 /// <returns></returns>
 public void UploadExamFile(string studentCode, M_MyJob job, string filePath)
 {
     dal.UploadExamFile(studentCode, job, filePath);
 }
Beispiel #15
0
        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);
            }
        }