Exemplo n.º 1
0
        public ActionResult InsertImageContent(string permissions, string interestids, string Content, string imageIDs, string layOutType, string type, string contentid)
        {
            String userID = User.Identity.Name;
            userID = userID == "" ? null : userID;
            if (imageIDs.Split(',').Length > 1 && (layOutType == null || layOutType == ""))
            {
                return Json(new JavaScriptSerializer().Serialize(false));
            }
            if (userID != "" && permissions != "" && type != "")
            {
                //根据图片编号集合创建图片对象集合
                List<BiZ.Content.Image> imageList = new List<BiZ.Content.Image>();
                foreach (String photoid in imageIDs.Split(','))
                {
                    BiZ.Photo.Photo obj = BiZ.Photo.PhotoManager.GetPhoto(photoid);
                    if (obj != null)
                        imageList.Add(new BiZ.Content.Image(obj.FileName));
                }
                //创建图片内容对象
                BiZ.Content.ImageContent image = null;
                //修改
                if (contentid != null && contentid != "" && contentid != "null")
                {
                    image = new BiZ.Content.ImageContent(contentid);
                    image.ContentPermissions = getContentPerMissions(permissions);
                    image.InterestID = interestids.Split(',').ToList();
                    image.Content = Content;
                    image.ImageList = imageList;
                    image.LayOutType = getImageLayOutType(layOutType);
                    image.Type = type;
                    image.UpdateTime = DateTime.Now;
                }
                //添加
                else
                {
                    image = new BiZ.Content.ImageContent(userID, getContentPerMissions(permissions), interestids.Split(',').ToList(), Content, imageList, getImageLayOutType(layOutType), type);
                }
                //保存图片内容对象
                image = image.Save(image);
                //更新用户在兴趣中的活跃度
                updateInterestHot(interestids, userID);

                //增加用户动态到后台
                BiZ.Sys.MemberActivity.MemberActivityProvider.CreateMemberActivity(
                    userID,
                    "",
                    BiZ.Sys.MemberActivity.MemberActivityType.UploadAvatar,
                    "/Content/ContentDetail/" + image.ID);

                return Json(new JavaScriptSerializer().Serialize(image));
            }
            else
                return Json(new JavaScriptSerializer().Serialize(false));
        }
Exemplo n.º 2
0
 public ActionResult AddTopImagePush(string contentid)
 {
     BiZ.Content.ImageContent imagecontent=new BiZ.Content.ImageContent(contentid);
     BiZ.TopImagePush.ImagePushCount pushcount = new BiZ.TopImagePush.ImagePushCount();
     BiZ.TopImagePush.ImagePush imagepush = new BiZ.TopImagePush.ImagePush(
         contentid,
         imagecontent.MemberID,
         imagecontent.ImageList,
         imagecontent.Content,
         pushcount,
         DateTime.Now,
         BiZ.Comm.DeletedFlag.No);
     imagepush.Save(imagepush);
     return Json(new JavaScriptSerializer().Serialize(true));
 }