コード例 #1
0
ファイル: ContentProvider.cs プロジェクト: dkme/moooyo
 /// <summary>
 /// 解析内容数据返回内容公共类集合
 /// </summary>
 /// <param name="bds">基础数据集</param>
 /// <returns>内容公共类集合</returns>
 public static IList<PublicContent> ContentResolve(MongoCursor<BsonDocument> bds)
 {
     IList<PublicContent> objlist = new List<PublicContent>();
     foreach (BsonDocument bd in bds)
     {
         ContentType contentType = (ContentType)Enum.Parse(typeof(ContentType), bd["ContentType"].AsInt32.ToString());
         switch (contentType)
         {
             case ContentType.Interest:
                 InterestContent interest = new InterestContent();
                 interest = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<InterestContent>(bd.ToJson());
                 objlist.Add((PublicContent)interest);
                 break;
             case ContentType.Member:
                 MemberContent member = new MemberContent();
                 member = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<MemberContent>(bd.ToJson());
                 objlist.Add((PublicContent)member);
                 break;
             case ContentType.CallFor:
                 CallForContent callfar = new CallForContent();
                 callfar = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<CallForContent>(bd.ToJson());
                 objlist.Add((PublicContent)callfar);
                 break;
             case ContentType.Image:
                 ImageContent image = new ImageContent();
                 image = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<ImageContent>(bd.ToJson());
                 objlist.Add((PublicContent)image);
                 break;
             case ContentType.InterView:
                 InterViewContent interview = new InterViewContent();
                 interview = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<InterViewContent>(bd.ToJson());
                 objlist.Add((PublicContent)interview);
                 break;
             case ContentType.IWant:
                 IWantContent iwant = new IWantContent();
                 iwant = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<IWantContent>(bd.ToJson());
                 objlist.Add((PublicContent)iwant);
                 break;
             case ContentType.Mood:
                 MoodContent mood = new MoodContent();
                 mood = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<MoodContent>(bd.ToJson());
                 objlist.Add((PublicContent)mood);
                 break;
             case ContentType.SuiSuiNian:
                 SuiSuiNianContent suisuinian = new SuiSuiNianContent();
                 suisuinian = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<SuiSuiNianContent>(bd.ToJson());
                 objlist.Add((PublicContent)suisuinian);
                 break;
         }
     }
     return objlist;
 }
コード例 #2
0
ファイル: ImageContent.cs プロジェクト: dkme/moooyo
 public ImageContent(String contentID)
 {
     try
     {
         ImageContent obj = new ImageContent();
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<ImageContent> mc = md.GetCollection<ImageContent>(ImageContent.GetCollectionName());
         obj = mc.FindOne(Query.EQ("_id", ObjectId.Parse(contentID)));
         this._id = ObjectId.Parse(obj.ID);
         this.MemberID = obj.MemberID;
         this.Creater = obj.Creater;
         this.ContentPermissions = obj.ContentPermissions;
         this.MyFriends = obj.MyFriends;
         this.City = obj.City;
         this.Sex = obj.Sex;
         this.InterestID = obj.InterestID;
         this.ContentType = obj.ContentType;
         this.CreatedTime = obj.CreatedTime;
         this.UpdateTime = obj.UpdateTime;
         this.AnswerCount = obj.AnswerCount;
         this.AnswerList = obj.AnswerList;
         this.LikeCount = obj.LikeCount;
         this.LikeList = obj.LikeList;
         this.DeleteFlag = obj.DeleteFlag;
         this.Content = obj.Content;
         this.ImageList = obj.ImageList;
         this.LayOutType = obj.LayOutType;
         this.Type = obj.Type;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
コード例 #3
0
ファイル: ImageContent.cs プロジェクト: dkme/moooyo
 /// <summary>
 /// 图片内容的添加或更新
 /// </summary>
 /// <param name="obj">图片内容对象</param>
 /// <returns>添加或更新操作是否成功</returns>
 public ImageContent Save(ImageContent obj)
 {
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<ImageContent> mc = md.GetCollection<ImageContent>(PublicContent.GetCollectionName());
         mc.Save(obj);
         //审核关键字
         new Moooyo.BiZ.FilterWord.FilterWordController().FilterText(obj.Content, PublicContent.GetCollectionName(), obj.ID, "Content", obj.MemberID);
         return obj;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }