コード例 #1
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">SQL生成器</param>
 /// <param name="noteEntity">实体对象</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseNoteEntity noteEntity)
 {
     sqlBuilder.SetValue(BaseNoteEntity.FieldTitle, noteEntity.Title);
     sqlBuilder.SetValue(BaseNoteEntity.FieldCategoryId, noteEntity.CategoryId);
     sqlBuilder.SetValue(BaseNoteEntity.FieldCategoryFullName, noteEntity.CategoryFullName);
     sqlBuilder.SetValue(BaseNoteEntity.FieldColor, noteEntity.Color);
     sqlBuilder.SetValue(BaseNoteEntity.FieldContent, noteEntity.Content);
     sqlBuilder.SetValue(BaseNoteEntity.FieldEnabled, noteEntity.Enabled);
     sqlBuilder.SetValue(BaseNoteEntity.FieldImportant, noteEntity.Important);
     SetEntityExpand(sqlBuilder, noteEntity);
 }
コード例 #2
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="noteEntity">实体对象</param>
        /// <returns>影响行数</returns>
        public int UpdateEntity(BaseNoteEntity noteEntity)
        {
            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, noteEntity);
            sqlBuilder.SetValue(BaseNoteEntity.FieldModifiedUserId, UserInfo.Id);
            sqlBuilder.SetDBNow(BaseNoteEntity.FieldModifiedOn);
            sqlBuilder.SetWhere(BaseNoteEntity.FieldId, noteEntity.Id);
            return(sqlBuilder.EndUpdate());
        }
コード例 #3
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        /// <param name="noteEntity">实体对象</param>
        /// <returns>主键</returns>
        public string AddEntity(BaseNoteEntity noteEntity)
        {
            string     id         = Guid.NewGuid().ToString();
            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);

            sqlBuilder.BeginInsert(this.CurrentTableName);
            sqlBuilder.SetValue(BaseNoteEntity.FieldId, id);
            this.SetEntity(sqlBuilder, noteEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseNoteEntity.FieldCreateUserId, UserInfo.Id);
                sqlBuilder.SetDBNow(BaseNoteEntity.FieldCreateOn);
            }
            sqlBuilder.SetDBNow(BaseNoteEntity.FieldModifiedOn);
            return(sqlBuilder.EndInsert() > 0 ? id : string.Empty);
        }
コード例 #4
0
 public string Add(BaseNoteEntity noteEntity)
 {
     return(this.AddEntity(noteEntity));
 }
コード例 #5
0
 partial void SetEntityExpand(SQLBuilder sqlBuilder, BaseNoteEntity noteEntity);
コード例 #6
0
 public int Update(BaseNoteEntity noteEntity)
 {
     return(this.UpdateEntity(noteEntity));
 }
コード例 #7
0
 public string Add(BaseNoteEntity entity)
 {
     return(this.AddObject(entity));
 }
コード例 #8
0
 partial void SetObjectExpand(SQLBuilder sqlBuilder, BaseNoteEntity entity);
コード例 #9
0
 public int Update(BaseNoteEntity entity)
 {
     return(this.UpdateObject(entity));
 }