Beispiel #1
0
        /// <summary>
        /// 设置实体
        /// </summary>
        /// <param name="sqlBuilder">Sql语句生成器</param>
        /// <param name="workServiceMessageEntity">实体</param>
        private void SetEntity(SQLBuilder sqlBuilder, WorkServiceMessageEntity workServiceMessageEntity)
        {
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldWorkFlowId, workServiceMessageEntity.WorkFlowId);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldWorkTaskId, workServiceMessageEntity.WorkTaskId);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldWorkflowInsId, workServiceMessageEntity.WorkflowInsId);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldWorktaskInsId, workServiceMessageEntity.WorktaskInsId);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldContent, workServiceMessageEntity.Content);
            if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
            {
                sqlBuilder.SetValue(WorkServiceMessageTable.FieldSendTime1, workServiceMessageEntity.SendTime1 != null ? BusinessLogic.GetOracleDateFormat(System.DateTime.Parse(workServiceMessageEntity.SendTime1.ToString()), "yyyy-mm-dd hh24:mi:ss") : workServiceMessageEntity.SendTime1);
                sqlBuilder.SetValue(WorkServiceMessageTable.FieldSendTime2, workServiceMessageEntity.SendTime2 != null ? BusinessLogic.GetOracleDateFormat(System.DateTime.Parse(workServiceMessageEntity.SendTime2.ToString()), "yyyy-mm-dd hh24:mi:ss") : workServiceMessageEntity.SendTime2);
                sqlBuilder.SetValue(WorkServiceMessageTable.FieldSendTime3, workServiceMessageEntity.SendTime3 != null ? BusinessLogic.GetOracleDateFormat(System.DateTime.Parse(workServiceMessageEntity.SendTime3.ToString()), "yyyy-mm-dd hh24:mi:ss") : workServiceMessageEntity.SendTime3);
            }
            else
            {
                sqlBuilder.SetValue(WorkServiceMessageTable.FieldSendTime1, workServiceMessageEntity.SendTime1);
                sqlBuilder.SetValue(WorkServiceMessageTable.FieldSendTime2, workServiceMessageEntity.SendTime2);
                sqlBuilder.SetValue(WorkServiceMessageTable.FieldSendTime3, workServiceMessageEntity.SendTime3);
            }

            sqlBuilder.SetValue(WorkServiceMessageTable.FieldDoneFlag1, workServiceMessageEntity.DoneFlag1);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldDoneFlag2, workServiceMessageEntity.DoneFlag2);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldDoneFlag3, workServiceMessageEntity.DoneFlag3);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldMsgType, workServiceMessageEntity.MsgType);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldUsers1, workServiceMessageEntity.Users1);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldUsers2, workServiceMessageEntity.Users2);
            sqlBuilder.SetValue(WorkServiceMessageTable.FieldUsers3, workServiceMessageEntity.Users3);
        }
Beispiel #2
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="workServiceMessageEntity">实体</param>
        public int UpdateEntity(WorkServiceMessageEntity workServiceMessageEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, workServiceMessageEntity);
            sqlBuilder.SetWhere(WorkServiceMessageTable.FieldMessageId, workServiceMessageEntity.MessageId);
            return(sqlBuilder.EndUpdate());
        }
        /// <summary>
        /// 增加WorkServiceMessage
        /// </summary>
        /// <param name="entity">WorkServiceMessageEntity实体</param>
        /// <returns>增加成功后的主键</returns>
        public string Insert(WorkServiceMessageEntity entity)
        {
            string returnStr = string.Empty;

            try
            {
                returnStr = this.AddEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnStr);
        }
        /// <summary>
        /// 更新WorkServiceMessage
        /// </summary>
        /// <param name="entity">orkTaskCommandsEntity</param>
        /// <returns>受影响的行数</returns>
        public int UpdateWorkServiceMessage(WorkServiceMessageEntity entity)
        {
            int returnInt = -1;

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

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

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