Пример #1
0
        /// <summary>
        /// 创建用户动态
        /// </summary>
        /// <param name="activityObj">用户动态对象</param>
        /// <returns>操作状态</returns>
        public static CBB.ExceptionHelper.OperationResult CreateMemberActivity(
            string fromMember,
            string toMember,
            MemberActivityType activityType,
            String operateUrl)
        {
            CBB.ExceptionHelper.OperationResult result = null;
            try
            {
                MemberActivity activityObj = new MemberActivity();
                if (fromMember != "" && fromMember != null && fromMember != "4eb0fde42101b0824e2b018f")
                    activityObj.FromMember = new Creater.Creater(fromMember);
                else
                    activityObj.FromMember = null;
                if (toMember != "" && toMember != null && toMember != "4eb0fde42101b0824e2b018f")
                    activityObj.ToMember = new Creater.Creater(toMember);
                else
                    activityObj.ToMember = null;
                activityObj.CreatedTime = DateTime.Now;
                activityObj.ActivityType = activityType;
                activityObj.OperateUrl = operateUrl;

                result = Add(activityObj);

                return result;
            }
            catch (Exception excep)
            {
                throw new CBB.ExceptionHelper.OperationException(
                   CBB.ExceptionHelper.ErrType.SystemErr,
                   CBB.ExceptionHelper.ErrNo.DBOperationError,
                   excep);
            }
        }
Пример #2
0
 /// <summary>
 /// 添加用户动态
 /// </summary>
 /// <param name="activityObj">用户动态对象</param>
 /// <returns>操作状态</returns>
 public static CBB.ExceptionHelper.OperationResult Add(MemberActivity activityObj)
 {
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<MemberActivity> mc = md.GetCollection<MemberActivity>(MemberActivity.GetCollectionName());
         mc.Insert(activityObj);
         return new CBB.ExceptionHelper.OperationResult(true);
     }
     catch (Exception excep)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            excep);
     }
 }
Пример #3
0
 /// <summary>
 /// 更新用户动态
 /// </summary>
 /// <param name="activityObj">用户动态对象</param>
 /// <returns>用户动态对象</returns>
 public static MemberActivity Save(MemberActivity activityObj)
 {
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<MemberActivity> mc = md.GetCollection<MemberActivity>(MemberActivity.GetCollectionName());
         mc.Save(activityObj);
         return activityObj;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }