Пример #1
0
        /// <summary>
        /// 添加文件
        /// </summary>
        /// <param name="folderId">文件夹主键</param>
        /// <param name="fileName">文件名</param>
        /// <param name="file">文件</param>
        /// <param name="category">文件分类</param>
        /// <param name="enabled">有效</param>
        /// <param name="statusCode">状态</param>
        /// <returns>主键</returns>
        public string Add(BaseNewsEntity fileEntity, out string statusCode)
        {
            statusCode = string.Empty;
            string returnValue = string.Empty;
            // 检查是否重复
            List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
            parameters.Add(new KeyValuePair<string, object>(BaseNewsEntity.FieldFolderId, fileEntity.FolderId));
            parameters.Add(new KeyValuePair<string, object>(BaseNewsEntity.FieldTitle, fileEntity.Title));
            parameters.Add(new KeyValuePair<string, object>(BaseNewsEntity.FieldDeletionStateCode, 0));

            if (this.Exists(parameters))
            {
                // 名称已重复
                statusCode = StatusCode.ErrorNameExist.ToString();
            }
            else
            {
                returnValue = this.AddEntity(fileEntity);
                // 运行成功
                statusCode = StatusCode.OKAdd.ToString();
            }
            return returnValue;
        }
Пример #2
0
 public string Upload(string folderId, string title, string contents)
 {
     // 检查是否已经存在
     string returnValue = this.GetId(new KeyValuePair<string, object>(BaseNewsEntity.FieldFolderId, folderId), new KeyValuePair<string, object>(BaseNewsEntity.FieldTitle, title));
     if (!String.IsNullOrEmpty(returnValue))
     {
         // 更新数据
         this.UpdateFile(returnValue, title, contents);
     }
     else
     {
         // 添加数据
         BaseNewsEntity fileEntity = new BaseNewsEntity();
         fileEntity.FolderId = folderId;
         fileEntity.Title = title;
         fileEntity.Contents = contents;
         returnValue = this.AddEntity(fileEntity);
     }
     return returnValue;
 }
Пример #3
0
 public int Update(BaseNewsEntity fileEntity, out string statusCode)
 {
     statusCode = string.Empty;
     int returnValue = this.UpdateEntity(fileEntity);
     if (returnValue > 0)
     {
         statusCode = StatusCode.OKUpdate.ToString();
     }
     else
     {
         statusCode = StatusCode.ErrorDeleted.ToString();
     }
     return returnValue;
 }