Example #1
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">SQL语句生成器</param>
 /// <param name="mainUserControlEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, MainUserControlEntity mainUserControlEntity)
 {
     sqlBuilder.SetValue(MainUserControlTable.FieldFullName, mainUserControlEntity.FullName);
     sqlBuilder.SetValue(MainUserControlTable.FieldDescription, mainUserControlEntity.Description);
     sqlBuilder.SetValue(MainUserControlTable.FieldType, mainUserControlEntity.Type);
     sqlBuilder.SetValue(MainUserControlTable.FieldEnabled, mainUserControlEntity.Enabled);
     sqlBuilder.SetValue(MainUserControlTable.FieldDeleteMark, mainUserControlEntity.DeleteMark);
     sqlBuilder.SetValue(MainUserControlTable.FieldSortCode, mainUserControlEntity.SortCode);
 }
Example #2
0
        /// <summary>
        /// 更新主表单知
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">主表单实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateMainUserCtrl(UserInfo userInfo, MainUserControlEntity entity)
        {
            var returnValue = -1;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowUserControlService_UpdateMainUserCtrl);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new MainUserControlManager(dbProvider, userInfo);
                returnValue = manager.UpdateMainUserCtrl(entity);
            });
            return(returnValue);
        }
Example #3
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="mainUserControlEntity">实体</param>
        public int UpdateEntity(MainUserControlEntity mainUserControlEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, mainUserControlEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(MainUserControlTable.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(MainUserControlTable.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(MainUserControlTable.FieldModifiedOn);
            sqlBuilder.SetWhere(MainUserControlTable.FieldId, mainUserControlEntity.Id);
            return(sqlBuilder.EndUpdate());
        }
        /// <summary>
        /// 修改一个主表单
        /// </summary>
        /// <param name="entity">主表单实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateMainUserCtrl(MainUserControlEntity entity)
        {
            int returnInt = -1;

            if (entity.Id.Trim().Length == 0 || entity.Id == null)
            {
                throw new Exception("UpdateMainUserCtrl方法错误,Id 不能为空!");
            }

            try
            {
                returnInt = this.UpdateEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnInt);
        }
        /// <summary>
        /// 增加主表单
        /// </summary>
        /// <param name="entity">主表单实体</param>
        /// <returns>增加成功返回实体主键</returns>
        public string InsertMainUserCtrl(MainUserControlEntity entity)
        {
            string returnString = string.Empty;

            if (entity.Id.Trim().Length == 0 || entity.Id == null)
            {
                throw new Exception("InsertMainUserCtrl方法错误,Id 不能为空!");
            }

            try
            {
                returnString = this.AddEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(returnString);
        }
Example #6
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="mainUserControlEntity">实体</param>
        public string AddEntity(MainUserControlEntity mainUserControlEntity)
        {
            var sequence = string.Empty;

            this.Identity = false;
            if (mainUserControlEntity.Id != null)
            {
                sequence = mainUserControlEntity.Id.ToString();
            }
            var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, MainUserControlTable.FieldId);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(mainUserControlEntity.Id))
                {
                    sequence = BusinessLogic.NewGuid();
                    mainUserControlEntity.Id = sequence;
                }
                sqlBuilder.SetValue(MainUserControlTable.FieldId, mainUserControlEntity.Id);
            }
            else
            {
                if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(MainUserControlTable.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DBProvider.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(MainUserControlTable.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (string.IsNullOrEmpty(mainUserControlEntity.Id))
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                var sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            mainUserControlEntity.Id = sequence;
                        }
                        sqlBuilder.SetValue(MainUserControlTable.FieldId, mainUserControlEntity.Id);
                    }
                }
            }
            this.SetEntity(sqlBuilder, mainUserControlEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(MainUserControlTable.FieldCreateUserId, UserInfo.Id);
                sqlBuilder.SetValue(MainUserControlTable.FieldCreateBy, UserInfo.RealName);
                sqlBuilder.SetValue(MainUserControlTable.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(MainUserControlTable.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(MainUserControlTable.FieldCreateOn);
            sqlBuilder.SetDBNow(MainUserControlTable.FieldModifiedOn);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
Example #7
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="mainUserControlEntity">实体</param>
 public int Update(MainUserControlEntity mainUserControlEntity)
 {
     return(this.UpdateEntity(mainUserControlEntity));
 }
Example #8
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="mainUserControlEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(MainUserControlEntity mainUserControlEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(mainUserControlEntity));
 }
Example #9
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="mainUserControlEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(MainUserControlEntity mainUserControlEntity)
 {
     return(this.AddEntity(mainUserControlEntity));
 }