/// <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);
        }
Beispiel #2
0
        /// <summary>
        ///  自主练习
        /// </summary>
        public long DoIndepPractice(IndepPracticeContract model, IEnumerable <WorkAnswerContract> userAnswer = null)
        {
            long doId = 0;

            using (var trans = new TransactionScope())
            {
                if (model != null)
                {
                    doId             = model.Id;
                    model.CreateDate = DateTime.Now;
                    if (doId == 0)
                    {
                        doId = _indepPracticeManager.Insert(model);
                    }
                    else
                    {
                        _indepPracticeManager.UpDate(model);
                    }
                    if (doId > 0)
                    {
                        _workAnserManager.Insert(doId, 2, userAnswer);
                    }
                }
                trans.Complete();
            }
            return(doId);
        }
        /// <summary>
        /// 添加自主练习记录,返回自增id
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public long Insert(IndepPracticeContract model)
        {
            var bulider = new InsertBuilder("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);

            return(AdoProvide.ExecuteScalar <long>(WriteConnectionString, bulider));
        }