Ejemplo n.º 1
0
        /// <summary>
        /// 保存批改答案
        /// </summary>
        /// <param name="workAnswer"></param>
        /// <returns></returns>
        public bool CorrectAnswer(WorkAnswerContract workAnswer)
        {
            var bulider = string.Empty;

            if (workAnswer.Id == 0)
            {
                bulider = @"INSERT INTO workanswer(DoId,VersionId,AnswerType,AnswerContent,ResourceType,Score,Assess)
							VALUES (@DoId,@VersionId,@AnswerType,@AnswerContent,@ResourceType,@Score,@Assess)"                            ;
            }
            else
            {
                bulider = @"REPLACE INTO workanswer(Id,DoId,VersionId,AnswerType,AnswerContent,ResourceType,Score,Assess)
							VALUES (@Id,@DoId,@VersionId,@AnswerType,@AnswerContent,@ResourceType,@Score,@Assess)"                            ;
            }
            var _params = new IDataParameter[] {
                AdoProvide.BuildParameter("@Id", workAnswer.Id),
                AdoProvide.BuildParameter("@DoId", workAnswer.DoId),
                AdoProvide.BuildParameter("@VersionId", workAnswer.VersionId),
                AdoProvide.BuildParameter("@AnswerType", workAnswer.AnswerType),
                AdoProvide.BuildParameter("@AnswerContent", workAnswer.AnswerContent ?? string.Empty),
                AdoProvide.BuildParameter("@ResourceType", workAnswer.ResourceType),
                AdoProvide.BuildParameter("@Score", workAnswer.Score),
                AdoProvide.BuildParameter("@Assess", workAnswer.Assess)
            };

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider, _params.ToArray()) > 0);
        }
        /// <summary>
        /// 批量添加作业附件
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public int InsertWorkFileResources(IEnumerable <WorkFileResourceContract> list, long recordId)
        {
            if (null == list || !list.Any())
            {
                return(0);
            }

            var _params = new List <IDataParameter>();

            _params.Add(AdoProvide.BuildParameter("@RecordId", recordId));
            var builder  = new StringBuilder("INSERT INTO workfileresource(RecordId,FileName,FileUrl,FileExt,FileType,FileDesc) VALUES");
            var rowIndex = 0;

            list.ToList().ForEach(item =>
            {
                builder.AppendFormat("(@RecordId,@FileName{0},@FileUrl{0},@FileExt{0},@FileType{0},@FileDesc{0}),", rowIndex);
                _params.Add(AdoProvide.BuildParameter("@FileName" + rowIndex, item.FileName));
                _params.Add(AdoProvide.BuildParameter("@FileUrl" + rowIndex, item.FileUrl));
                _params.Add(AdoProvide.BuildParameter("@FileExt" + rowIndex, item.FileExt));
                _params.Add(AdoProvide.BuildParameter("@FileType" + rowIndex, item.FileType));
                _params.Add(AdoProvide.BuildParameter("@FileDesc" + rowIndex, item.FileDesc));
                rowIndex++;
            });

            builder.Remove(builder.Length - 1, 1);

            //批量写入数据库
            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, builder.ToString(), _params.ToArray()));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 批量添加答案记录
        /// </summary>
        /// <param name="doId"></param>
        /// <param name="answerType"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public int Insert(long doId, int answerType, IEnumerable <WorkAnswerContract> list)
        {
            if (doId == 0 || null == list || !list.Any())
            {
                return(0);
            }

            var rowIndex = 0;
            var _params  = new List <IDataParameter>()
            {
                AdoProvide.BuildParameter("@DoId", doId),
                AdoProvide.BuildParameter("@AnswerType", answerType),
            };

            var builder = new StringBuilder(@"DELETE FROM workanswer WHERE DoId=@DoId AND AnswerType=@AnswerType;");

            builder.Append("INSERT INTO workanswer(DoId,VersionId,AnswerType,AnswerContent,ResourceType,Score,Assess) VALUES");
            list.ToList().ForEach(item =>
            {
                builder.AppendFormat("(@DoId,@VersionId{0},@AnswerType,@AnswerContent{0},@ResourceType{0},@Score{0},@Assess{0}),", rowIndex);
                _params.Add(AdoProvide.BuildParameter("@VersionId" + rowIndex, item.VersionId));
                _params.Add(AdoProvide.BuildParameter("@AnswerContent" + rowIndex, item.AnswerContent ?? string.Empty));
                _params.Add(AdoProvide.BuildParameter("@ResourceType" + rowIndex, item.ResourceType ?? string.Empty));
                _params.Add(AdoProvide.BuildParameter("@Score" + rowIndex, item.Score));
                _params.Add(AdoProvide.BuildParameter("@Assess" + rowIndex, item.Assess));
                rowIndex++;
            });
            builder.Remove(builder.Length - 1, 1);
            //写入数据库
            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, builder.ToString(), _params.ToArray()));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 批量添加试题子资源
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public int InsertResourceParts(IEnumerable <ResourcePartsContract> list)
        {
            if (null == list || !list.Any())
            {
                return(0);
            }

            var _params  = new List <IDataParameter>();
            var builder  = new StringBuilder("INSERT INTO resourceParts VALUES");
            var rowIndex = 0;

            list.ToList().ForEach(item =>
            {
                builder.AppendFormat("(@C{0},@V{0},@R{0}),", rowIndex);
                _params.Add(AdoProvide.BuildParameter("@C" + rowIndex, item.ContentId));
                _params.Add(AdoProvide.BuildParameter("@V" + rowIndex, item.VersionId));
                _params.Add(AdoProvide.BuildParameter("@R" + rowIndex, item.ResourceType));
                rowIndex++;
            });

            builder.Remove(builder.Length - 1, 1);

            //批量写入数据库
            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, builder.ToString(), _params.ToArray()));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新对象
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpDate(IndepPracticeContract model)
        {
            var bulider = new UpdateBuilder("indeppractice")
                          .RegisterField("ProductId", model.ProductId)
                          .RegisterField("AppId", model.AppId)
                          .RegisterField("PackageId", model.PackageId)
                          .RegisterField("PackageName", model.PackageName)
                          .RegisterField("PackageType", model.PackageType)
                          .RegisterField("TaskId", model.TaskId)
                          .RegisterField("ResourceType", model.ResourceType)
                          .RegisterField("VersionId", model.VersionId)
                          .RegisterField("ResourceName", model.ResourceName)
                          .RegisterField("ModuleId", model.ModuleId)
                          .RegisterField("SubmitUserId", model.SubmitUserId)
                          .RegisterField("SubmitUserName", model.SubmitUserName)
                          .RegisterField("WorkScore", model.WorkScore)
                          .RegisterField("ActualScore", model.ActualScore)
                          .RegisterField("CorrectRate", model.CorrectRate)
                          .RegisterField("WorkLong", model.WorkLong)
                          .RegisterField("CreateDate", model.CreateDate)
                          .RegisterField("Status", model.Status)
                          .RegisterClause(new EqualBuilder <long>("Id", model.Id));

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider) > 0);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 更新附件作业状态
        /// </summary>
        /// <param name="doWorkId"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public bool UpdateStatus(long doWorkId, int status)
        {
            var bulider = new UpdateBuilder("fileWorks")
                          .RegisterField("Status", status)
                          .RegisterClause(new EqualBuilder <long>("DoWorkId", doWorkId));

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider) > 0);
        }
