public ActionResult GetList(SiteResourceQuery query)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     IList<SiteResourceEntity> list = service.GetSiteResourceList(query);
     return Json(new { list });
 }
 public ExecResult Del(SiteResourceQuery query)
 {
     ExecResult execResult = new ExecResult();
     ISiteResourceService service = ServiceContainer.Instance.Container.Resolve<ISiteResourceService>();
     Int64[] ResourceIDs = query.ResourceIDs;
     if (ResourceIDs == null)
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "没有删除任何数据!";
         return execResult;
     }
     string msg = string.Empty;
     bool result = service.BatchDeleteSiteResource(ResourceIDs);
     if (result)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "删除资源文件成功!";
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "删除资源文件失败!";
     }
     return execResult;
 }
 public ActionResult Delete(Int64[] ResourceIDs)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     SiteResourceQuery query = new SiteResourceQuery();
     query.JournalID = CurAuthor.JournalID;
     query.ResourceIDs = ResourceIDs;
     ExecResult result = service.DelSiteResource(query);
     return Json(new { result = result.result, msg = result.msg });
 }
 public ActionResult GetPageList(SiteResourceQuery query)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     query.CurrentPage = Convert.ToInt32(Request.Params["page"]);
     query.PageSize = Convert.ToInt32(Request.Params["pagesize"]);
     Pager<SiteResourceEntity> pager = service.GetSiteResourcePageList(query);
     return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords });
 }
Example #5
0
        /// <summary>
        /// 下载日志
        /// </summary>
        /// <param name="CID"></param>
        /// <returns></returns>
        public ActionResult DownResource(long ID)
        {
            try
            {
                SiteResourceQuery resouceQuery = new SiteResourceQuery();
                resouceQuery.ResourceID = ID;
                resouceQuery.JournalID = JournalID;
                ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
                SiteResourceEntity resouceEntity = service.GetSiteResourceModel(resouceQuery);
                if (TicketTool.IsLogin())
                {
                    if (resouceEntity == null)
                    {
                        return Json(new { flag = "对不起,要下载的文档不存在" });
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(resouceEntity.FilePath))
                        {
                            string downPath = GetUploadPath(resouceEntity.FilePath);
                            if (!System.IO.File.Exists(downPath))
                                return Json(new { flag = "文件不存在!" });
                            string fileName = System.IO.Path.GetFileName(downPath);
                            HttpResponseBase response = this.HttpContext.Response;
                            HttpServerUtilityBase server = this.HttpContext.Server;
                            response.Clear();
                            response.Buffer = true;
                            response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
                            response.ContentType = "application/octet-stream";
                            response.TransmitFile(downPath);
                            Response.Flush();
                            Response.Close();

                            return Json(new { flag = "下载成功!" });
                        }
                        else
                        {
                            return Json(new { flag = "对不起,要下载的文件不存在!" });
                        }
                    }
                }
                else
                {
                    return Json(new { flag = "error", URL = SiteConfig.RootPath + "/" });
                }
            }
            catch (Exception ex)
            {
                WKT.Log.LogProvider.Instance.Error("记录下载资源日志出现异常:" + ex.Message);

                return Json(new { flag = "记录下载日志出现异常:" + ex.Message });
            }
        }
 private SiteResourceEntity GetModel(Int64 ResourceID)
 {
     SiteResourceEntity model = null;
     if (ResourceID > 0)
     {
         SiteResourceQuery query = new SiteResourceQuery();
         query.JournalID = CurAuthor.JournalID;
         query.ResourceID = ResourceID;
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         model = service.GetSiteResourceModel(query);
     }
     if (model == null)
         model = new SiteResourceEntity();
     return model;
 }
 /// <summary>
 /// 删除资源文件
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public ExecResult DelSiteResource(SiteResourceQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, SiteResourceQuery>(GetAPIUrl(APIConstant.SITERESOURCE_DEL), query);
     return result;
 }
 /// <summary>
 /// 获取资源数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteResourceEntity> GetSiteResourceList(SiteResourceQuery query)
 {
     return SiteResourceBusProvider.GetSiteResourceList(query);
 }
 /// <summary>
 /// 获取资源分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<SiteResourceEntity> GetSiteResourcePageList(SiteResourceQuery query)
 {
     string strSql = "SELECT *,ROW_NUMBER() OVER(ORDER BY ResourceID DESC) AS ROW_ID FROM dbo.SiteResource with(nolock)",
            sumStr = "SELECT RecordCount=COUNT(1) FROM dbo.SiteResource with(nolock)";
     string whereSQL = GetSiteResourceFilter(query);
     if (!string.IsNullOrWhiteSpace(whereSQL))
     {
         strSql += " WHERE " + whereSQL;
         sumStr += " WHERE " + whereSQL;
     }
     return db.GetPageList<SiteResourceEntity>(string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex)
         , sumStr
         , query.CurrentPage, query.PageSize
         , (dr, pager) =>
         {
             pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
         }
         , MakeSiteResourceList);
 }
 /// <summary>
 /// 获取条件
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 private string GetSiteResourceFilter(SiteResourceQuery query)
 {
     StringBuilder strFilter = new StringBuilder(" JournalID=" + query.JournalID);
     if (query.ChannelID > 0)
         strFilter.AppendFormat(" and ChannelID={0}", query.ChannelID);
     return strFilter.ToString();
 }
 /// <summary>
 /// 获取资源数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteResourceEntity> GetSiteResourceList(SiteResourceQuery query)
 {
     string strSql = "SELECT * FROM dbo.SiteResource with(nolock)";
     string whereSQL = GetSiteResourceFilter(query);
     if (!string.IsNullOrWhiteSpace(whereSQL))
     {
         strSql += " WHERE " + whereSQL;
     }
     strSql += " order by ResourceID";
     return db.GetList<SiteResourceEntity>(strSql, MakeSiteResourceList);
 }
 /// <summary>
 /// 获取资源实体
 /// </summary>
 /// <param name="ResourceID"></param>
 /// <returns></returns>
 public SiteResourceEntity GetSiteResourceModel(SiteResourceQuery query)
 {
     SiteResourceEntity item = null;
     string strSql = string.Format("SELECT TOP 1 * FROM dbo.SiteResource with(nolock) WHERE ResourceID=@ResourceID AND JournalID=@JournalID");
     DbCommand cmd = db.GetSqlStringCommand(strSql);
     db.AddInParameter(cmd, "@JournalID", DbType.Int64, query.JournalID);
     db.AddInParameter(cmd, "@ResourceID", DbType.Int64, query.ResourceID);
     using (IDataReader dr = db.ExecuteReader(cmd))
     {
         if (dr.Read())
             item = MakeSiteResourceModel(dr);
     }
     return item;
 }
 public SiteResourceEntity GetModel(SiteResourceQuery query)
 {
     ISiteResourceService service = ServiceContainer.Instance.Container.Resolve<ISiteResourceService>();
     SiteResourceEntity model = service.GetSiteResourceModel(query);
     return model;
 }
 /// <summary>
 /// 获取资源文件分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<SiteResourceEntity> GetSiteResourcePageList(SiteResourceQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<SiteResourceEntity> pager = clientHelper.Post<Pager<SiteResourceEntity>, SiteResourceQuery>(GetAPIUrl(APIConstant.SITERESOURCE_GETPAGELIST), query);
     return pager;
 }
 /// <summary>
 /// 获取资源分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<SiteResourceEntity> GetSiteResourcePageList(SiteResourceQuery query)
 {
     return SiteResourceDataAccess.Instance.GetSiteResourcePageList(query);
 }
 public IList<SiteResourceEntity> GetList(SiteResourceQuery query)
 {
     ISiteResourceService service = ServiceContainer.Instance.Container.Resolve<ISiteResourceService>();
     IList<SiteResourceEntity> list = service.GetSiteResourceList(query);
     return list;
 }
