/// <summary> /// 显示结果 /// </summary> protected void ShowResult() { int result = PressRequest.GetQueryInt("result"); switch (result) { case 5: ShowMessage("未允许的操作!"); break; case 1: ShowMessage("主题复制成功!"); break; case 2: ShowMessage("主题修改成功!"); break; case 3: ShowMessage("主题删除成功!"); break; case 4: ShowMessage("无法复制!"); break; default: break; } }
public ActionResult showvss() { var version = PressRequest.GetQueryInt("v"); VSSDatabase vssDatabase = new VSSDatabaseClass(); var VSSini = GetValue("VSSini"); var VSSuser = GetValue("VSSuser"); var VSSpwd = GetValue("VSSpwd"); var CCMS_PRJ = GetValue("CCMS_PRJ"); var CCMS_Local = GetValue("CCMS_Local"); var ccmsversion = ""; vssDatabase.Open(@VSSini, VSSuser, VSSpwd); VSSItem vssitem = vssDatabase.get_VSSItem(CCMS_PRJ, false); var s = ""; s = string.Format("<br/>\n{0} contains:", vssitem.Spec); foreach (VSSItem vssItem in vssitem.get_Items(false)) { s += string.Format("<br/>--{0}", vssItem.Name); var versions = vssitem.get_Versions(); foreach (VSSVersion v in versions) { s += "<br/>----" + v.Username + "," + v.Date + "," + v.VersionNumber; } } return(Content(s)); }
public ActionResult List() { var model = new PostListModel(); string keyword = StringHelper.SqlEncode(PressRequest.GetQueryString("keyword")); int categoryId = PressRequest.GetQueryInt("categoryid", -1); int userId = PressRequest.GetQueryInt("userid", -1); int hide = PressRequest.GetQueryInt("hide", -1); var catelist = _categoryService.GetCategoryList(); const int pageSize = 10; int count = 0; int pageIndex = PressRequest.GetInt("page", 1); int cateid = PressRequest.GetQueryInt("cateid", -1); int tagid = PressRequest.GetQueryInt("tagid", -1); catelist.Add(new CategoryInfo() { CateName = "全部", CategoryId = -1 }); model.CateSelectItem = catelist.ConvertAll(c => new SelectListItem { Text = c.CateName, Value = c.CategoryId.ToString(), Selected = c.CategoryId == cateid }); if (cateid > 0) { pageIndex = pageIndex + 1; } var postlist = _postService.GetPostPageList(pageSize, pageIndex, out count, categoryId.ToString(), tagid, -1, -1, -1, -1, -1, "", "", keyword); model.PageList.LoadPagedList(postlist); model.PostList = (List <PostInfo>)postlist; return(View(model)); }
public ActionResult Category(string pagename) { var model = new PostListModel(); CategoryInfo cate = _categoryService.GetCategory(pagename); model.Category = cate; if (cate != null) { int categoryId = cate.CategoryId; model.MetaKeywords = cate.CateName; model.MetaDescription = cate.Description; ViewBag.Title = cate.CateName; model.Url = ConfigHelper.SiteUrl + "category/" + Jqpress.Framework.Utils.StringHelper.SqlEncode(pagename) + "/page/{0}"; const int pageSize = 10; int count = 0; int pageIndex = PressRequest.GetInt("page", 1); int cateid = PressRequest.GetQueryInt("cateid", -1); int tagid = PressRequest.GetQueryInt("tagid", -1); if (cateid > 0) { pageIndex = pageIndex + 1; } var cateids = categoryId + "," + _categoryService.GetCategoryList().FindAll(c => c.ParentId == categoryId).Aggregate(string.Empty, (current, t) => current + (t.CategoryId + ",")).TrimEnd(','); var postlist = _postService.GetPostPageList(pageSize, pageIndex, out count, cateids.TrimEnd(','), tagid, -1, -1, -1, -1, -1, "", "", ""); model.PageList.LoadPagedList(postlist); model.PostList = (List <PostInfo>)postlist; } model.IsDefault = 0; return(View(model.Category.ViewName, model)); }
/// <summary> /// 显示结果 /// </summary> protected void ShowResult() { int result = PressRequest.GetQueryInt("result"); switch (result) { case 2: ShowMessage("保存成功!"); break; default: break; } }
//TODO:获取评论的文章地址需要优化 public ActionResult List() { var model = new CommentModel(); const int pageSize = 10; int count = 0; int pageIndex = PressRequest.GetInt("page", 1); int approved = PressRequest.GetQueryInt("approved", -1); var list = _commentService.GetCommentListPage(pageSize, pageIndex, out count, 1, -1, -1, -1, approved, -1, string.Empty); model.PageList.LoadPagedList(list); model.CommentList = (List <CommentInfo>)list; return(View(model)); }
public ActionResult List() { var model = new CateListModel(); int cateid = PressRequest.GetQueryInt("cateid", -1); var catelist = _categoryService.GetCategoryTreeList(); catelist.Remove(catelist.Find(c => c.CategoryId == 0)); model.CateList = catelist; model.CateSelectItem = catelist.ConvertAll(c => new SelectListItem { Text = c.TreeChar + c.CateName, Value = c.CategoryId.ToString(), Selected = c.CategoryId == cateid }); return(View(model)); }
/// <summary> /// delete article /// </summary> /// <returns></returns> public ActionResult Delete() { int postId = PressRequest.GetQueryInt("id"); PostInfo post = _postService.GetPost(postId); if (post == null) { return(RedirectToAction("list")); } if (CurrentUser.Role != (int)UserRole.Administrator && CurrentUser.UserId != post.UserId) { return(RedirectToAction("list")); } _postService.DeletePost(postId); return(RedirectToAction("list")); }
/// <summary> /// 显示结果 /// </summary> protected void ShowResult() { int result = PressRequest.GetQueryInt("result"); switch (result) { case 3: ShowMessage("删除成功!"); break; case 444: ShowMessage("权限不够!"); break; default: break; } }
/// <summary> /// 文件浏览 /// </summary> /// <returns></returns> public ActionResult FileList() { int pageIndex = PressRequest.GetQueryInt("page", 1); int pageSize = 50; if (string.IsNullOrEmpty(urlpath)) { urlpath = rootpath; } var list = GetFilesList(urlpath); var model = new FilesModel(); model.FoldList = list.FoldList.Select(fold => new FoldInfo { FoldName = fold.FoldName, FoldPath = fold.FoldPath, FileSystemInfosLength = fold.FileSystemInfosLength }).ToList(); model.FileList = list.FileList.Select(f => new FileInfo { FileName = f.FileName, Extension = f.Extension, FileLength = f.FileLength, FilePath = f.FilePath, FileUrl = f.FileUrl }).ToList(); if (model.FileList.Count == 0) { IPagedList <FoldInfo> foldlist = new PagedList <FoldInfo>(model.FoldList, pageIndex - 1, pageSize); model.FoldPageList.LoadPagedList <FoldInfo>(foldlist); model.FoldList = (List <FoldInfo>)foldlist; } string controller = RouteData.Values["controller"].ToString(); string aera = "Admin"; model.CurrentAction = "/" + aera + "/" + controller + "/" + "list"; model.UserDirectory = new DirectoryInfo(Server.MapPath(urlpath)); ViewBag.path = urlpath; ViewBag.UrlPath = System.IO.Path.GetFileName(Request.Url.AbsolutePath); model.PathUrl = GetPathUrl(); return(View(model)); }
/// <summary> /// 标签 /// </summary> public ActionResult Tag(string pagename) { var model = new PostListModel(); model.SiteName = SiteConfig.GetSetting().SiteName; model.ThemeName = "printV1"; model.PageTitle = SiteConfig.GetSetting().SiteName; model.SiteUrl = ConfigHelper.SiteUrl; model.MetaKeywords = SiteConfig.GetSetting().MetaKeywords; model.MetaDescription = SiteConfig.GetSetting().MetaDescription; model.SiteDescription = SiteConfig.GetSetting().SiteDescription; model.NavLinks = _linkService.GetLinkList((int)LinkPosition.Navigation, 1); model.RecentTags = _tagService.GetTagList(SiteConfig.GetSetting().SidebarTagCount); model.FooterHtml = SiteConfig.GetSetting().FooterHtml; model.GeneralLinks = _linkService.GetLinkList((int)LinkPosition.General, 1); TagInfo tag = _tagService.GetTagByPageName(pagename); if (tag != null) { int tagId = tag.TagId; model.MetaKeywords = tag.CateName; model.MetaDescription = tag.Description; model.PageTitle = tag.CateName; model.PostMessage = string.Format("<h2 class=\"post-message\">标签:{0}</h2>", tag.CateName); model.Url = ConfigHelper.SiteUrl + "tag/" + Jqpress.Framework.Utils.StringHelper.SqlEncode(pagename) + "/page/{0}"; const int pageSize = 10; int count = 0; int pageIndex = PressRequest.GetInt("page", 1); int cateid = PressRequest.GetQueryInt("cateid", -1); int tagid = PressRequest.GetQueryInt("tagid", -1); if (cateid > 0) { pageIndex = pageIndex + 1; } var postlist = _postService.GetPostPageList(pageSize, pageIndex, out count, cateid.ToString(), tagId, -1, -1, -1, -1, -1, "", "", ""); model.PageList.LoadPagedList(postlist); model.PostList = (List <PostInfo>)postlist; } model.IsDefault = 0; return(View("List", model)); }
/// <summary> /// 显示结果 /// </summary> protected void ShowResult() { int result = PressRequest.GetQueryInt("result"); switch (result) { case 3: ShowMessage("备份删除成功!"); break; case 4: ShowMessage("还原成功!"); break; case 5: ShowMessage("数据库压缩成功!"); break; default: break; } }
/// <summary> /// 显示结果 /// </summary> protected void ShowResult() { int result = PressRequest.GetQueryInt("result"); switch (result) { case 11: ShowMessage("统计分类文章数完成!"); break; case 12: ShowMessage("统计标签文章数完成!"); break; case 13: ShowMessage("统计作者文章和评论数完成!"); break; default: break; } }
/// <summary> /// 绑定 /// </summary> protected void BindPostList() { string keyword = StringHelper.SqlEncode(PressRequest.GetQueryString("keyword")); int categoryId = PressRequest.GetQueryInt("categoryid", -1); int userId = PressRequest.GetQueryInt("userid", -1); int recommend = PressRequest.GetQueryInt("recommend", -1); int hide = PressRequest.GetQueryInt("hide", -1); // txtKeyword.Text = keyword; 暂时注释 ddlCategory.SelectedValue = categoryId.ToString(); //ddlAuthor.SelectedValue = userId.ToString(); // chkRecommend.Checked = recommend == 1 ? true : false; 暂时注释 //chkHideStatus.Checked = hide == 1 ? true : false; 暂时注释 int totalRecord = 0; List <PostInfo> list = PostService.GetPostList(Pager1.PageSize, Pager1.PageIndex, out totalRecord, categoryId, -1, userId, recommend, -1, -1, hide, string.Empty, string.Empty, keyword); rptPost.DataSource = list; rptPost.DataBind(); Pager1.RecordCount = totalRecord; }
/// <summary> /// 审核,删除单条记录 /// </summary> private void OperateComment() { int commentId = PressRequest.GetQueryInt("commentid", 0); if (Operate == OperateType.Delete) { CommentService.DeleteComment(commentId); Response.Redirect("comment_list.aspx?result=3&page=" + Pager1.PageIndex); } else if (Operate == OperateType.Update) { CommentInfo comment = CommentService.GetComment(commentId); if (comment != null) { comment.Approved = (int)ApprovedStatus.Success; CommentService.UpdateComment(comment); Response.Redirect("comment_list.aspx?result=4&page=" + Pager1.PageIndex); } } }
public ActionResult GetCheckListCode() { var version = PressRequest.GetQueryInt("v"); VSSDatabase vssDatabase = new VSSDatabaseClass(); var VSSini = GetValue("VSSini"); var VSSuser = GetValue("VSSuser"); var VSSpwd = GetValue("VSSpwd"); var CCMS_PRJ = GetValue("CCMS_PRJ"); var CCMS_Local = GetValue("CCMS_Local"); var ccmsversion = ""; var ids = PressRequest.GetFormString("ItemId"); bool success = true; try { vssDatabase.Open(@VSSini, VSSuser, VSSpwd); VSSItem vssitem = vssDatabase.get_VSSItem(CCMS_PRJ, false); } catch (COMException ex) { ErrorNotification("VSS连接失败"); success = false; } if (ids != "") { var idarr = ids.TrimEnd(',').Split(','); foreach (var id in idarr) { var checkitem = _checkItemService.GetCheckItem(id); var codelist = TypeConverter.ObjectToString(checkitem.CodeList); if (version == 7) { codelist = codelist.Replace("CCMS_V6", "CCMS_V7"); ccmsversion = "CCMS_V7"; } if (version == 6) { codelist = codelist.Replace("CCMS_V7", "CCMS_V6"); ccmsversion = "CCMS_V6"; } var codefile = codelist.Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "").Replace("新增", "").Replace("修改", ""); string[] files = codefile.Split('\n'); foreach (string file in files) { var vfile = file.Replace("\r", "").Replace(" ", "").Trim(); var localfile = vfile.Replace("/", "\\"); string vssfile = CCMS_PRJ + vfile; string localFile = CCMS_Local + localfile; try { VSSItem vssFolder = vssDatabase.get_VSSItem(vssfile, false); //更新之前先删除文件 if (System.IO.File.Exists(localFile)) { System.IO.FileInfo f = new System.IO.FileInfo(localFile); f.Attributes = FileAttributes.Normal;//解除只读权限 f.Delete(); } vssFolder.Get(localFile, 0);//获取到本地文件夹 #region 自动添加到工程文件 var vbproj = ""; var projectName = ""; if (localfile.EndsWith(".aspx")) { vbproj = "SCH.vbproj"; projectName = CCMS_Local + ccmsversion + @"\web\" + vbproj; } if (localfile.EndsWith(".vb") && localfile.IndexOf(".aspx") < 0) { var t1 = localfile.Substring(ccmsversion.Length, localfile.Length - ccmsversion.Length); var foldname = t1.Substring(1, t1.LastIndexOf(@"\") - 1); vbproj = foldname + ".vbproj"; projectName = CCMS_Local + ccmsversion + @"\" + foldname + @"\" + vbproj; } if (!string.IsNullOrEmpty(projectName)) { Project project = new Project(); project.Load(projectName); var foldname = localfile.Substring(0, localfile.LastIndexOf(@"\")); var include = localfile.Substring(foldname.LastIndexOf(@"\") + 1, localfile.Length - foldname.LastIndexOf(@"\") - 1); var isnew = true; foreach (BuildItemGroup itemGroup in project.ItemGroups) { foreach (BuildItem item in itemGroup) { if ((item.Include.ToLower() == include.ToLower()) || (include.ToLower().LastIndexOf(item.Include.ToLower()) > 0)) { isnew = false; break; } } } if (isnew && localfile.EndsWith(".aspx")) { var includedesigner = include + ".designer.vb"; var includevb = include + ".vb"; var itemGroup = project.AddNewItemGroup(); var buildItem = itemGroup.AddNewItem("Content", include); var buildItemdesigner = itemGroup.AddNewItem("Compile", includedesigner); var filename = include.Substring(include.LastIndexOf(@"\") + 1, include.Length - include.IndexOf(@"\") - 1); buildItemdesigner.SetMetadata("DependentUpon", filename); var buildItemvb = itemGroup.AddNewItem("Compile", includevb); buildItemvb.SetMetadata("DependentUpon", filename); buildItemvb.SetMetadata("SubType", "ASPXCodebehind"); project.Save(projectName); } else if (isnew && localfile.EndsWith(".vb") && vbproj != "SCH.vbproj") //非web工程 { var itemGroup = project.AddNewItemGroup(); var buildItem = itemGroup.AddNewItem("Compile", include.Substring(include.IndexOf(@"\") + 1)); project.Save(projectName); } } #endregion } catch (COMException ex) { ErrorNotification("代码不存在:" + file); success = false; } } checkitem.GetVssCnt += 1;//增加获取次数 _checkItemService.UpdateCheckItem(checkitem, null); } if (success) { SuccessNotification("获取代码成功"); } } else { ErrorNotification("获取代码失败"); } // return Redirect(Url.Action("deploylist", "checkitem")); var url = PressRequest.GetUrlReferrer(); return(Redirect(url)); }