Example #1
0
 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <param name="username">用户名</param>
 /// <returns></returns>
 public void GetUser(string username, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSql(DbSql.User_GetUserByUsername), new object[,] { { "@username", username } }),
         func
         );
 }
Example #2
0
 /// <summary>
 /// 读取DataReader中的数据
 /// </summary>
 /// <param name="sql"></param>
 /// <param name="func"></param>
 public void ExecuteReader(SqlQuery sql, DataReaderFunc func)
 {
     sql.Parse(this.GetAdapter());
     using (DbConnection conn = this.createNewConnection())
     {
         DbCommand cmd = this.CreateCommand(sql.Sql);
         cmd.Connection = conn;
         //自动判断是T-SQL还是存储过程
         cmd.CommandType = procedureRegex.IsMatch(sql.Sql) ? CommandType.Text : CommandType.StoredProcedure;
         if (sql.Parameters != null)
         {
             cmd.Parameters.AddRange(sql.Parameters);
         }
         DbDataReader rd = null;
         try
         {
             rd = cmd.ExecuteReader();
             this.callMiddleware("ExecuteReader", sql.Sql, sql.Parameters, null);
         }catch (Exception ex)
         {
             this.callMiddleware("ExecuteReader", sql.Sql, sql.Parameters, ex);
             cmd.Dispose();
             throw ex;
         }
         func(rd);
         cmd.Dispose();
     }
 }
Example #3
0
 public void GetTables(DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.Table_GetTables)),
         func
         );
 }
Example #4
0
 public void GetTables(DataReaderFunc func)
 {
     ExecuteReader(
         NewQuery(DbSql.Table_GetTables, null),
         func
         );
 }
Example #5
0
 public void GetSiteLinkById(int siteId, int linkId,DataReaderFunc func)
 {
     base.ExecuteReader(
       SqlQueryHelper.Format(DbSql.Link_GetSiteLinkById, new object[,]{
             {"@siteId",siteId},
             {"@linkId",linkId}
         }), func);
 }
Example #6
0
 public void ReadLinksOfContent(string typeIndent, int relatedId, DataReaderFunc func)
 {
     base.ExecuteReader(
         SqlQueryHelper.Format(SP.Link_GetRelatedLinks, new object[, ] {
         { "@typeIndent", typeIndent },
         { "@relatedId", relatedId }
     }), func);
 }
Example #7
0
 /// <summary>
 /// 获取所有的友情链接
 /// </summary>
 /// <returns></returns>
 public void GetAllSiteLinks(int siteId, SiteLinkType type, DataReaderFunc func)
 {
     base.ExecuteReader(
         SqlQueryHelper.Format(DbSql.Link_GetSiteLinksByLinkType, new object[, ] {
         { "@siteId", siteId },
         { "@linkType", (int)type }
     }), func);
 }
Example #8
0
 public void ReadLinksOfContent(string contentType, int contentId, DataReaderFunc func)
 {
     base.ExecuteReader(
         SqlQueryHelper.Format(DbSql.Link_GetRelatedLinks, new object[, ] {
         { "@contentType", contentType },
         { "@contentId", contentId }
     }), func);
 }
Example #9
0
 public void GetSiteLinkById(int siteId, int linkId, DataReaderFunc func)
 {
     base.ExecuteReader(
         SqlQueryHelper.Format(DbSql.Link_GetSiteLinkById, new object[, ] {
         { "@siteId", siteId },
         { "@linkId", linkId }
     }), func);
 }
Example #10
0
 /// <summary>
 /// 获取所有的友情链接
 /// </summary>
 /// <returns></returns>
 public void GetAllSiteLinks(int siteId,SiteLinkType type,DataReaderFunc func)
 {
     base.ExecuteReader(
         SqlQueryHelper.Format(DbSql.Link_GetSiteLinksByLinkType,new object[,]{
             {"@siteId",siteId},
             {"@linkType",(int)type}
         }), func);
 }
