本文整理汇总了C#中Tree.SearchByAriticle方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.SearchByAriticle方法的具体用法?C# Tree.SearchByAriticle怎么用?C# Tree.SearchByAriticle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.SearchByAriticle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToKnowledgeModify
public ActionResult ToKnowledgeModify(string ariticleId)
{
using (RRDLEntities db = new RRDLEntities())
{
AriticleService ars = new AriticleService(db);
Ariticle ariticle = ars.FindById(ariticleId);
AriticleViewModel avm = new AriticleViewModel(ariticle);
List<AriticleVisibility> visibilityList = ars.GetAriticleVisibility(ariticle.Id);
avm.Id = ariticle.Id;
string result = JsonConvert.SerializeObject(avm);
ViewBag.Ariticle = result;
UserGroupService ugs = new UserGroupService();
List<UserGroup> list = ugs.FindAll();
List<UserGroupViewModel> ugvlist = new List<UserGroupViewModel>();
UserGroupViewModel ugv;
for (int i = 0; i < list.Count; i++)
{
ugv = new UserGroupViewModel(list[i]);
ugvlist.Add(ugv);
}
string resultlist = JsonConvert.SerializeObject(ugvlist);
ViewBag.OpenString = resultlist;
Tree tree = new Tree();
TreeNode treeNode = tree.SearchByAriticle(ariticle.Id);
List<TreeNode> treelist = tree.GetTreeNodePath(treeNode);
string treeresult = "";
for (int i = treelist.Count - 1; i >= 0; i--)
{
treeresult = treeresult + treelist[i].Title + "TreePathSplit";
}
ViewBag.TreeId = treeNode.ParentId;
ViewBag.TreePath = treeresult;
VisibilityViewModel vvm = new VisibilityViewModel();
List<VisibilityViewModel> vvlist = new List<VisibilityViewModel>();
int count = ugs.FindAll().Count;
if (count == visibilityList.Count)
{
ViewBag.visibilityList = "all";
}
else
{
for (int i = 0; i < visibilityList.Count; i++)
{
vvm = new VisibilityViewModel();
vvm.Id = visibilityList[i].Id;
vvm.UserGroupId = visibilityList[i].UserGroupId;
vvlist.Add(vvm);
}
string vlist = JsonConvert.SerializeObject(vvlist);
ViewBag.visibilityList = vlist;
}
string author = ariticle.User.NickName;
string createTime = ariticle.Createtime.ToString();
ViewBag.author = author;
ViewBag.createTime = createTime;
return View();
}
}
示例2: KnowledgeModify
public string KnowledgeModify(string title, string userId, string invisibility, string tag, string content, string ariticleId, string treeNodeParentId)
{
using (RRDLEntities db = new RRDLEntities())
{
AriticleService ars = new AriticleService(db);
Ariticle ariticle = ars.FindById(ariticleId);
//添加标题
ariticle.Title = title;
//添加内容
//ariticle.UGC = System.Web.HttpUtility.UrlDecode(content);
content = System.Web.HttpUtility.UrlDecode(content);
content = content.Replace("CodeReplacePlus", "+");
ariticle.UGC = content;
//添加标签
string[] tlist = tag.Split(new char[] { ',' });
List<AriticleTag> tagList = new List<AriticleTag>();
for (int i = 0; i < tlist.Length; i++)
{
AriticleTag ariticletag = new AriticleTag();
ariticletag.Title = tlist[i];
ariticletag.AriticleId = ariticleId;
// ariticletag.Article = ariticle;
tagList.Add(ariticletag);
}
AriticleTagRepository tagRepository = new AriticleTagRepository(db);
tagRepository.UpdateAllRelatedAriticleId(ariticle.Id, tagList);
//创建一个新节点
TreeNode treeNode = new TreeNode(Int32.Parse(treeNodeParentId), title);
treeNode.Ariticle = ariticle;
Tree tree = new Tree(db);
tree.AddTreeNode(treeNode);
//删除旧节点
TreeNode oldtreeNode = tree.SearchByAriticle(ariticle.Id);
tree.Drop(oldtreeNode);
//创建不可见分组信息数组
string[] inlist = invisibility.Split(new char[] { ';' });
List<int> invisiblityGroup = new List<int>();
for (int i = 0; i < inlist.Length - 1; i++)
{
invisiblityGroup.Add(Int32.Parse(inlist[i]));
}
ariticle.Approve.ApproveStatus = EnumAriticleApproveStatus.Approved;
ars.UpdateAriticle(ariticle, invisiblityGroup);
db.SaveChanges();
return "success";
}
}
示例3: KnowledgeModify
public string KnowledgeModify(string ariticleJson)
{
using (RRDLEntities db = new RRDLEntities())
{
AriticleJson ariticlejson = (AriticleJson)JsonConvert.DeserializeObject(ariticleJson, typeof(AriticleJson));
AriticleService ars = new AriticleService(db);
Ariticle ariticle = ars.FindById(ariticlejson.Id);
//添加标题
ariticle.Title = ariticlejson.title;
//添加内容
//ariticle.UGC = System.Web.HttpUtility.UrlDecode(ariticlejson.UGC);
ariticlejson.UGC = System.Web.HttpUtility.UrlDecode(ariticlejson.UGC);
ariticlejson.UGC = ariticlejson.UGC.Replace("CodeReplacePlus", "+");
ariticle.UGC = ariticlejson.UGC;
//添加标签
string[] tlist = ariticlejson.tag.Split(new char[] { ',' });
List<AriticleTag> tagList = new List<AriticleTag>();
for (int i = 0; i < tlist.Length; i++)
{
AriticleTag ariticletag = new AriticleTag();
ariticletag.Title = tlist[i];
ariticletag.AriticleId = ariticlejson.Id;
// ariticletag.Article = ariticle;
tagList.Add(ariticletag);
}
AriticleTagRepository tagRepository = new AriticleTagRepository(db);
tagRepository.UpdateAllRelatedAriticleId(ariticle.Id, tagList);
//创建一个新节点
TreeNode treeNode = new TreeNode(Int32.Parse(ariticlejson.treeNodeParentId), ariticlejson.title);
treeNode.Ariticle = ariticle;
Tree tree = new Tree(db);
tree.AddTreeNode(treeNode);
//删除旧节点
TreeNode oldtreeNode = tree.SearchByAriticle(ariticle.Id);
tree.Drop(oldtreeNode);
//创建不可见分组信息数组
string[] inlist = ariticlejson.invisibility.Split(new char[] { ';' });
List<int> invisiblityGroup = new List<int>();
for (int i = 0; i < inlist.Length - 1; i++)
{
invisiblityGroup.Add(Int32.Parse(inlist[i]));
}
//判断是否为管理员或超级管理员修改,审核状态保持已通过审核
UserService us = new UserService();
User user = us.FindById(ariticlejson.UserId);
if (user.AuthorityCategory != EnumUserCategory.Administrator && user.AuthorityCategory != EnumUserCategory.Superman)
{
ariticle.Approve.ApproveStatus = EnumAriticleApproveStatus.UnApproved;
}
else {
ariticle.Approve.ApproveStatus = EnumAriticleApproveStatus.Approved;
}
ars.UpdateAriticle(ariticle, invisiblityGroup);
db.SaveChanges();
return "success";
}
}
示例4: GetAriticleById
public ActionResult GetAriticleById(string ariticleId)
{
using (RRDLEntities db = new RRDLEntities())
{
AriticleService ars = new AriticleService(db);
Ariticle ariticle = ars.FindById(ariticleId);
AriticleViewModel avm = new AriticleViewModel(ariticle);
avm.Title = ariticle.Title;
avm.UGC = ariticle.UGC;
avm.author = ariticle.User.NickName;
avm.Createtime = ariticle.Createtime.ToString();
Tree tree = new Tree();
TreeNode treeNode = tree.SearchByAriticle(ariticle.Id);
List<TreeNode> list = tree.GetTreeNodePath(treeNode);
string result = "";
for (int i = list.Count - 1; i >= 0; i--)
{
result = result + list[i].Title + "#";
}
string arrayList = "";
List<AriticleVisibility> visibilityList = ars.GetAriticleVisibility(ariticle.Id);
UserGroupService ugs = new UserGroupService();
int count = ugs.FindAll().Count;
if (0 == visibilityList.Count)
{
arrayList = JsonConvert.SerializeObject(avm) + "AriticleAndTreeNode" + result + "AriticleAndTreeNodeall";
}
else {
VisibilityViewModel vvm = new VisibilityViewModel();
List<VisibilityViewModel> vvlist = new List<VisibilityViewModel>();
for (int i = 0; i < visibilityList.Count; i++)
{
vvm = new VisibilityViewModel();
vvm.Id = visibilityList[i].Id;
vvm.UserGroupId = visibilityList[i].UserGroupId;
vvm.userGroupTitle = visibilityList[i].UserGroup.Title;
vvlist.Add(vvm);
}
string vlist = JsonConvert.SerializeObject(vvlist);
arrayList = JsonConvert.SerializeObject(avm) + "AriticleAndTreeNode" + result + "AriticleAndTreeNode" + vlist;
}
return Content(arrayList);
}
}