Example #17
0
        public ActionResult spjz(long ChannelID, int page = 1)
        {
            ViewBag.ChannelName = "";
            ViewBag.PagerInfo = "";
            SiteModel siteModel = new SiteModel();

            ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
            SiteChannelQuery query = new SiteChannelQuery();
            query.JournalID = JournalID;
            query.ChannelID = ChannelID;
            SiteChannelEntity channelEntity = service.GetSiteChannelModel(query);
            if (channelEntity != null)
            {
                ViewBag.ChannelName = channelEntity.Keywords;
                if (channelEntity.ContentType == (int)EnumContentType.Information)
                {
                    SiteContentQuery contentQuery = new SiteContentQuery();
                    contentQuery.ChannelID = ChannelID;
                    contentQuery.JournalID = JournalID;
                    contentQuery.CurrentPage = page;
                    contentQuery.PageSize = PageSize;
                    Pager<SiteContentEntity> pagerContentEntity = service.GetSiteContentPageList(contentQuery);
                    if (pagerContentEntity != null)
                    {
                        ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerContentEntity.TotalPage, "/spjz/" + ChannelID, 10);
                        foreach (SiteContentEntity item in pagerContentEntity.ItemList)
                        {
                            NewsModel newsItem = new NewsModel();
                            newsItem.Title = item.Title;
                            newsItem.Content = item.Content;
                            newsItem.ChannelID = ChannelID;
                            newsItem.PKID = item.ContentID;
                            newsItem.FJPath = item.FJPath;
                            newsItem.LinkUrl = item.Linkurl;
                            newsItem.PublishDate = item.AddDate;
                            siteModel.ListConentEntity.Add(newsItem);
                        }
                    }
                }
                else if (channelEntity.ContentType == (int)EnumContentType.SiteDescribe)
                {
                    SiteNoticeQuery noticeQuery = new SiteNoticeQuery();
                    noticeQuery.ChannelID = ChannelID;
                    noticeQuery.JournalID = JournalID;
                    noticeQuery.CurrentPage = page;
                    noticeQuery.PageSize = PageSize;
                    Pager<SiteNoticeEntity> pagerNoticeEntity = service.GetSiteNoticePageList(noticeQuery);
                    if (pagerNoticeEntity != null)
                    {
                        ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerNoticeEntity.TotalPage, "/spjz/" + ChannelID, 10);
                        foreach (SiteNoticeEntity item in pagerNoticeEntity.ItemList)
                        {
                            NewsModel newsItem = new NewsModel();
                            newsItem.Title = item.Title;
                            newsItem.Content = item.Content;
                            newsItem.ChannelID = ChannelID;
                            newsItem.PKID = item.NoticeID;
                            newsItem.FJPath = item.FjPath;
                            newsItem.LinkUrl = string.Format("/show/{0}/?itemid={1}", item.ChannelID, item.NoticeID);
                            newsItem.PublishDate = item.AddDate;
                            siteModel.ListConentEntity.Add(newsItem);
                        }
                    }
                }
                else if (channelEntity.ContentType == (int)EnumContentType.Resources)
                {
                    SiteResourceQuery resourceQuery = new SiteResourceQuery();
                    resourceQuery.ChannelID = ChannelID;
                    resourceQuery.JournalID = JournalID;
                    resourceQuery.CurrentPage = page;
                    resourceQuery.PageSize = PageSize;
                    Pager<SiteResourceEntity> pagerResourceEntity = service.GetSiteResourcePageList(resourceQuery);
                    if (pagerResourceEntity != null)
                    {
                        ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerResourceEntity.TotalPage, "/spjz/" + ChannelID, 10);
                        foreach (SiteResourceEntity item in pagerResourceEntity.ItemList)
                        {
                            NewsModel newsItem = new NewsModel();
                            newsItem.Title = item.Name;
                            newsItem.LinkUrl = string.Format("/resource/?id={0}", item.ResourceID);
                            newsItem.PublishDate = item.AddDate;
                            siteModel.ListConentEntity.Add(newsItem);
                        }
                    }

                }
            }
            return View(siteModel);
        }
