Example #1
0
 /// <summary>
 /// 添加精选内容
 /// </summary>
 /// <param name="obj">精选内容对象</param>
 /// <returns>操作状态</returns>
 public static CBB.ExceptionHelper.OperationResult Add(FeaturedContent obj)
 {
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<FeaturedContent> mc = md.GetCollection<FeaturedContent>(FeaturedContent.GetCollectionName());
         mc.Insert(obj);
         return new CBB.ExceptionHelper.OperationResult(true);
     }
     catch (Exception excep)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            excep);
     }
 }
Example #2
0
 /// <summary>
 /// 添加一条精选内容
 /// </summary>
 /// <param name="featuredContentId">精选内容编号</param>
 /// <param name="usedFlag">使用标记</param>
 /// <returns>精选内容对象</returns>
 public static CBB.ExceptionHelper.OperationResult AddFeaturedContent(String image, String content, String creator, Comm.UsedFlag usedFlag)
 {
     try
     {
         CBB.ExceptionHelper.OperationResult result = null;
         FeaturedContent featContent = new FeaturedContent(image, content, creator, usedFlag);
         result = Add(featContent);
         return result;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
Example #3
0
 /// <summary>
 /// 更新精选内容
 /// </summary>
 /// <param name="obj">精选内容对象</param>
 /// <returns>精选内容对象</returns>
 public static FeaturedContent Save(FeaturedContent obj)
 {
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<FeaturedContent> mc = md.GetCollection<FeaturedContent>(FeaturedContent.GetCollectionName());
         mc.Save(obj);
         return obj;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }