/// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="workOutTimeEntity">实体</param>
        public int UpdateEntity(WorkOutTimeEntity workOutTimeEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, workOutTimeEntity);
            sqlBuilder.SetWhere(WorkOutTimeTable.FieldGuid, workOutTimeEntity.Guid);
            return(sqlBuilder.EndUpdate());
        }
        /// <summary>
        /// 得到超时设置实体
        /// </summary>
        /// <param name="worktaskid">任务id</param>
        /// <returns>超时设置实体</returns>
        public WorkOutTimeEntity GetWorkOutTimeInfo(string worktaskid)
        {
            WorkOutTimeEntity entity = null;
            DataTable         dt     = GetWorkOutTimeTable(worktaskid);

            if (dt != null && dt.Rows.Count > 0)
            {
                entity = BaseEntity.Create <WorkOutTimeEntity>(dt);
            }
            return(entity);
        }
        /// <summary>
        /// 更新工作任务超时设置
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">工作任务超时实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateWorkOutTime(UserInfo userInfo, WorkOutTimeEntity entity)
        {
            var returnValue = -1;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_UpdateWorkOutTime);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new WorkOutTimeManager(dbProvider, userInfo);
                returnValue = manager.UpdateWorkOutTime(entity);
            });
            return(returnValue);
        }
        /// <summary>
        /// 依据工作任务主键得到超时设置实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="worktaskid">工作任务Id</param>
        /// <returns>超时设置实体</returns>
        public WorkOutTimeEntity GetWorkOutTimeInfo(UserInfo userInfo, string worktaskid)
        {
            WorkOutTimeEntity returnValue = null;
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_GetWorkOutTimeInfo);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new WorkOutTimeManager(dbProvider, userInfo);
                returnValue = manager.GetWorkOutTimeInfo(worktaskid);
            });
            return(returnValue);
        }
        /// <summary>
        /// 增加工作任务超时设置
        /// </summary>
        /// <param name="entity">工作任务超时实体</param>
        /// <returns>成功返回主键</returns>
        public string InsertWorkOutTime(WorkOutTimeEntity entity)
        {
            string returnStr = string.Empty;

            try
            {
                returnStr = this.AddEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnStr);
        }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">Sql语句生成器</param>
 /// <param name="workOutTimeEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, WorkOutTimeEntity workOutTimeEntity)
 {
     sqlBuilder.SetValue(WorkOutTimeTable.FieldWorkFlowId, workOutTimeEntity.WorkFlowId);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldWorkTaskId, workOutTimeEntity.WorkTaskId);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldName, workOutTimeEntity.Name);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldDays, workOutTimeEntity.Days);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldHours, workOutTimeEntity.Hours);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldMinutes, workOutTimeEntity.Minutes);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldDays1, workOutTimeEntity.Days1);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldHours1, workOutTimeEntity.Hours1);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldMinutes1, workOutTimeEntity.Minutes1);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldDays2, workOutTimeEntity.Days2);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldHours2, workOutTimeEntity.Hours2);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldMinutes2, workOutTimeEntity.Minutes2);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldDone, workOutTimeEntity.Done);
     sqlBuilder.SetValue(WorkOutTimeTable.FieldOverTime, workOutTimeEntity.OverTime);
 }
        /// <summary>
        /// 更新工作任务超时设置
        /// </summary>
        /// <param name="entity">工作任务超时实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateWorkOutTime(WorkOutTimeEntity entity)
        {
            int returnInt = -1;

            if (entity.WorkTaskId.Trim().Length == 0 || entity.WorkTaskId == null)
            {
                throw new Exception("Update方法错误,WorkTaskId不能为空!");
            }
            try
            {
                returnInt = this.UpdateEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnInt);
        }
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="workOutTimeEntity">实体</param>
        public string AddEntity(WorkOutTimeEntity workOutTimeEntity)
        {
            var sequence = string.Empty;

            this.Identity = false;
            if (!string.IsNullOrEmpty(workOutTimeEntity.Guid))
            {
                sequence = workOutTimeEntity.Guid.ToString(CultureInfo.InvariantCulture);
            }
            var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, WorkOutTimeTable.FieldGuid);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(workOutTimeEntity.Guid))
                {
                    sequence = BusinessLogic.NewGuid();
                    workOutTimeEntity.Guid = sequence;
                }
                sqlBuilder.SetValue(WorkOutTimeTable.FieldGuid, workOutTimeEntity.Guid);
            }
            else
            {
                if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(WorkOutTimeTable.FieldGuid, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DBProvider.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(WorkOutTimeTable.FieldGuid, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (string.IsNullOrEmpty(workOutTimeEntity.Guid))
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                var sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            workOutTimeEntity.Guid = sequence;
                        }
                        sqlBuilder.SetValue(WorkOutTimeTable.FieldGuid, workOutTimeEntity.Guid);
                    }
                }
            }
            this.SetEntity(sqlBuilder, workOutTimeEntity);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString(CultureInfo.InvariantCulture);
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="workOutTimeEntity">实体</param>
 public int Update(WorkOutTimeEntity workOutTimeEntity)
 {
     return(this.UpdateEntity(workOutTimeEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="workOutTimeEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(WorkOutTimeEntity workOutTimeEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(workOutTimeEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="workOutTimeEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(WorkOutTimeEntity workOutTimeEntity)
 {
     return(this.AddEntity(workOutTimeEntity));
 }