Example #11
0
 /// <summary>
 /// 读取DataReader中的数据
 /// </summary>
 /// <param name="commandText"></param>
 /// <param name="func"></param>
 public void ExecuteReader(string commandText, DataReaderFunc func)
 {
     if (this._totalOpen)
     {
         this.AddTotalSql(commandText);
     }
     DbParameter[] parameters = null;
     ExecuteReader(commandText, func, parameters);
 }
Example #12
0
 /// <summary>
 /// 获取指定栏目和数量的文档
 /// </summary>
 public void GetArchives(int siteId, string categoryTag, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(String.Format(base.OptimizeSql(DbSql.Archive_GetArchivesByCategoryAlias), number),
                      new object[, ] {
         { "@siteid", siteId },
         { "@tag", categoryTag }
     }), func);
 }
Example #13
0
 /// <summary>
 /// 验证用户并返回
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public void GetMessage(int id, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSql(DbSql.Message_GetMessage),
             new object[,]{{"@id", id}
             }),
         func
         );
 }
Example #14
0
 /// <summary>
 /// 获取指定模块类型的最新文档
 /// </summary>
 public void GetArchivesByModuleId(int siteId, int moduleId, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(String.Format(SP.Archive_GetArchivesByModuleID, number)),
                      new object[, ] {
         { "@siteId", siteId },
         { "@ModuleId", moduleId }
     }), func);
 }
Example #15
0
 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <param name="username">用户名</param>
 /// <returns></returns>
 public void GetUser(string username, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.User_GetUserByUsername), new object[, ] {
         { "@username", username }
     }),
         func
         );
 }
Example #16
0
 public void GetSpecialArchives(int siteId, string categoryTag, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(String.Format(base.OptimizeSQL(SP.Archive_GetSpecialArchivesByCategoryTag), number),
                      new object[, ] {
         { "@siteId", siteId },
         { "@categoryTag", categoryTag }
     }), func);
 }
Example #17
0
 public void GetMemberByUsername(string username, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSql(DbSql.Member_GetMemberByUsername),
                      new object[, ] {
         { "@Username", username }
     }),
         func
         );
 }
Example #18
0
 /// <summary>
 /// 获取指定栏目浏览次数最多的档案
 /// </summary>
 /// <returns></returns>
 public void GetArchivesByViewCount(int siteId, int lft, int rgt, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(String.Format(base.OptimizeSql(DbSql.Archive_GetArchivesByViewCountDesc), number),
                      new object[, ] {
         { "@siteId", siteId },
         { "@lft", lft },
         { "@rgt", rgt }
     }), func);
 }
Example #19
0
 /// <summary>
 /// 获取指定数量和栏目的特殊文档
 /// </summary>
 /// <param name="c"></param>
 /// <param name="rgt"></param>
 /// <param name="number"></param>
 /// <param name="siteId"></param>
 /// <param name="lft"></param>
 /// <param name="func"></param>
 public void GetSpecialArchives(int siteId, int lft, int rgt, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(String.Format(base.OptimizeSQL(SP.Archive_GetSpecialArchivesByCategoryID), number),
                      new object[, ] {
         { "@siteId", siteId },
         { "@lft", lft },
         { "@rgt", rgt }
     }), func);
 }
Example #20
0
 public void GetExtendValues(int siteId, int relationType, int relationID, DataReaderFunc func)
 {
     base.ExecuteReader(new SqlQuery(base.OptimizeSQL(SP.DataExtend_GetExtendValues),
          new object[,]{
              {"@siteId",siteId},
              {"@relationType",relationType},
              {"@relationId",relationID}
          }
         ), func);
 }
Example #21
0
 /// <summary>
 /// 获取相同栏目的下一篇文档
 /// </summary>
 /// <param name="siteId"></param>
 /// <param name="id"></param>
 /// <param name="func"></param>
 public void GetNextSiblingArchive(int siteId, int id, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.Archive_GetNextSameCategoryArchive),
                      new object[, ] {
         { "@siteId", siteId }, { "@id", id }
     }),
         func
         );
 }