Example #18
0
 /// <summary>
 /// 显示指定的频道页面
 /// </summary>
 /// <param name="ChannelID"></param>
 /// <param name="NewsID"></param>
 /// <returns></returns>
 public ActionResult resource()
 {
     long ItemID = TypeParse.ToLong(Request.QueryString["id"]);
     SiteResourceEntity contentEntity = new SiteResourceEntity();
     if (ItemID > 0)
     {
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         SiteResourceQuery resourceQuery = new SiteResourceQuery();
         resourceQuery.JournalID = JournalID;
         resourceQuery.ResourceID = ItemID;
         contentEntity = service.GetSiteResourceModel(resourceQuery);
     }
     ViewBag.Title = Utils.ClearHtml(contentEntity.Name);
     return View(contentEntity);
 }
 /// <summary>
 /// 获取资源文件数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteResourceEntity> GetSiteResourceList(SiteResourceQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<SiteResourceEntity> list = clientHelper.Post<IList<SiteResourceEntity>, SiteResourceQuery>(GetAPIUrl(APIConstant.SITERESOURCE_GETLIST), query);
     return list;
 }
 /// <summary>
 /// 获取资源实体
 /// </summary>
 /// <param name="ResourceID"></param>
 /// <returns></returns>
 public SiteResourceEntity GetSiteResourceModel(SiteResourceQuery query)
 {
     return SiteResourceBusProvider.GetSiteResourceModel(query);
 }
 public Pager<SiteResourceEntity> GetPageList(SiteResourceQuery query)
 {
     ISiteResourceService service = ServiceContainer.Instance.Container.Resolve<ISiteResourceService>();
     Pager<SiteResourceEntity> pager = service.GetSiteResourcePageList(query);
     return pager;
 }
 /// <summary>
 /// 获取资源实体
 /// </summary>
 /// <param name="ResourceID"></param>
 /// <returns></returns>
 public SiteResourceEntity GetSiteResourceModel(SiteResourceQuery query)
 {
     return SiteResourceDataAccess.Instance.GetSiteResourceModel(query);
 }
 /// <summary>
 /// 获取资源文件实体
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public SiteResourceEntity GetSiteResourceModel(SiteResourceQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     SiteResourceEntity model = clientHelper.Post<SiteResourceEntity, SiteResourceQuery>(GetAPIUrl(APIConstant.SITERESOURCE_GETMODEL), query);
     return model;
 }