Example #1
0
        private static void NewFolderAndConfigurationNoParentFolderID(long loginUID, ref long folderID, ref BizUserConfiguration folderConfiguration)
        {
            BizUserWebFolder newFolder = new BizUserWebFolder();

            newFolder.UserInfoID        = loginUID;
            newFolder.WebFolderName     = "默认书签夹";
            newFolder.ParentWebfolderID = 0;
            newFolder.CreateTime        = DateTime.Now;
            newFolder.IElementJSON      = "";
            newFolder.IntroContent      = "默认书签夹";
            newFolder.Grade             = 0;
            newFolder.Save();

            folderID = newFolder.UserWebFolderID;

            folderConfiguration = new BizUserConfiguration();
            folderConfiguration.UserConfigurationKey   = "UserDefaultFolder";
            folderConfiguration.UserConfigurationNo    = 1;
            folderConfiguration.UserConfigurationValue = newFolder.UserWebFolderID.ToString();
            folderConfiguration.UserInfoID             = loginUID;
            folderConfiguration.Description            = "用户默认书签夹配置信息";
            folderConfiguration.Save();
        }
Example #2
0
        public ActionResult AddBookmark(string name, string href, long folderID, string type, long infoID)
        {
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(type))
            {
                result.ErrorMessage = "名称和类型必须填写呀。";
                result.IsSuccess    = false;
                return(Json(result));
            }
            var loginUid = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            try
            {
                if (type == "bookmark")
                {
                    BizBookmarkInfo bookmark = new BizBookmarkInfo();

                    if (infoID != 0)
                    {
                        bookmark = BizBookmarkInfo.LoadByID(infoID);
                    }


                    bookmark.Href            = href;
                    bookmark.BookmarkName    = name;
                    bookmark.UserWebFolderID = folderID;
                    bookmark.CreateTime      = DateTime.Now;
                    bookmark.Host            = href.GetHost();
                    bookmark.UserInfoID      = loginUid;
                    bookmark.HashCode        = bookmark.GetHashCode();
                    bookmark.Save();
                }
                else
                {
                    BizUserWebFolder folder = new BizUserWebFolder();
                    if (infoID != 0)
                    {
                        folder = BizUserWebFolder.LoadByID(infoID);
                    }

                    folder.UserInfoID        = loginUid;
                    folder.WebFolderName     = name;
                    folder.ParentWebfolderID = folderID;
                    folder.IntroContent      = "";
                    folder.IElementJSON      = "";
                    folder.CreateTime        = DateTime.Now;
                    folder.IElementHashcode  = folder.GetHashCode();
                    folder.Save();
                }



                result.IsSuccess      = true;
                result.SuccessMessage = "保存成功了耶,刷新一下页面就能看到了哦。";
            }catch (Exception ex)
            {
                result.IsSuccess      = false;
                result.SuccessMessage = "保存失败,可能是数据库不开心了吧,重新保存试试。";
                LogHelper.WriteException("AddBookmark Exception", ex, new { Name = name, Href = href, FolderID = folderID });
            }
            return(Json(result));
        }