三层
来源:互联网 发布:网贷平台源码 编辑:程序博客网 时间:2024/06/10 01:07
web.comfg配置
<configuration> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web> <connectionStrings> <add name="connstr" connectionString="Data Source=FBD-VAIO ;Initial Catalog=sales; Integrated security=true" /> </connectionStrings></configuration>
DAL层
SqlHelper
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Configuration;using System.Data.SqlClient;using System.Data;namespace Itcast.Cn{ public static class SqlHelper { private static readonly string conStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString; //执行增删改的 public static int ExecuteNonQuery(string sql, CommandType cmdType, params SqlParameter[] pms) { using (SqlConnection con = new SqlConnection(conStr)) { using (SqlCommand cmd = new SqlCommand(sql, con)) { cmd.CommandType = cmdType; if (pms != null) { cmd.Parameters.AddRange(pms); } con.Open(); return cmd.ExecuteNonQuery(); } } } //封装一个执行返回单个值的方法 public static object ExecuteScalar(string sql, CommandType cmdType, params SqlParameter[] pms) { using (SqlConnection con = new SqlConnection(conStr)) { using (SqlCommand cmd = new SqlCommand(sql, con)) { cmd.CommandType = cmdType; if (pms != null) { cmd.Parameters.AddRange(pms); } con.Open(); return cmd.ExecuteScalar(); } } } //返回SqlDataReader对象的方法 public static SqlDataReader ExecuteReader(string sql, CommandType cmdType, params SqlParameter[] pms) { SqlConnection con = new SqlConnection(conStr); using (SqlCommand cmd = new SqlCommand(sql, con)) { cmd.CommandType = cmdType; if (pms != null) { cmd.Parameters.AddRange(pms); } try { con.Open(); return cmd.ExecuteReader(CommandBehavior.CloseConnection); } catch (Exception) { con.Close(); con.Dispose(); throw; } } } //封装一个返回DataTable的方法 public static DataTable ExecuteDataTable(string sql, CommandType cmdType, params SqlParameter[] pms) { DataTable dt = new DataTable(); using (SqlDataAdapter adapter = new SqlDataAdapter(sql, conStr)) { adapter.SelectCommand.CommandType = cmdType; if (pms != null) { adapter.SelectCommand.Parameters.AddRange(pms); } adapter.Fill(dt); } return dt; } //封装一个带事务的执行Sql语句的方法 public static void ExecuteNonQueryTran(List<SqlAndParameter> list) { using (SqlConnection con = new SqlConnection(conStr)) { using (SqlCommand cmd = con.CreateCommand()) { con.Open(); using (SqlTransaction trans = con.BeginTransaction()) { cmd.Transaction = trans; try { foreach (var SqlObject in list) { cmd.CommandText = SqlObject.Sql; if (SqlObject.Parameters != null) { cmd.Parameters.AddRange(SqlObject.Parameters); } cmd.CommandType = SqlObject.CmdType; cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); } trans.Commit(); } catch (Exception) { trans.Rollback(); throw; } } } } } } public class SqlAndParameter { public string Sql { get; set; } public SqlParameter[] Parameters { get; set; } public CommandType CmdType { get; set; } }}
增删查改
TblCommentsDal.cs
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Ajax.CRUD.Model;using System.Data.SqlClient;namespace Ajax.CRUD.DAL{ public class TblCommentsDal { public List<TblComments> GetAllComments() { List<TblComments> list = new List<TblComments>(); string sql = "select * from TblComments"; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text)) { if (reader.HasRows) { while (reader.Read()) { TblComments model = new TblComments(); model.AutoId = reader.GetInt32(0); model.Title = reader.GetString(1); model.Content = reader.GetString(2); model.Email = reader.GetString(3); list.Add(model); } } } return list; } public int Add(TblComments tblComment) { string sql = "INSERT INTO TblComments (title, content, email) output inserted.autoId VALUES (@title, @content, @email)"; SqlParameter[] para = new SqlParameter[]{new SqlParameter("@title", ToDBValue(tblComment.Title)),new SqlParameter("@content", ToDBValue(tblComment.Content)),new SqlParameter("@email", ToDBValue(tblComment.Email)),}; return (int)SqlHelper.ExecuteScalar(sql, System.Data.CommandType.Text, para); } public int Delete(int autoId) { string sql = "delete from TblComments where autoId=@autoid"; return SqlHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, new SqlParameter("@autoid", autoId)); } public int Update(TblComments model) { string sql = "update TblComments set title=@title,content=@content,email=@email where autoId=@autoId"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@title",model.Title), new SqlParameter("@content",model.Content), new SqlParameter("@email",model.Email), new SqlParameter("@autoId",model.AutoId) }; return SqlHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, pms); } public object ToDBValue(object value) { if (value == null) { return DBNull.Value; } else { return value; } } }}
UserDal
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;using Ajax.CRUD.Model;namespace Ajax.CRUD.DAL{ public class Aspx_UserDal { public Aspx_User GetUserModelByUidPwd(string uid, string pwd) { Aspx_User model = null; string sql = "select * from Aspx_Users where LoginId=@uid and LoginPwd=@pwd"; SqlParameter[] pms = new SqlParameter[]{ new SqlParameter("@uid",uid), new SqlParameter("@pwd",pwd) }; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text, pms)) { if (reader.HasRows) { if (reader.Read()) { model = new Aspx_User(); model.AutoId = reader.GetInt32(0); model.LoginId = reader.GetString(1); } } } return model; } //检查用户名是否存在 public int CheckUserExists(string loginId) { string sql = "select count(*) from Aspx_Users where LoginId=@uid "; return (int)SqlHelper.ExecuteScalar(sql, System.Data.CommandType.Text, new SqlParameter("@uid", loginId)); } }}
Aspx_TypeDal
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Ajax.CRUD.Model;using System.Data.SqlClient;namespace Ajax.CRUD.DAL{ public class Aspx_TypeDal { public List<Aspx_Type> GetAllTypes() { List<Aspx_Type> list = new List<Aspx_Type>(); string sql = "select * from Aspx_Type"; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text)) { if (reader.HasRows) { while (reader.Read()) { Aspx_Type model = new Aspx_Type(); model.TypeId = reader.GetInt32(0); model.TypeName = reader.GetString(1); list.Add(model); } } } return list; } }}
Aspx_NewsDal.cs
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;using Ajax.CRUD.Model;namespace Ajax.CRUD.DAL{ public class Aspx_NewsDal { public int Add(Aspx_News aspx_New) { string sql = "insert into Aspx_News values(@title,@content,@date,@author,@bigImg,@smallImg,@typeId)"; SqlParameter[] pms = new SqlParameter[]{new SqlParameter("@title", ToDBValue(aspx_New.NewsTitle)),new SqlParameter("@content", ToDBValue(aspx_New.NewsContent)),new SqlParameter("@date", ToDBValue(aspx_New.NewsIssueDate)),new SqlParameter("@author", ToDBValue(aspx_New.NewsAuthor)),new SqlParameter("@bigImg", ToDBValue(aspx_New.NewsImage)),new SqlParameter("@smallImg", ToDBValue(aspx_New.NewsSmallImage)),new SqlParameter("@typeId", ToDBValue(aspx_New.NewsTypeId))}; return SqlHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, pms); } public List<Aspx_News> GetAllNews() { List<Aspx_News> list = new List<Aspx_News>(); string sql = "select * from Aspx_news order by NewsIssueDate desc"; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text)) { if (reader.HasRows) { while (reader.Read()) { //NewsId, NewsTitle, NewsContent, NewsIssueDate, NewsAuthor, NewsImage, NewsSmallImage, NewsTypeId Aspx_News model = new Aspx_News(); model.NewsId = reader.GetInt32(0); model.NewsTitle = reader.GetString(1); model.NewsContent = reader.GetString(2); model.NewsIssueDate = reader.IsDBNull(3) ? null : (DateTime?)reader.GetDateTime(3); model.NewsAuthor = reader.IsDBNull(4) ? null : reader.GetString(4); model.NewsImage = reader.IsDBNull(5) ? null : reader.GetString(5); model.NewsSmallImage = reader.IsDBNull(6) ? null : reader.GetString(6); model.NewsTypeId = reader.GetInt32(7); list.Add(model); } } } return list; } public List<Aspx_News> GetNewsByPage(int pageSize, int pageIndex, out int recordCount, out int pageCount) { List<Aspx_News> list = new List<Aspx_News>(); string sql = "usp_getNewsByPage"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@pageSize",pageSize), new SqlParameter("@pageIndex",pageIndex), new SqlParameter("@recordCount",System.Data.SqlDbType.Int), new SqlParameter("@pagecount",System.Data.SqlDbType.Int) }; pms[2].Direction = System.Data.ParameterDirection.Output; pms[3].Direction = System.Data.ParameterDirection.Output; #region MyRegion //执行读取操作 using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.StoredProcedure, pms)) { if (reader.HasRows) { while (reader.Read()) { // NewsId, //NewsTitle, //NewsIssueDate, //NewsAuthor, //NewsSmallImage, //TypeName Aspx_News model = new Aspx_News(); model.NewsId = reader.GetInt32(0); model.NewsTitle = reader.GetString(1); model.NewsIssueDate = reader.IsDBNull(2) ? null : (DateTime?)reader.GetDateTime(2); model.NewsAuthor = reader.IsDBNull(3) ? null : reader.GetString(3); model.NewsSmallImage = reader.IsDBNull(4) ? null : reader.GetString(4); Aspx_Type typeModel = new Aspx_Type(); typeModel.TypeName = reader.IsDBNull(5) ? null : reader.GetString(5); model.Aspx_TypeObject = typeModel; list.Add(model); } } } #endregion recordCount = Convert.ToInt32(pms[2].Value); pageCount = Convert.ToInt32(pms[3].Value); return list; } public int DeleteByNewsId(int newsId) { string sql = "delete from Aspx_News where newsId=@nid"; return SqlHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, new SqlParameter("@nid", newsId)); } public Aspx_News GetNewsModelByNewsId(int id) { Aspx_News model = null; string sql = "select * from Aspx_News where NewsId=@nid"; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text, new SqlParameter("@nid", id))) { if (reader.HasRows) { if (reader.Read()) { model = new Aspx_News(); model.NewsId = reader.GetInt32(0); model.NewsTitle = reader.GetString(1); model.NewsContent = reader.GetString(2); model.NewsIssueDate = reader.IsDBNull(3) ? null : (DateTime?)reader.GetDateTime(3); model.NewsAuthor = reader.IsDBNull(4) ? null : reader.GetString(4); model.NewsImage = reader.IsDBNull(5) ? null : reader.GetString(5); model.NewsSmallImage = reader.IsDBNull(6) ? null : reader.GetString(6); model.NewsTypeId = reader.GetInt32(7); } } } return model; } private object ToDBValue(object value) { if (value == null) { return DBNull.Value; } else { return value; } } }}
Aspx_StudentsDal.cs
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Ajax.CRUD.Model;using System.Data.SqlClient;namespace Ajax.CRUD.DAL{ public class Aspx_StudentsDal { public List<Aspx_Students> GetAllStudents() { List<Aspx_Students> list = new List<Aspx_Students>(); string sql = "select * from Aspx_Students"; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text)) { if (reader.HasRows) { while (reader.Read()) { //stuId, stuName, stuAge, stuGender, stuEmail, stuBirthday Aspx_Students model = new Aspx_Students(); model.StuId = reader.GetInt32(0); model.StuName = reader.GetString(1); model.StuAge = reader.IsDBNull(2) ? null : (int?)reader.GetInt32(2); model.StuGender = reader.GetString(3); model.StuEmail = reader.GetString(4); model.StuBirthday = reader.GetDateTime(5); list.Add(model); } } } return list; } /// <summary> /// 分页获取数据 /// </summary> /// <param name="pagesize"></param> /// <param name="pageindex"></param> /// <param name="recordcount"></param> /// <param name="pagecount"></param> /// <returns></returns> public List<Aspx_Students> GetStudentsByPage(int pagesize, int pageindex, out int recordcount, out int pagecount) { List<Aspx_Students> list = new List<Aspx_Students>(); string sql = "usp_GetSutdentsByPage"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@pagesize",pagesize), new SqlParameter("@pageIndex",pageindex), new SqlParameter("@recordCount",System.Data.SqlDbType.Int), new SqlParameter("@pagecount",System.Data.SqlDbType.Int) }; pms[2].Direction = System.Data.ParameterDirection.Output; pms[3].Direction = System.Data.ParameterDirection.Output; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.StoredProcedure, pms)) { if (reader.HasRows) { while (reader.Read()) { Aspx_Students model = new Aspx_Students(); model.StuId = reader.GetInt32(0); model.StuName = reader.GetString(1); model.StuAge = reader.IsDBNull(2) ? null : (int?)reader.GetInt32(2); model.StuGender = reader.GetString(3); model.StuEmail = reader.GetString(4); model.StuBirthday = reader.GetDateTime(5); list.Add(model); } } } recordcount = Convert.ToInt32(pms[2].Value); pagecount = Convert.ToInt32(pms[3].Value); return list; } public List<Aspx_Students> GetStudentsBetweentAnd(int startNumber, int maxRows) { List<Aspx_Students> list = new List<Aspx_Students>(); string sql = "select * from (select *,rn=row_number() over(order by stuId) from Aspx_Students) as t where t.rn between @sn+1 and @sn+@en+1"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@sn",startNumber), new SqlParameter("@en",maxRows) }; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text, pms)) { if (reader.HasRows) { while (reader.Read()) { Aspx_Students model = new Aspx_Students(); model.StuId = reader.GetInt32(0); model.StuName = reader.GetString(1); model.StuAge = reader.IsDBNull(2) ? null : (int?)reader.GetInt32(2); model.StuGender = reader.GetString(3); model.StuEmail = reader.GetString(4); model.StuBirthday = reader.GetDateTime(5); list.Add(model); } } } return list; } public Aspx_Students GetStudentInfoBySid(int sid) { Aspx_Students model = null; string sql = "select * from Aspx_Students where StuId=@sid"; using (SqlDataReader reader = SqlHelper.ExecuteReader(sql, System.Data.CommandType.Text, new SqlParameter("@sid", sid))) { if (reader.HasRows) { if (reader.Read()) { model = new Aspx_Students(); model.StuId = reader.GetInt32(0); model.StuName = reader.GetString(1); model.StuAge = reader.IsDBNull(2) ? null : (int?)reader.GetInt32(2); model.StuGender = reader.GetString(3); model.StuEmail = reader.GetString(4); model.StuBirthday = reader.GetDateTime(5); } } } return model; } /// <summary> /// 增加一条记录 /// </summary> /// <param name="aspx_Student"></param> /// <returns></returns> public int Add(Aspx_Students aspx_Student) { string sql = "INSERT INTO Aspx_Students (stuName, stuAge, stuGender, stuEmail, stuBirthday) VALUES (@stuName, @stuAge, @stuGender, @stuEmail, @stuBirthday)"; SqlParameter[] para = new SqlParameter[]{new SqlParameter("@stuName", ToDBValue(aspx_Student.StuName)),new SqlParameter("@stuAge", ToDBValue(aspx_Student.StuAge)),new SqlParameter("@stuGender", ToDBValue(aspx_Student.StuGender)),new SqlParameter("@stuEmail", ToDBValue(aspx_Student.StuEmail)),new SqlParameter("@stuBirthday", ToDBValue(aspx_Student.StuBirthday)),}; return SqlHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, para); } //删除一条记录 public int DeleteByStuId(int stuId) { string sql = "DELETE from Aspx_Students WHERE StuId = @StuId"; return SqlHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, new SqlParameter("@stuId", stuId)); } /// <summary> /// 更新一条记录 /// </summary> /// <param name="aspx_Student"></param> /// <returns></returns> public int Update(Aspx_Students aspx_Student) { string sql = "UPDATE Aspx_Students SET stuName = @stuName, StuAge = @StuAge, StuGender = @StuGender, StuEmail = @StuEmail, StuBirthday = @StuBirthday WHERE stuId = @stuId"; SqlParameter[] para = new SqlParameter[]{ new SqlParameter("@stuId", aspx_Student.StuId), new SqlParameter("@StuName", ToDBValue(aspx_Student.StuName)), new SqlParameter("@StuAge", ToDBValue(aspx_Student.StuAge)), new SqlParameter("@StuGender", ToDBValue(aspx_Student.StuGender)), new SqlParameter("@StuEmail", ToDBValue(aspx_Student.StuEmail)), new SqlParameter("@StuBirthday", ToDBValue(aspx_Student.StuBirthday)) }; return SqlHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, para); } //获取表中的总记录条数 public int GetTotalCount() { string sql = "select count(*) from Aspx_Students"; return (int)SqlHelper.ExecuteScalar(sql, System.Data.CommandType.Text); } public object ToDBValue(object value) { if (value == null) { return DBNull.Value; } else { return value; } } }}
Bll层
TblCommentsBll
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Ajax.CRUD.Model;using Ajax.CRUD.DAL;namespace Ajax.CRUD.BLL{ public class TblCommentsBll { private TblCommentsDal dal = new TblCommentsDal(); public List<TblComments> GetAllComments() { return dal.GetAllComments(); } public int Add(TblComments tblComment) { return dal.Add(tblComment); } public int Delete(int autoId) { return dal.Delete(autoId); } public int Update(TblComments model) { return dal.Update(model); } public int Delete(TblComments model) { return dal.Delete(model.AutoId); } }}
Aspx_StudentsBll
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Ajax.CRUD.DAL;using Ajax.CRUD.Model;namespace Ajax.CRUD.BLL{ public class Aspx_StudentsBll { private Aspx_StudentsDal dal = new Aspx_StudentsDal(); public List<Aspx_Students> GetAllStudents() { return dal.GetAllStudents(); } public List<Aspx_Students> GetStudentsByPage(int pagesize, int pageindex, out int recordcount, out int pagecount) { List<Aspx_Students> list = dal.GetStudentsByPage(pagesize, pageindex, out recordcount, out pagecount); return list; } public List<Aspx_Students> GetStudentsBetweentAnd(int startNumber, int maxRows) { return dal.GetStudentsBetweentAnd(startNumber, maxRows); } public int Add(Aspx_Students aspx_Student) { return dal.Add(aspx_Student); } //删除一条记录 public int DeleteByStuId(int stuId) { return dal.DeleteByStuId(stuId); } //删除一条记录 public int DeleteByStuId(Aspx_Students model) { return dal.DeleteByStuId(model.StuId); } public Aspx_Students GetStudentInfoBySid(int sid) { return dal.GetStudentInfoBySid(sid); } public int Update(Aspx_Students aspx_Student) { return dal.Update(aspx_Student); } //获取表中的总记录条数 public int GetTotalCount() { return dal.GetTotalCount(); } }}
工具类层Utility
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Security.Cryptography;namespace Ajax.CRUD.Utility{ public static class CommonHelper { public static string GetMD5FromString(string input) { //1.创建一个md5对象 MD5 md5Obj = MD5.Create(); //1.1把字符串转换为byte[] byte[] buffer = System.Text.Encoding.UTF8.GetBytes(input); //2.通过md5对象计算给定值的md5 byte[] md5Buffer = md5Obj.ComputeHash(buffer); // 把byte[]数组转换为字符串 StringBuilder sb = new StringBuilder(); for (int i = 0; i < md5Buffer.Length; i++) { sb.Append(md5Buffer[i].ToString("x2")); } //3.释放资源 md5Obj.Clear(); return sb.ToString(); } public static string GetSHA512FromString(string input) { //1.创建一个md5对象 SHA512 md5Obj = SHA512.Create(); //1.1把字符串转换为byte[] byte[] buffer = System.Text.Encoding.UTF8.GetBytes(input); //2.通过md5对象计算给定值的md5 byte[] md5Buffer = md5Obj.ComputeHash(buffer); // 把byte[]数组转换为字符串 StringBuilder sb = new StringBuilder(); for (int i = 0; i < md5Buffer.Length; i++) { sb.Append(md5Buffer[i].ToString("x2")); } //3.释放资源 md5Obj.Clear(); return sb.ToString(); } }}
分页类PagerHelper.cs
调用方法:使用: this.Literal1.Text = PagerHelper.strPage(6, 3, 2, id, "WebForm3.aspx?id=")
注意:WebForm3.aspx?id= 这个等号后面什么也不需要些。就这样就可以了。到时候它会自动把页数加上的
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Web.BLL{ public static class PagerHelper { #region 数字分页类 /// <summary> /// /// </summary> /// <param name="intCounts">数据总条数</param> /// <param name="intPageSizes">页大小</param> /// <param name="intPageCounts">总共页数</param> /// <param name="intThisPages">当前页</param> /// <param name="strUrl">要提交到的页面</param> /// 使用: this.Literal1.Text = PagerHelper.strPage(6, 3, 2, id, "WebForm3.aspx?id="); /// <returns></returns> public static string strPage(int intCounts, int intPageSizes, int intPageCounts, int intThisPages, string strUrl) { int intCount = Convert.ToInt32(intCounts); //总记录数 int intPageCount = Convert.ToInt32(intPageCounts); //总共页数 int intPageSize = Convert.ToInt32(intPageSizes); //每页显示 int intPage = 7; //数字显示 int intThisPage = Convert.ToInt32(intThisPages); //当前页数 int intBeginPage = 0; //开始页数 int intCrossPage = 0; //变换页数 int intEndPage = 0; //结束页数 string strPage = null; //返回值 intCrossPage = intPage / 2; strPage = "共 <font color=\"#FF0000\">" + intCount.ToString() + "</font> 条记录 第 <font color=\"#FF0000\">" + intThisPage.ToString() + "/" + intPageCount.ToString() + "</font> 页 每页 <font color=\"#FF0000\">" + intPageSize.ToString() + "</font> 条 "; if (intThisPage > 1) { strPage = strPage + "<a href=\"" + strUrl + "1\">首页</a> "; strPage = strPage + "<a href=\"" + strUrl + Convert.ToString(intThisPage - 1) + "\">上一页</a> "; } if (intPageCount > intPage) { if (intThisPage > intPageCount - intCrossPage) { intBeginPage = intPageCount - intPage + 1; intEndPage = intPageCount; } else { if (intThisPage <= intPage - intCrossPage) { intBeginPage = 1; intEndPage = intPage; } else { intBeginPage = intThisPage - intCrossPage; intEndPage = intThisPage + intCrossPage; } } } else { intBeginPage = 1; intEndPage = intPageCount; } if (intCount > 0) { for (int i = intBeginPage; i <= intEndPage; i++) { if (i == intThisPage) { strPage = strPage + " <font color=\"#FF0000\">" + i.ToString() + "</font> "; } else { strPage = strPage + " <a href=\"" + strUrl + i.ToString() + "\" title=\"第" + i.ToString() + "页\">" + i.ToString() + "</a> "; } } } if (intThisPage < intPageCount) { strPage = strPage + "<a href=\"" + strUrl + Convert.ToString(intThisPage + 1) + "\">下一页</a> "; strPage = strPage + "<a href=\"" + strUrl + intPageCount.ToString() + "\">尾页</a> "; } return strPage; } #endregion }}
0 0
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 三层
- 【三层】磕磕绊绊说三层
- 【三层】三层架构初识
- C语言中结构体与指针的若干问题(在数据结构中的应用)
- hdu 2254(矩阵)
- MAC 如何在MAC系统中保存txt格式文本
- POJ 1719 Shooting Contest 二分匹配
- Hadoop家族
- 三层
- Nginx配置文件nginx.conf中文详解(总结)
- java反射机制
- C++ STL之stack queue 作者csdn账号 liuhmmjj
- iOS-Core-Animation-Advanced-Techniques(四-1)
- C++ STL容器 set使用
- 文章标题
- POJ 1469 解题报告
- 当自己的英雄