コード例 #1
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="entity">实体</param>
        public int UpdateObject(BaseUserAddressEntity entity)
        {
            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetObject(sqlBuilder, entity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseUserAddressEntity.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(BaseUserAddressEntity.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(BaseUserAddressEntity.FieldModifiedOn);
            sqlBuilder.SetWhere(BaseUserAddressEntity.FieldId, entity.Id);
            return(sqlBuilder.EndUpdate());
        }
コード例 #2
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="userAddressEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseUserAddressEntity userAddressEntity)
 {
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldUserId, userAddressEntity.UserId);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldRealName, userAddressEntity.RealName);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldProvinceId, userAddressEntity.ProvinceId);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldProvince, userAddressEntity.Province);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldCityId, userAddressEntity.CityId);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldCity, userAddressEntity.City);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldAreaId, userAddressEntity.AreaId);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldArea, userAddressEntity.Area);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldAddress, userAddressEntity.Address);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldPostCode, userAddressEntity.PostCode);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldPhone, userAddressEntity.Phone);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldFax, userAddressEntity.Fax);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldMobile, userAddressEntity.Mobile);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldEmail, userAddressEntity.Email);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldDeliverCategory, userAddressEntity.DeliverCategory);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldSortCode, userAddressEntity.SortCode);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldDeletionStateCode, userAddressEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldEnabled, userAddressEntity.Enabled);
     sqlBuilder.SetValue(BaseUserAddressEntity.FieldDescription, userAddressEntity.Description);
     SetEntityExpand(sqlBuilder, userAddressEntity);
 }
コード例 #3
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>主键</returns>
 public string Add(BaseUserAddressEntity entity)
 {
     return(this.AddObject(entity));
 }
コード例 #4
0
 partial void SetObjectExpand(SQLBuilder sqlBuilder, BaseUserAddressEntity entity);
コード例 #5
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="entity">实体</param>
        public string AddObject(BaseUserAddressEntity entity)
        {
            string sequence = string.Empty;

            sequence = entity.Id;
            if (entity.SortCode == 0)
            {
                BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                sequence        = sequenceManager.Increment(this.CurrentTableName);
                entity.SortCode = int.Parse(sequence);
            }
            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, BaseUserAddressEntity.FieldId);
            if (entity.Id is string)
            {
                this.Identity = false;
            }
            if (!this.Identity)
            {
                sqlBuilder.SetValue(BaseUserAddressEntity.FieldId, entity.Id);
            }
            else
            {
                if (!this.ReturnId && (DbHelper.CurrentDbType == CurrentDbType.Oracle || DbHelper.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DbHelper.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(BaseUserAddressEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DbHelper.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(BaseUserAddressEntity.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DbHelper.CurrentDbType == CurrentDbType.Oracle || DbHelper.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (string.IsNullOrEmpty(entity.Id))
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                                sequence = sequenceManager.Increment(this.CurrentTableName);
                            }
                            entity.Id = sequence;
                        }
                        sqlBuilder.SetValue(BaseUserAddressEntity.FieldId, entity.Id);
                    }
                }
            }
            this.SetObject(sqlBuilder, entity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseUserAddressEntity.FieldCreateUserId, UserInfo.Id);
                sqlBuilder.SetValue(BaseUserAddressEntity.FieldCreateBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(BaseUserAddressEntity.FieldCreateOn);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseUserAddressEntity.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(BaseUserAddressEntity.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(BaseUserAddressEntity.FieldModifiedOn);
            if (DbHelper.CurrentDbType == CurrentDbType.SqlServer && this.Identity)
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
コード例 #6
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="entity">实体</param>
 public int Update(BaseUserAddressEntity entity)
 {
     return(this.UpdateObject(entity));
 }
コード例 #7
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="entity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主鍵</param>
 /// <returns>主键</returns>
 public string Add(BaseUserAddressEntity entity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddObject(entity));
 }
コード例 #8
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="userAddressEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(BaseUserAddressEntity userAddressEntity)
 {
     return(this.AddEntity(userAddressEntity));
 }
コード例 #9
0
 partial void SetEntityExpand(SQLBuilder sqlBuilder, BaseUserAddressEntity userAddressEntity);
コード例 #10
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="id">主键</param>
        public BaseUserAddressEntity GetEntity(string id)
        {
            BaseUserAddressEntity userAddressEntity = new BaseUserAddressEntity(this.GetDataTable(new KeyValuePair <string, object>(BaseUserAddressEntity.FieldId, id)));

            return(userAddressEntity);
        }
コード例 #11
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="userAddressEntity">实体</param>
 public int Update(BaseUserAddressEntity userAddressEntity)
 {
     return(this.UpdateEntity(userAddressEntity));
 }