public MemberToNew(String MemberID) { try { MemberToNew obj = new MemberToNew(); MongoDatabase md = MongoDBHelper.MongoDB; MongoCollection<MemberToNew> mc = md.GetCollection<MemberToNew>(MemberToNew.GetCollectionName()); obj = mc.FindOne(Query.EQ("_id", ObjectId.Parse(MemberID))); this._id = ObjectId.Parse(obj.ID); this.MemberID = obj.MemberID; this.ToObjectID = obj.ToObjectID; this.Type = obj.Type; this.Creater = obj.Creater; this.CreatedTime = obj.CreatedTime; } catch (System.Exception err) { throw new CBB.ExceptionHelper.OperationException( CBB.ExceptionHelper.ErrType.SystemErr, CBB.ExceptionHelper.ErrNo.DBOperationError, err); } }
/// <summary> /// 更新新用户 /// </summary> /// <param name="memberObj">新用户对象</param> /// <returns></returns> public MemberToNew Save(MemberToNew memberObj) { try { MongoDatabase md = MongoDBHelper.MongoDB; MongoCollection<MemberToNew> mc = md.GetCollection<MemberToNew>(MemberToNew.GetCollectionName()); mc.Save(memberObj); return memberObj; } catch (System.Exception err) { throw new CBB.ExceptionHelper.OperationException( CBB.ExceptionHelper.ErrType.SystemErr, CBB.ExceptionHelper.ErrNo.DBOperationError, err); } }