Example #22
0
        public void GetArchiveById(int siteId, int archiveId, DataReaderFunc func)
        {
            IDictionary <string, object> data = new Dictionary <string, object>();

            data.Add("@siteId", siteId);
            data.Add("@id", archiveId);
            var query = CreateQuery(DbSql.Archive_GetArchiveById, data);

            ExecuteReader(query, func);
        }
Example #23
0
 public void GetOperation(int id, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.Operation_GetOperation),
                      new object[, ] {
         { "@id", id }
     }),
         func
         );
 }
Example #24
0
        /// <summary>
        /// 获取文章
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public void GetArchiveByPath(int siteId, string path, DataReaderFunc func)
        {
            IDictionary <string, object> data = new Dictionary <string, object>();

            data.Add("@siteId", siteId);
            data.Add("@path", path);
            var query = CreateQuery(DbSql.Archive_GetArchiveByPath, data);

            ExecuteReader(query, func);
        }
Example #25
0
 public void GetMemberByID(int id, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.Member_GetMemberByID),
                      new object[, ] {
         { "@id", id }
     }),
         func
         );
 }
Example #26
0
 public void GetExtendFieldByName(int siteId, string name, string type, DataReaderFunc rd)
 {
     ExecuteReader(
         SqlQueryHelper.Format(DbSql.DataExtend_GetExtendFieldByName, new object[, ]
     {
         { "@siteId", siteId },
         { "@name", name },
         { "@type", type }
     }), rd);
 }
Example #27
0
 public void GetExtendValues(int siteId, int relationType, int relationID, DataReaderFunc func)
 {
     base.ExecuteReader(new SqlQuery(base.OptimizeSQL(SP.DataExtend_GetExtendValues),
                                     new object[, ] {
         { "@siteId", siteId },
         { "@relationType", relationType },
         { "@relationId", relationID }
     }
                                     ), func);
 }
Example #28
0
 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <param name="username">用户名</param>
 /// <param name="password">密码</param>
 /// <returns></returns>
 public void GetUser(string username, string password, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSql(DbSql.User_GetUser),
             new object[,]{
                 {"@UserName", username},
                 {"@password", password}}),
                 func
             );
 }
Example #29
0
 /// <summary>
 /// 验证用户并返回
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public void GetMessage(int id, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSql(DbSql.Message_GetMessage),
                      new object[, ] {
         { "@id", id }
     }),
         func
         );
 }
Example #30
0
 /// <summary>
 /// 获取指定栏目的第一篇特殊文档
 /// </summary>
 /// <param name="categoryId"></param>
 /// <param name="func"></param>
 public void GetFirstSpecialArchive(int categoryId, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.Archive_GetFirstSpecialArchiveByCategoryID),
                      new object[, ] {
         { "@CategoryId", categoryId }
     }),
         func
         );
 }
Example #31
0
        public void GetRow(int rowId, DataReaderFunc func)
        {
            base.ExecuteReader(
                new SqlQuery(base.OptimizeSQL(SP.Table_GetRow),
                             new object[, ] {
                { "@rowid", rowId }
            }),
                func

                );
        }
Example #32
0
        /// <summary>
        /// 获取所有的友情链接
        /// </summary>
        /// <returns></returns>
        public void GetAllSiteLinks(int siteId, SiteLinkType type, DataReaderFunc func)
        {
            var data = new object[, ]
            {
                { "@siteId", siteId },
                { "@linkType", (int)type }
            };
            var query = SqlQueryHelper.Format(DbSql.Link_GetSiteLinksByLinkType, data);

            ExecuteReader(query, func);
        }
Example #33
0
 public void ReadUserRoles(int userId, DataReaderFunc func)
 {
     base.ExecuteReader(
         base.NewQuery(DbSql.UserGetUserRole,
                       base.Db.CreateParametersFromArray(
                           new object[, ] {
         { "@userId", userId }
     })),
         func
         );
 }