Ejemplo n.º 7
0
        public bool Update(SupportContract model)
        {
            var bulider = new UpdateBuilder("support")
                          .RegisterField("SupportNum", model.SupportNum)
                          .RegisterField("OpposeNum", model.OpposeNum)
                          .RegisterClause(new EqualBuilder <long>("ResourceId", model.ResourceId));

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider) > 0);
        }
Ejemplo n.º 8
0
        public bool Insert(SupportContract model)
        {
            var bulider = new InsertBuilder("support")
                          .RegisterField("ResourceId", model.ResourceId)
                          .RegisterField("SupportNum", model.SupportNum)
                          .RegisterField("OpposeNum", model.OpposeNum)
                          .RegisterField("ReadNum", model.ReadNum);

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider) > 0);
        }
Ejemplo n.º 9
0
        public bool InsertRecord(SupportRecordContract model)
        {
            var bulider = new InsertBuilder("supportrecord")
                          .RegisterField("UserId", model.UserId)
                          .RegisterField("UserName", model.UserName)
                          .RegisterField("ResourceId", model.ResourceId)
                          .RegisterField("CreateDate", model.CreatDate)
                          .RegisterField("Status", model.Status);

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider) > 0);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 更新单元汇总
        /// </summary>
        /// <param name="contentId"></param>
        /// <param name="workId"></param>
        /// <param name="recordId"></param>
        /// <param name="totalNum"></param>
        public void SetUnitSummary(long contentId, long workId, long recordId, int totalNum)
        {
            var builder = "CALL Proc_CensusUnitSummary(@contentId,@workId,@recordId,@totalNum)";

            var _params = new IDataParameter[] {
                AdoProvide.BuildParameter("@contentId", contentId),
                AdoProvide.BuildParameter("@workId", workId),
                AdoProvide.BuildParameter("@recordId", recordId),
                AdoProvide.BuildParameter("@totalNum", totalNum)
            };

            AdoProvide.ExecuteNonQuery(WriteConnectionString, builder, _params);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(FileWorksContracts model)
        {
            var bulider = new UpdateBuilder("fileWorks")
                          .RegisterField("WorkLevel", model.WorkLevel)
                          .RegisterField("WorkLong", model.WorkLong)
                          .RegisterField("SubmitDate", model.SubmitDate)
                          .RegisterField("IsTimeOut", model.IsTimeOut)
                          .RegisterField("SubmitCount", model.SubmitCount)
                          .RegisterField("Message", model.Message ?? string.Empty)
                          .RegisterField("Comment", model.Comment)
                          .RegisterField("CommentType", model.CommentType)
                          .RegisterField("FileCount", model.FileCount)
                          .RegisterField("Status", model.Status)
                          .RegisterClause(new EqualBuilder <long>("DoId", model.DoId));

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider) > 0);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 作业点评
        /// </summary>
        /// <param name="userIds"></param>
        /// <param name="workId"></param>
        /// <param name="contentId"></param>
        /// <param name="content"></param>
        /// <param name="commentType"></param>
        /// <returns></returns>
        public bool CommentUnitWorks(IEnumerable <int> userIds, long workId, long contentId, string content, int commentType)
        {
            if (null == userIds || !userIds.Any() || string.IsNullOrWhiteSpace(content))
            {
                return(false);
            }

            var builder = @"UPDATE unitworks SET `Comment` = @comment,CommentType = @commentType
                            WHERE WorkId = @workId AND ContentId = @contentId AND SubmitUserId IN({0})";

            builder = string.Format(builder, string.Join(",", userIds));

            var _params = new IDataParameter[] {
                AdoProvide.BuildParameter("@workId", workId),
                AdoProvide.BuildParameter("@contentId", contentId),
                AdoProvide.BuildParameter("@commentType", commentType),
                AdoProvide.BuildParameter("@comment", content)
            };

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, builder, _params) > 0);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 批量批改作业
        /// </summary>
        /// <param name="workId"></param>
        /// <param name="userIdList"></param>
        /// <returns></returns>
        public bool UpdateDoWorkStatus(IEnumerable <int> userIdList, long workId, int workStatus, decimal actualScore)
        {
            if (null == userIdList || !userIdList.Any())
            {
                return(false);
            }

            string sql = string.Empty;

            if (actualScore < 0)
            {
                sql = string.Format("UPDATE doworkbase SET WorkStatus = @WorkStatus WHERE WorkId = @WorkId AND SubmitUserId IN ({0});", string.Join(",", userIdList));
            }
            else
            {
                sql = string.Format("UPDATE doworkbase SET WorkStatus = @WorkStatus, ActualScore = @ActualScore WHERE WorkId = @WorkId AND SubmitUserId IN ({0});", string.Join(",", userIdList));
            }

            sql += @"UPDATE workbase SET CompletedNum = (SELECT COUNT(*) FROM doworkbase WHERE doworkbase.WorkStatus IN(2,3,5) AND doworkbase.WorkID = workbase.WorkID),
				     MarkNum = (SELECT COUNT(*) FROM doworkbase WHERE doworkbase.WorkStatus = 3 AND doworkbase.WorkID = workbase.WorkID) WHERE WorkID = @workId;"                ;

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, sql, AdoProvide.BuildParameter("@WorkId", workId), AdoProvide.BuildParameter("@ActualScore", actualScore), AdoProvide.BuildParameter("@WorkStatus", workStatus)) > 0);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(UnitWorksContract model)
        {
            var bulider = new UpdateBuilder("unitworks")
                          .RegisterField("ContentId", model.ContentId)
                          .RegisterField("RecordId", model.RecordId)
                          .RegisterField("WorkId", model.WorkId)
                          .RegisterField("DoWorkId", model.DoWorkId)
                          .RegisterField("SubmitUserId", model.SubmitUserId)
                          .RegisterField("SubmitUserName", model.SubmitUserName)
                          .RegisterField("WorkScore", model.WorkScore)
                          .RegisterField("ActualScore", model.ActualScore)
                          .RegisterField("CorrectRate", model.CorrectRate)
                          .RegisterField("WorkLong", model.WorkLong)
                          .RegisterField("SubmitDate", model.SubmitDate)
                          .RegisterField("IsTimeOut", model.IsTimeOut)
                          .RegisterField("SubmitCount", model.SubmitCount)
                          .RegisterField("Comment", model.Comment)
                          .RegisterField("CommentType", model.CommentType)
                          .RegisterField("Status", model.Status)
                          .RegisterClause(new EqualBuilder <long>("DoId", model.DoId));

            return(AdoProvide.ExecuteNonQuery(WriteConnectionString, bulider) > 0);
        }