コード例 #1
0
        /// <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));
        }
コード例 #2
0
        /// <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));
        }
コード例 #3
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="entity">实体</param>
        public int UpdateObject(BaseCommentEntity entity)
        {
            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetObject(sqlBuilder, entity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseCommentEntity.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(BaseCommentEntity.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(BaseCommentEntity.FieldModifiedOn);
            sqlBuilder.SetWhere(BaseCommentEntity.FieldId, entity.Id);
            return(sqlBuilder.EndUpdate());
        }
コード例 #4
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="entity">实体</param>
 private void SetObject(SQLBuilder sqlBuilder, BaseCommentEntity entity)
 {
     sqlBuilder.SetValue(BaseCommentEntity.FieldDepartmentId, entity.DepartmentId);
     sqlBuilder.SetValue(BaseCommentEntity.FieldDepartmentName, entity.DepartmentName);
     sqlBuilder.SetValue(BaseCommentEntity.FieldParentId, entity.ParentId);
     sqlBuilder.SetValue(BaseCommentEntity.FieldCategoryCode, entity.CategoryCode);
     sqlBuilder.SetValue(BaseCommentEntity.FieldObjectId, entity.ObjectId);
     sqlBuilder.SetValue(BaseCommentEntity.FieldTargetURL, entity.TargetURL);
     sqlBuilder.SetValue(BaseCommentEntity.FieldTitle, entity.Title);
     sqlBuilder.SetValue(BaseCommentEntity.FieldContents, entity.Contents);
     sqlBuilder.SetValue(BaseCommentEntity.FieldIPAddress, entity.IPAddress);
     sqlBuilder.SetValue(BaseCommentEntity.FieldWorked, entity.Worked);
     sqlBuilder.SetValue(BaseCommentEntity.FieldDeletionStateCode, entity.DeletionStateCode);
     sqlBuilder.SetValue(BaseCommentEntity.FieldEnabled, entity.Enabled);
     sqlBuilder.SetValue(BaseCommentEntity.FieldDescription, entity.Description);
     SetObjectExpand(sqlBuilder, entity);
 }
コード例 #5
0
        /// <summary>
        /// 新增评论
        /// </summary>
        /// <param name="userInfo">登录用户信息</param>
        /// <param name="commentEntity">评论实体</param>
        /// <returns></returns>
        public static BaseResult Add(BaseUserInfo userInfo, BaseCommentEntity commentEntity)
        {
            var webClient  = new WebClient();
            var postValues = new NameValueCollection();

            postValues.Add("system", BaseSystemInfo.SoftFullName);
            postValues.Add("systemCode", BaseSystemInfo.SystemCode);
            postValues.Add("securityKey", BaseSystemInfo.SecurityKey);
            postValues.Add("function", "Add");
            postValues.Add("userInfo", userInfo.Serialize());
            postValues.Add("encrypted", true.ToString());
            postValues.Add("commentEntity", JsonConvert.SerializeObject(commentEntity));
            byte[] responseArray = webClient.UploadValues(Url, postValues);
            string response      = Encoding.UTF8.GetString(responseArray);

            if (!string.IsNullOrEmpty(response))
            {
                return(JsonConvert.DeserializeObject <BaseResult>(response));
            }
            return(null);
        }
コード例 #6
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns>主键</returns>
 public string Add(BaseCommentEntity entity)
 {
     return(this.AddObject(entity));
 }
コード例 #7
0
 partial void SetObjectExpand(SQLBuilder sqlBuilder, BaseCommentEntity entity);
コード例 #8
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="entity">实体</param>
        public string AddObject(BaseCommentEntity entity)
        {
            string sequence = string.Empty;

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

            sqlBuilder.BeginInsert(this.CurrentTableName, BaseCommentEntity.FieldId);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(entity.Id))
                {
                    sequence  = Guid.NewGuid().ToString("N");
                    entity.Id = sequence;
                }
                sqlBuilder.SetValue(BaseCommentEntity.FieldId, entity.Id);
            }
            else
            {
                if (!this.ReturnId && (DbHelper.CurrentDbType == CurrentDbType.Oracle || DbHelper.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DbHelper.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(BaseCommentEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DbHelper.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(BaseCommentEntity.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(BaseCommentEntity.FieldId, entity.Id);
                    }
                }
            }
            this.SetObject(sqlBuilder, entity);
            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 == CurrentDbType.SqlServer || DbHelper.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
コード例 #9
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="entity">实体</param>
 public int Update(BaseCommentEntity entity)
 {
     return(this.UpdateObject(entity));
 }
コード例 #10
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="entity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(BaseCommentEntity entity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddObject(entity));
 }
コード例 #11
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="baseCommentEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(BaseCommentEntity baseCommentEntity)
 {
     return(this.AddEntity(baseCommentEntity));
 }
コード例 #12
0
 partial void SetEntityExpand(SQLBuilder sqlBuilder, BaseCommentEntity commentEntity);
コード例 #13
0
        /// <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);
        }
コード例 #14
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="baseCommentEntity">实体</param>
 public int Update(BaseCommentEntity baseCommentEntity)
 {
     return(this.UpdateEntity(baseCommentEntity));
 }