Example #34
0
 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <param name="username">用户名</param>
 /// <param name="func"></param>
 /// <returns></returns>
 public void GetUserCredential(string username, DataReaderFunc func)
 {
     base.ExecuteReader(
         base.NewQuery(DbSql.UserGetUserCredentialByUserName,
                       base.Db.CreateParametersFromArray(
                           new object[, ] {
         { "@userName", username }
     })),
         func
         );
 }
Example #35
0
        public void GetColumns(int tableId, DataReaderFunc func)
        {
            base.ExecuteReader(
                new SqlQuery(base.OptimizeSQL(SP.Table_GetColumnsByTableID),
                             new object[, ] {
                { "@tableid", tableId }
            }),
                func

                );
        }
Example #36
0
        public void GetColumn(int columnId, DataReaderFunc func)
        {
            base.ExecuteReader(
                new SqlQuery(base.OptimizeSQL(SP.Table_GetColumn),
                             new object[, ] {
                { "@columnid", columnId }
            }),
                func

                );
        }
Example #37
0
 /// <summary>
 /// 从数据库读取栏目
 /// </summary>
 /// <returns></returns>
 public void GetAllCategories(DataReaderFunc func)
 {
     base.ExecuteReader(new SqlQuery(base.OptimizeSql(DbSql.Category_GetAllCategories)), func);
 }
Example #38
0
 public void GetSpecialArchives(int siteId, string categoryTag, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
            new SqlQuery(String.Format(base.OptimizeSQL(SP.Archive_GetSpecialArchivesByCategoryTag), number),
                 new object[,]{
             {"@siteId",siteId},
             {"@categoryTag", categoryTag}
                  }), func);
 }
Example #39
0
 /// <summary>
 /// 获取指定栏目浏览次数最多的档案
 /// </summary>
 /// <returns></returns>
 public void GetArchivesByViewCount(int siteId, int lft, int rgt, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
        new SqlQuery(String.Format(base.OptimizeSql(DbSql.Archive_GetArchivesByViewCountDesc), number),
         new object[,]{
             {"@siteId", siteId},
             {"@lft", lft},
             {"@rgt", rgt}
          }), func);
 }
Example #40
0
 public void GetArchivesByViewCount(int siteId, string categoryTag, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
       new SqlQuery(String.Format(base.OptimizeSql(DbSql.Archive_GetArchivesByViewCountDesc_Tag), number),
            new object[,]{
         {"@siteId",siteId},
         {"@tag", categoryTag}
         })
        , func);
 }
Example #41
0
 public void GetOperations(DataReaderFunc func)
 {
     base.ExecuteReader(new SqlQuery(base.OptimizeSql(DbSql.Operation_GetOperations), null), func);
 }
Example #42
0
 /// <summary>
 /// 获取指定栏目的第一篇特殊文档
 /// </summary>
 /// <param name="categoryId"></param>
 /// <param name="func"></param>
 public void GetFirstSpecialArchive(int categoryId, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.Archive_GetFirstSpecialArchiveByCategoryID),
              new object[,]{{"@CategoryId", categoryId}
              }),
         func
         );
 }
Example #43
0
 public void GetSelftAndChildArchiveExtendValues(int siteId,int relationType, int lft, int rgt, int number, DataReaderFunc func)
 {
     /*
     base.ExecuteReader(
            new SqlQuery(String.Format(base.OptimizeSQL(SP.Archive_GetSelfAndChildArchives), number),
             new object[,]{
              }), func
        );
     */
     base.ExecuteReader(
         SqlQueryHelper.Format(SP.Archive_GetSelfAndChildArchiveExtendValues,
          new object[,]{
             {"@siteId", siteId},
             {"@lft", lft},
             {"@rgt", rgt},
              {"@relationType",relationType}
          },number.ToString()
         ), func);
 }
Example #44
0
 public void GetBindList(DataReaderFunc func)
 {
     base.ExecuteReader(new SqlQuery(base.OptimizeSQL(SP.TplBind_GetBindList)),
          func);
 }
