Пример #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));
 }