/// <summary>
 /// 添加评论
 /// </summary>
 /// <param name="categoryCode">分类区分</param>
 /// <param name="objectId">标志区分</param>
 /// <param name="title">标题</param>
 /// <param name="contents">内容</param>
 /// <param name="worked">是否处理过</param>
 /// <param name="priorityId">优先级别</param>
 /// <param name="important">重要性</param>
 /// <param name="ipAddress">IP地址</param>
 /// <returns>评论主键</returns>
 public string Add(string categoryCode, string objectId, string contents, string ipAddress)
 {
     BaseCommentEntity commentEntity = new BaseCommentEntity();
     commentEntity.CreateUserId = UserInfo.Id;
     commentEntity.CategoryCode = categoryCode;
     commentEntity.ObjectId = objectId;
     commentEntity.Contents = contents;
     commentEntity.DeletionStateCode = 0;
     commentEntity.Enabled = 0;
     commentEntity.IPAddress = ipAddress;
     commentEntity.CreateBy = UserInfo.RealName;
     return this.Add(commentEntity, false, false);
 }
partial         void SetEntityExpand(SQLBuilder sqlBuilder, BaseCommentEntity commentEntity);
 /// <summary>
 /// 更新评论
 /// </summary>
 /// <param name="id">主键</param>
 /// <param name="categoryCode">分类区分</param>
 /// <param name="title">标题</param>
 /// <param name="contents">内容</param>
 /// <param name="worked">是否处理过</param>
 /// <param name="priorityID">优先级别</param>
 /// <param name="important">重要性</param>
 /// <returns>影响行数</returns>
 public int Update(string id, string categoryCode, string title, string contents, bool worked, string priorityId, bool important)
 {
     BaseCommentEntity commentEntity = new BaseCommentEntity();
     commentEntity.Id = id;
     commentEntity.ModifiedUserId = UserInfo.Id;
     commentEntity.CategoryCode = categoryCode;
     commentEntity.Title = title;
     commentEntity.Contents = contents;
     // commentEntity.Worked = worked;
     // commentEntity.PriorityId = priorityId;
     // commentEntity.Important = important;
     return this.Update(commentEntity);
 }
 /// <summary>
 /// 更新实体
 /// </summary>
 /// <param name="baseCommentEntity">实体</param>
 public int UpdateEntity(BaseCommentEntity baseCommentEntity)
 {
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginUpdate(this.CurrentTableName);
     this.SetEntity(sqlBuilder, baseCommentEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseCommentEntity.FieldModifiedUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseCommentEntity.FieldModifiedBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseCommentEntity.FieldModifiedOn);
     sqlBuilder.SetWhere(BaseCommentEntity.FieldId, baseCommentEntity.Id);
     return sqlBuilder.EndUpdate();
 }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="commentEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseCommentEntity commentEntity)
 {
     sqlBuilder.SetValue(BaseCommentEntity.FieldDepartmentId, commentEntity.DepartmentId);
     sqlBuilder.SetValue(BaseCommentEntity.FieldDepartmentName, commentEntity.DepartmentName);
     sqlBuilder.SetValue(BaseCommentEntity.FieldParentId, commentEntity.ParentId);
     sqlBuilder.SetValue(BaseCommentEntity.FieldCategoryCode, commentEntity.CategoryCode);
     sqlBuilder.SetValue(BaseCommentEntity.FieldObjectId, commentEntity.ObjectId);
     sqlBuilder.SetValue(BaseCommentEntity.FieldTargetURL, commentEntity.TargetURL);
     sqlBuilder.SetValue(BaseCommentEntity.FieldTitle, commentEntity.Title);
     sqlBuilder.SetValue(BaseCommentEntity.FieldContents, commentEntity.Contents);
     sqlBuilder.SetValue(BaseCommentEntity.FieldIPAddress, commentEntity.IPAddress);
     sqlBuilder.SetValue(BaseCommentEntity.FieldDeletionStateCode, commentEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseCommentEntity.FieldEnabled, commentEntity.Enabled);
     sqlBuilder.SetValue(BaseCommentEntity.FieldDescription, commentEntity.Description);
     sqlBuilder.SetValue(BaseCommentEntity.FieldSortCode, commentEntity.SortCode);
     SetEntityExpand(sqlBuilder, commentEntity);
 }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="baseCommentEntity">实体</param>
 public int Update(BaseCommentEntity baseCommentEntity)
 {
     return this.UpdateEntity(baseCommentEntity);
 }
 /// <summary>
 /// 获取实体
 /// </summary>
 /// <param name="id">主键</param>
 public BaseCommentEntity GetEntity(string id)
 {
     BaseCommentEntity baseCommentEntity = new BaseCommentEntity(this.GetDataTable(new KeyValuePair<string, object>(BaseCommentEntity.FieldId, id)));
     return baseCommentEntity;
 }
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="baseCommentEntity">实体</param>
 public string AddEntity(BaseCommentEntity baseCommentEntity)
 {
     string sequence = string.Empty;
     this.Identity = false;
     if (baseCommentEntity.SortCode == null || baseCommentEntity.SortCode == 0)
     {
         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
         sequence = sequenceManager.GetSequence(this.CurrentTableName);
         baseCommentEntity.SortCode = int.Parse(sequence);
     }
     if (baseCommentEntity.Id != null)
     {
         sequence = baseCommentEntity.Id.ToString();
     }
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper, this.Identity, this.ReturnId);
     sqlBuilder.BeginInsert(this.CurrentTableName, BaseCommentEntity.FieldId);
     if (!this.Identity)
     {
         if (string.IsNullOrEmpty(baseCommentEntity.Id))
         {
             sequence = BaseBusinessLogic.NewGuid();
             baseCommentEntity.Id = sequence ;
         }
         sqlBuilder.SetValue(BaseCommentEntity.FieldId, baseCommentEntity.Id);
     }
     else
     {
         if (!this.ReturnId && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
         {
             if (DbHelper.CurrentDbType == DbTypes.Oracle)
             {
                 sqlBuilder.SetFormula(BaseCommentEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
             }
             if (DbHelper.CurrentDbType == DbTypes.DB2)
             {
                 sqlBuilder.SetFormula(BaseCommentEntity.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
             }
         }
         else
         {
             if (this.Identity && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
             {
                 if (string.IsNullOrEmpty(baseCommentEntity.Id))
                 {
                     if (string.IsNullOrEmpty(sequence))
                     {
                         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                         sequence = sequenceManager.GetSequence(this.CurrentTableName);
                     }
                     baseCommentEntity.Id = sequence;
                 }
                 sqlBuilder.SetValue(BaseCommentEntity.FieldId, baseCommentEntity.Id);
             }
         }
     }
     this.SetEntity(sqlBuilder, baseCommentEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseCommentEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseCommentEntity.FieldCreateBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseCommentEntity.FieldCreateOn);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseCommentEntity.FieldModifiedUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseCommentEntity.FieldModifiedBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseCommentEntity.FieldModifiedOn);
     if (this.Identity && (DbHelper.CurrentDbType == DbTypes.SqlServer || DbHelper.CurrentDbType == DbTypes.Access))
     {
         sequence = sqlBuilder.EndInsert().ToString();
     }
     else
     {
         sqlBuilder.EndInsert();
     }
     return sequence;
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="baseCommentEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(BaseCommentEntity baseCommentEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return this.AddEntity(baseCommentEntity);
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="baseCommentEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(BaseCommentEntity baseCommentEntity)
 {
     return this.AddEntity(baseCommentEntity);
 }