Example #45
0
 /// <summary>
 /// 获取文章
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public void GetArchive(int siteId, string archiveIdOrAlias, DataReaderFunc func)
 {
     base.ExecuteReader(
            new SqlQuery(base.OptimizeSQL(SP.Archive_GetArchiveByStrIDOrAlias),
                 new object[,]{
                 {"@siteid",siteId},
                 {"@strid", archiveIdOrAlias}
              }),
            func
            );
 }
Example #46
0
 protected void ExecuteReader(SqlQuery sql, DataReaderFunc func)
 {
     this.db.ExecuteReader(sql, func);
    // db.CloseConn();
 }
Example #47
0
 public void GetArchiveById(int siteId, int archiveId, DataReaderFunc func)
 {
     base.ExecuteReader(
            new SqlQuery(base.OptimizeSQL(SP.Archive_GetArchiveById),
                 new object[,]{
                 {"@siteid",siteId},
                 {"@id", archiveId}
              }),
            func
            );
 }
Example #48
0
 /// <summary>
 /// 获取指定数量和栏目的特殊文档
 /// </summary>
 /// <param name="c"></param>
 /// <param name="rgt"></param>
 /// <param name="number"></param>
 /// <param name="siteId"></param>
 /// <param name="lft"></param>
 /// <param name="func"></param>
 public void GetSpecialArchives(int siteId,int lft,int rgt, int number,DataReaderFunc func)
 {
     base.ExecuteReader(
            new SqlQuery(String.Format(base.OptimizeSQL(SP.Archive_GetSpecialArchivesByCategoryID), number),
                 new object[,]{
             {"@siteId", siteId},
             {"@lft", lft},
             {"@rgt", rgt}
                  }), func);
 }
Example #49
0
 public void LoadSites(DataReaderFunc func)
 {
     base.ExecuteReader(new SqlQuery(base.OptimizeSql(base.DbSql.Site_GetSites)), func);
 }
Example #50
0
 internal void ExecuteReader(SqlQuery sql, DataReaderFunc func)
 {
     db.ExecuteReader(sql, func);
    // db.CloseConn();
 }
Example #51
0
 public void GetOperation(int id, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSql(DbSql.Operation_GetOperation),
             new object[,]{
              {"@id", id}
              }),
         func
         );
 }
Example #52
0
        /// <summary>
        /// 搜索关键词相关的内容
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="pageSize"></param>
        /// <param name="currentPageIndex"></param>
        /// <param name="recordCount"></param>
        /// <param name="pageCount"></param>
        /// <param name="orderby"></param>
        /// <returns></returns>
        public void SearchArchives(int siteID,string keyword, int pageSize,int currentPageIndex, out int recordCount, out int pageCount, string orderby,DataReaderFunc func)
        {
            /*
            string condition = ArchiveFlag.GetSQLString(new string[,]{
                    {"st","0"},
                    {"v","1"}
                });
             */

            const string condition = " flags LIKE '%st:''0''%'AND flags LIKE '%v:''1''%' ";

            //排序规则
            if (String.IsNullOrEmpty(orderby)) orderby = String.Intern("ORDER BY Createdate DESC");

            //数据库为OLEDB,且为第一页时
            const string sql1 = @"SELECT TOP $[pagesize] $PREFIX_Archives.[ID] AS ID,* FROM $PREFIX_Archives INNER JOIN $PREFIX_categories ON $PREFIX_Archives.[CID]=$PREFIX_categories.[ID]
                    WHERE $[condition] AND ([Title] LIKE '%$[keyword]%' OR [Outline] LIKE '%$[keyword]%' OR [Content] LIKE '%$[keyword]%' OR [Tags] LIKE '%$[keyword]%')  $[orderby],$PREFIX_Archives.[ID]";

            
            //记录数
            recordCount = int.Parse(base.ExecuteScalar(
                SqlQueryHelper.Format(SP.Archive_GetSearchRecordCount, keyword, siteID.ToString(), condition)
                ).ToString());

            //页数
            pageCount = recordCount / pageSize;
            if (recordCount % pageSize != 0) pageCount++;

            //对当前页数进行验证
            if (currentPageIndex > pageCount&&currentPageIndex!=1)currentPageIndex= pageCount;
            if (currentPageIndex < 1) currentPageIndex = 1;

            //跳过记录数
            int skipCount = pageSize * (currentPageIndex - 1);

            //如果调过记录为0条,且为OLEDB时候,则用sql1
            string sql =skipCount==0&&base.DbType== DataBaseType.OLEDB?
                        sql1:
                        SP.Archive_GetPagedSearchArchives;

            sql = SQLRegex.Replace(sql, (match) =>
            {
                switch (match.Groups[1].Value)
                {
                    case "condition": return condition;
                    case "siteid": return siteID.ToString();
                    case "pagesize": return pageSize.ToString();
                    case "skipsize": return skipCount.ToString();
                    case "keyword": return keyword;
                    case "orderby": return orderby;
                }
                return null;
            });
             base.ExecuteReader(new SqlQuery(base.OptimizeSQL(sql)),func);
        }
