/// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="issueDownLogQuery">IssueDownLogQuery查询实体对象</param>
 /// <returns>Pager<IssueDownLogEntity></returns>
 public Pager<IssueDownLogEntity> GetIssueDownLogPageList(IssueDownLogQuery issueDownLogQuery)
 {
     return IssueDownLogDataAccess.Instance.GetIssueDownLogPageList(issueDownLogQuery);
 }
        /// <summary>
        /// 获取期刊下载次数
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public Pager<IssueDownLogEntity> GetIssueDownLogPageList(IssueDownLogQuery query)
        {
            //            string tableSql = @"SELECT a.JournalID,a.ContentID,c.CNumber,b.Title,c.AuthorID,d.RealName,d.LoginName,d.Mobile,a.DownLoadCount FROM (
            //                                  SELECT ContentID,JournalID,COUNT(1) as DownLoadCount
            //                                  FROM dbo.IssueDownLog with(nolock)
            //                                  WHERE JournalID={0} GROUP BY ContentID,JournalID
            //                              ) a INNER JOIN dbo.IssueContent b with(nolock) ON a.JournalID=b.JournalID and a.ContentID=b.ContentID
            //                              INNER JOIN dbo.ContributionInfo c with(nolock) ON a.JournalID=b.JournalID and b.CID=c.CID
            //                              INNER JOIN dbo.AuthorInfo d with(nolock) ON a.JournalID=d.JournalID and c.AuthorID=d.AuthorID";
            string tableSql = "select Title,A.Year,A.DownLoadCount,Authors,A.ContentID,A.[Month],B.JournalID from   dbo.IssueContent as B right join (select ContentID,COUNT(ContentID) as DownLoadCount,Year,Month from dbo.IssueDownLog group by ContentID,Year,Month) as A  on A.ContentID=B.ContentID where JournalID={0}";
            tableSql = string.Format(tableSql, query.JournalID);
            query.Title = SecurityUtils.SafeSqlString(query.Title);
            if (!string.IsNullOrWhiteSpace(query.Title))
                // tableSql += string.Format(" and b.Title like '%{0}%'", query.Title);
                tableSql += string.Format(" and  Title like '%{0}%'", query.Title);
            query.RealName = SecurityUtils.SafeSqlString(query.RealName);
            if (!string.IsNullOrWhiteSpace(query.RealName))
                tableSql += string.Format(" and Authors like '%{0}%'", query.RealName);

            if (query.Year != 0)
                tableSql += string.Format(" and Year='{0}'", query.Year);
            if (query.Month != 0)
                tableSql += string.Format(" and Month='{0}'", query.Month);

            string strSql = string.Format(SQL_Page_Select_ROWNumber, tableSql, query.StartIndex, query.EndIndex, " DownLoadCount desc "), sumStr = string.Empty;
            if (!query.IsReport)
                sumStr = string.Format("SELECT RecordCount=COUNT(1) FROM ({0}) t", tableSql);
            return db.GetPageList<IssueDownLogEntity>(strSql
                , sumStr
                , query.CurrentPage, query.PageSize
                , (dr, pager) =>
                {
                    pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
                }
                , (dr) =>
                {
                    List<IssueDownLogEntity> list = new List<IssueDownLogEntity>();
                    IssueDownLogEntity model = null;
                    while (dr.Read())
                    {
                        model = new IssueDownLogEntity();
                        model.JournalID = dr.GetDrValue<Int64>("JournalID");
                        model.ContentID = dr.GetDrValue<Int64>("ContentID");
                        //  model.CNumber = dr.GetDrValue<String>("CNumber");
                        model.Title = dr.GetDrValue<String>("Title");
                        // model.AuthorID = dr.GetDrValue<Int64>("AuthorID");
                        model.RealName = dr.GetDrValue<String>("Authors");
                        // model.LoginName = dr.GetDrValue<String>("LoginName");
                        // model.Mobile = dr.GetDrValue<String>("Mobile");
                        model.DownLoadCount = TypeParse.ToLong(dr["DownLoadCount"]);
                        list.Add(model);
                    }
                    dr.Close();
                    return list;
                });
        }
 public Pager<IssueDownLogEntity> GetIssueDownLogPageList(IssueDownLogQuery query)
 {
     IIssueService service = ServiceContainer.Instance.Container.Resolve<IIssueService>();
     return service.GetIssueDownLogPageList(query);
 }
Exemple #4
0
 /// <summary>
 /// 获取期刊下载明细
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<IssueDownLogEntity> GetIssueDownLogDetailPageList(IssueDownLogQuery query)
 {
     return IssueDataAccess.Instance.GetIssueDownLogDetailPageList(query);
 }
        /// <summary>
        /// 获取期刊下载明细
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public Pager<IssueDownLogEntity> GetIssueDownLogDetailPageList(IssueDownLogQuery query)
        {
            string tableSql = @"SELECT a.JournalID,a.ContentID,a.DownLogID,a.Year,a.Month,a.Daytime,b.Title,a.AuthorID,(case when d.RealName is null then '游客' else d.RealName end) as RealName,(case when d.LoginName is null then '无' else d.LoginName end) as LoginName,(case when d.Mobile is null then '无' else d.Mobile end) as Mobile,a.IP,a.AddDate
                              FROM dbo.IssueDownLog a with(nolock)
                              INNER JOIN dbo.IssueContent b with(nolock) ON a.JournalID=b.JournalID and a.ContentID=b.ContentID
                              LEFT JOIN dbo.AuthorInfo d with(nolock) ON a.JournalID=d.JournalID and a.AuthorID=d.AuthorID
                              WHERE a.JournalID=" + query.JournalID;
            if (query.ContentID != null)
                tableSql += " and a.ContentID=" + query.ContentID.Value;
            query.Title = SecurityUtils.SafeSqlString(query.Title);
            if (!string.IsNullOrWhiteSpace(query.Title))
                tableSql += string.Format(" and b.Title like '%{0}%'", query.Title);
            query.RealName = SecurityUtils.SafeSqlString(query.RealName);

            if (query.Year != 0)
                tableSql += string.Format(" and a.Year='{0}'", query.Year);
            if (query.Month != 0)
                tableSql += string.Format(" and a.Month='{0}'", query.Month);

            if (!string.IsNullOrWhiteSpace(query.RealName))
                tableSql += string.Format(" and d.RealName like '%{0}%'", query.RealName);
            if (!string.IsNullOrWhiteSpace(query.IP))
                tableSql += string.Format(" and a.IP = '{0}'", query.IP);
            string strSql = string.Format(SQL_Page_Select_ROWNumber, tableSql, query.StartIndex, query.EndIndex, " AddDate desc"), sumStr = string.Empty;
            if (!query.IsReport)
                sumStr = string.Format("SELECT RecordCount=COUNT(1) FROM ({0}) t", tableSql);
            return db.GetPageList<IssueDownLogEntity>(strSql
                , sumStr
                , query.CurrentPage, query.PageSize
                , (dr, pager) =>
                {
                    pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
                }
                , (dr) =>
                {
                    List<IssueDownLogEntity> list = new List<IssueDownLogEntity>();
                    IssueDownLogEntity model = null;
                    while (dr.Read())
                    {
                        model = new IssueDownLogEntity();
                        model.DownLogID = dr.GetDrValue<Int64>("DownLogID");
                        model.Year = dr.GetDrValue<Int32>("Year");
                        model.Month = dr.GetDrValue<Int32>("Month");
                        model.JournalID = dr.GetDrValue<Int64>("JournalID");
                        model.ContentID = dr.GetDrValue<Int64>("ContentID");
                        model.Title = dr.GetDrValue<String>("Title");
                        model.AuthorID = dr.GetDrValue<Int64>("AuthorID");
                        model.RealName = dr.GetDrValue<String>("RealName");
                        model.LoginName = dr.GetDrValue<String>("LoginName");
                        model.Mobile = dr.GetDrValue<String>("Mobile");
                        model.IP = dr.GetDrValue<String>("IP");
                        model.AddDate = dr.GetDrValue<DateTime>("AddDate");
                        list.Add(model);
                    }
                    dr.Close();
                    return list;
                });
        }
 public ActionResult GetIssueDownLogPageList(IssueDownLogQuery query)
 {
     IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     query.IsReport = false;
     query.CurrentPage = Convert.ToInt32(Request.Params["page"]);
     query.PageSize = Convert.ToInt32(Request.Params["pagesize"]);
     Pager<IssueDownLogEntity> pager = service.GetIssueDownLogPageList(query);
     return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords });
 }
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="issueDownLogQuery">IssueDownLogQuery查询实体对象</param>
 /// <returns>List<IssueDownLogEntity></returns>
 public List<IssueDownLogEntity> GetIssueDownLogList(IssueDownLogQuery issueDownLogQuery)
 {
     return IssueDownLogBusProvider.GetIssueDownLogList(issueDownLogQuery);
 }
Exemple #8
0
 /// <summary>
 /// 获取期刊下载次数
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<IssueDownLogEntity> GetIssueDownLogPageList(IssueDownLogQuery query)
 {
     return IssueBusProvider.GetIssueDownLogPageList(query);
 }
 /// <summary>
 /// 获取期刊下载次数
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<IssueDownLogEntity> GetIssueDownLogPageList(IssueDownLogQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<IssueDownLogEntity> pager = clientHelper.Post<Pager<IssueDownLogEntity>, IssueDownLogQuery>(GetAPIUrl(APIConstant.ISSUEDOWNLOAD_GETPAGELIST), query);
     return pager;
 }
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string IssueDownLogQueryToSQLWhere(IssueDownLogQuery query)
 {
     return string.Empty;
 }
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string IssueDownLogQueryToSQLOrder(IssueDownLogQuery query)
 {
     return " DownLogID DESC";
 }
 public Pager<IssueDownLogEntity> GetIssueDownLogPageList(IssueDownLogQuery query)
 {
     int recordCount = 0;
     string whereSQL = IssueDownLogQueryToSQLWhere(query);
     string orderBy = IssueDownLogQueryToSQLOrder(query);
     DataSet ds = db.GetPagingData("IssueDownLog", "DownLogID,JournalID,ContentID,AuthorID,Daytime,Year,Month,IP,AddDate", orderBy, whereSQL, query.CurrentPage, query.PageSize, out recordCount);
     Pager<IssueDownLogEntity> pager = new Pager<IssueDownLogEntity>();
     if (ds != null && ds.Tables.Count > 0)
     {
         pager.ItemList = MakeIssueDownLogList(ds.Tables[0]);
     }
     pager.CurrentPage = query.CurrentPage;
     pager.PageSize = query.PageSize;
     pager.TotalRecords = recordCount;
     return pager;
 }
 public List<IssueDownLogEntity> GetIssueDownLogList(IssueDownLogQuery query)
 {
     List<IssueDownLogEntity> list = new List<IssueDownLogEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT DownLogID,JournalID,ContentID,AuthorID,Daytime,Year,Month,IP,AddDate FROM dbo.IssueDownLog WITH(NOLOCK)");
     string whereSQL = IssueDownLogQueryToSQLWhere(query);
     string orderBy = IssueDownLogQueryToSQLOrder(query);
     if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
     if (!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy);
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     using (IDataReader dr = db.ExecuteReader(cmd))
     {
         list = MakeIssueDownLogList(dr);
     }
     return list;
 }
Exemple #14
0
        public ActionResult FileDownload(long ContentID, string fileName)
        {
            #region 登录验证(未使用)
            //HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["WKT_SSO.CN"];
            //if (cookie != null)
            //{

            //}
            #endregion
            if (Utils.GetRealIP() == "60.220.197.252" || Utils.GetRealIP() == "218.26.232.181")
                return Content("检查到您的IP异常,已禁止下载。");

            long AuthorID = 0;
            if (Request.Cookies["WKT_PRELOGINUSERID"] != null)
                AuthorID = Convert.ToInt64(Request.Cookies["WKT_PRELOGINUSERID"].Value);
            IssueContentQuery issueCQuery = new IssueContentQuery();
            issueCQuery.contentID = ContentID;
            issueCQuery.JournalID = JournalID;
            IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
            IssueContentEntity issueEntity = service.GetIssueContentModel(issueCQuery);
            string downPath = GetUploadPath(issueEntity.FilePath);
            if (!System.IO.File.Exists(downPath))
                return Content("文件不存在!");
            fileName += Path.GetExtension(issueEntity.FilePath);
            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.End();
            //Response.Close();

            //根据客户端IP、期刊ID获取下载记录数
            IIssueFacadeService issueService = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
            IssueDownLogQuery issueQuery = new IssueDownLogQuery();
            issueQuery.JournalID = JournalID;
            issueQuery.ContentID = ContentID;
            issueQuery.IP = Utils.GetRealIP();
            issueQuery.IsReport = false;
            issueQuery.CurrentPage = 1;
            issueQuery.PageSize = 25;

            if (issueService.GetIssueDownLogDetailPageList(issueQuery).TotalRecords == 0)
            {
                //更新下载次数
                service.UpdateIssueContentDownloads(issueCQuery);
                # region 记录下载日志

                try
                {
                    IssueDownLogEntity issueLogEntity = new IssueDownLogEntity();
                    issueLogEntity.ContentID = ContentID;
                    issueLogEntity.JournalID = JournalID;
                    issueLogEntity.IP = Utils.GetRealIP();
                    issueLogEntity.Daytime = TypeParse.ToInt(DateTime.Now.ToString("yyyyMMdd"));
                    issueLogEntity.Year = DateTime.Now.Year;
                    issueLogEntity.Month = DateTime.Now.Month;
                    issueLogEntity.AuthorID = AuthorID;
                    service.SaveDownloadLog(issueLogEntity);
                }
                catch
                {
                }

                # endregion
            }
            return Content("文件下载成功");
        }