Example #53
0
        /// <summary>
        /// 在指定栏目下搜索关键词相关的内容
        /// </summary>
        /// <param name="categoryRgt"></param>
        /// <param name="keyword"></param>
        /// <param name="pageSize"></param>
        /// <param name="currentPageIndex"></param>
        /// <param name="recordCount"></param>
        /// <param name="pageCount"></param>
        /// <param name="orderby"></param>
        /// <param name="siteId"></param>
        /// <param name="categoryLft"></param>
        /// <param name="func"></param>
        /// <returns></returns>
        public void SearchArchivesByCategory(int siteId,
            int categoryLft,int categoryRgt, string keyword,
            int pageSize, int currentPageIndex,
            out int recordCount, out int pageCount,
            string orderby,DataReaderFunc func)
        {

            const string condition = " flags LIKE '%st:''0''%'AND flags LIKE '%v:''1''%' ";


            if (String.IsNullOrEmpty(orderby)) orderby = String.Intern("ORDER BY CreateDate DESC");

            object[,] data = new object[,]
            {
                {"@siteId",siteId},
                {"@lft",categoryLft},
                {"@rgt",categoryRgt}
            };

            //为第一页时
            const string sql1 = @"SELECT TOP $[pagesize] $PREFIX_Archives.[ID] AS ID,* 
                                  FROM $PREFIX_Archives INNER JOIN $PREFIX_categories 
                                  ON $PREFIX_Archives.[CgID]=$PREFIX_categories.[ID]
                                  WHERE $[condition] AND $PREFIX_categories.siteid=@siteId AND ($PREFIX_categories.lft>=@lft
                                   AND $PREFIX_categories.rgt<=@rgt) AND ([Title] LIKE 
                                  '%$[keyword]%' OR [Outline] LIKE '%$[keyword]%' 
                                   OR [Content] LIKE '%$[keyword]%' OR [Tags] LIKE '%$[keyword]%')
                                   $[orderby],$PREFIX_Archives.[ID]";

            //记录数
            recordCount = int.Parse(base.ExecuteScalar(
                SqlQueryHelper.Format(SP.Archive_GetSearchRecordCountByCategoryID,
                data,
                keyword,
                condition
                )).ToString());

            //页数
            pageCount = recordCount / pageSize;
            if (recordCount % pageSize != 0) pageCount++;

            //对当前页数进行验证
            if (currentPageIndex > pageCount && currentPageIndex != 1) currentPageIndex = pageCount;
            if (currentPageIndex < 1) currentPageIndex = 1;

            //跳过记录数
            int skipCount = pageSize * (currentPageIndex - 1);


            string sql = skipCount == 0 && base.DbType== DataBaseType.OLEDB ?
                sql1:
                SP.Archive_GetPagedSearchArchivesByCategoryID;

            sql = SQLRegex.Replace(sql, (match) =>
             {
                 switch (match.Groups[1].Value)
                 {
                     case "siteid": return siteId.ToString();
                     case "condition": return condition;
                     case "pagesize": return pageSize.ToString();
                     case "skipsize": return skipCount.ToString();
                     case "keyword": return keyword;
                     case "orderby": return orderby;
                 }
                 return null;
             });


            base.ExecuteReader(SqlQueryHelper.Format(sql,data), func);
        }
Example #54
0
 /// <summary>
 /// 根据用户名获取会员详细信息
 /// </summary>
 /// <param name="username"></param>
 /// <param name="member"></param>
 /// <param name="details"></param>
 public void GetMemberDetailsByUsername(string username,DataReaderFunc func)
 {
     base.ExecuteReader(
           new SqlQuery(base.OptimizeSql(DbSql.Member_GetMemberInfoAndDetails),
               new object[,]{
                 {"@id",-1},
                 {"@Username", username}
               }),
           func
          );
 }
Example #55
0
        /// <summary>
        /// 根据用户ID获取会员详细信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="member"></param>
        /// <param name="details"></param>
        public void GetMemberDetailsByID(int id,DataReaderFunc func)
        {
            base.ExecuteReader(
                  new SqlQuery(base.OptimizeSql(DbSql.Member_GetMemberInfoAndDetails),
                      new object[,]{
                        {"@id", id},
                        {"@Username", String.Empty}
                      }),

                  func
                  );
        }
Example #56
0
 public void GetArchivesExtendValues(int siteId, int relationType, string categoryTag, int number,DataReaderFunc func)
 {
     base.ExecuteReader(
            SqlQueryHelper.Format(SP.Archive_GetArchivesExtendValues,
             new object[,]{
             {"@siteId", siteId},
             {"@tag",categoryTag},
              {"@relationType",relationType}
          }, number.ToString()
            ), func);
 }
Example #57
0
 /// <summary>
 /// 获取下一篇文档
 /// </summary>
 /// <param name="siteId"></param>
 /// <param name="id"></param>
 /// <param name="ingoreSpecial"></param>
 /// <param name="func"></param>
 /// <param name="sameCategory"></param>
 public void GetNextArchive(int siteId, int id, bool sameCategory,bool ingoreSpecial, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSql(DbSql.Archive_GetNextArchive),
             new object[,]
             {
                 {"@siteId", siteId},
                 {"@id", id},
                 {"@sameCategory", sameCategory?1:0},
                 {"@special",ingoreSpecial?1:0},
             }),
         func
         );
 }
Example #58
0
 /// <summary>
 /// 获取指定数量和模块的特殊文章
 /// </summary>
 /// <param name="c"></param>
 /// <param name="siteId"></param>
 /// <param name="moduleId"></param>
 /// <param name="number"></param>
 /// <param name="func"></param>
 public void GetSpecialArchivesByModuleId(int siteId,int moduleId, int number,DataReaderFunc func)
 {
     base.ExecuteReader(
                 new SqlQuery(String.Format(base.OptimizeSQL(SP.Archive_GetSpecialArchivesByModuleID), number),
                  new object[,]{
                     {"@siteId",siteId},
                     {"@ModuleId", moduleId}
                  }), func);
 }
Example #59
0
 /// <summary>
 /// 获取指定模块浏览次数最多的档案
 /// </summary>
 /// <returns></returns>
 public void GetArchivesByViewCountAndModuleId(int siteId, int moduleId, int number, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(String.Format(base.OptimizeSql(DbSql.Archive_GetArchivesByModuleIDAndViewCountDesc), number),
              new object[,]{
                  {"@siteId",siteId},
         {"@ModuleId", moduleId}
              }), func);
 }
Example #60
0
 /// <summary>
 /// 获取相同栏目的下一篇文档
 /// </summary>
 /// <param name="siteId"></param>
 /// <param name="id"></param>
 /// <param name="func"></param>
 public void GetNextSiblingArchive(int siteId,int id, DataReaderFunc func)
 {
     base.ExecuteReader(
         new SqlQuery(base.OptimizeSQL(SP.Archive_GetNextSameCategoryArchive),
              new object[,]{{"@siteId",siteId},{"@id", id}
              }),
         func
         );
 }