📄 remote.cs
字号:
using System;
using System.Text;
using System.Collections;
namespace Data.BLL
{
public class Remote
{
public Remote()
{
}
#region 首页左导航
/// <summary>
/// 获得首页,左导航列表(作者、出版社、书本类型)
/// </summary>
/// <param name="cFieldName">字段名</param>
/// <param name="count">记录行数</param>
/// <param name="cTableName">表名</param>
/// <param name="id">数字标识号</param>
/// <returns></returns>
public static string getEBPList(string cFieldName,int count,string cTableName,int id)
{
StringBuilder strHtml=new StringBuilder();
Data.BLL.BookData bll=new BookData();
ArrayList list=bll.getEBPList(cFieldName,cTableName);
if(list.Count<count||count==0)
{
count=list.Count;
}
for(int i=0;i<count;i++)
{
if(id==1)
{
strHtml.AppendFormat("<TR><TD vAlign=top height=22>· <A class=bl href=\"BookList.aspx?name={0}&id={1}\" target=_blank>{2}</A> </TD></TR>",System.Web.HttpUtility.UrlEncode(list[i].ToString().Trim()),System.Web.HttpUtility.UrlEncode(id.ToString()),list[i]);
}
else if(id==2)
{
strHtml.AppendFormat("<TR><TD height=25><DIV align=center><STRONG><A class=blackl href=\"BookList.aspx?name={0}&id={1}\" target=_blank>{2}</A></STRONG></DIV></TD></TR>",System.Web.HttpUtility.UrlEncode(list[i].ToString().Trim()),System.Web.HttpUtility.UrlEncode(id.ToString()),list[i]);
}
else if(id==3)
{
strHtml.AppendFormat("<TR><TD height=25><DIV align=center><STRONG><A class=blackl href=\"BookList.aspx?name={0}&id={1}\" target=_blank>{2}</A></STRONG></DIV></TD></TR>",System.Web.HttpUtility.UrlEncode(list[i].ToString().Trim()),System.Web.HttpUtility.UrlEncode(id.ToString()),list[i]);
}
}
return strHtml.ToString();
}
#endregion
#region 暂不用
public static string getPublisherList(string cFieldName,int count,string cTableName)
{
StringBuilder strHtml=new StringBuilder();
Data.BLL.BookData bll=new BookData();
ArrayList list=bll.getEBPList(cFieldName,cTableName);
if(list.Count<count||count==0)
{
count=list.Count;
}
for(int i=0;i<count;i++)
{
strHtml.AppendFormat("<TR><TD height=25><DIV align=center><STRONG><A class=blackl href=\"BookList.aspx?name={0}\" target=_blank>{1}</A></STRONG></DIV></TD></TR>",list[i],list[i]);
}
return strHtml.ToString();
}
#endregion
#region 书本列表
/// <summary>
/// 前台首页上获得书本列表
/// </summary>
/// <param name="count">每行的书本数</param>
/// <param name="id">数字标识符</param>
/// <param name="row">显示的行数</param>
/// <returns></returns>
public static string getBookList(int count,int id,int row)
{
StringBuilder strHtml=new StringBuilder();
Data.BLL.BookData bll=new BookData();
ArrayList BookPrimaryKeyList=new ArrayList();
if(id==4)
{
BookPrimaryKeyList=bll.getPrimaryKeyList("cStatus","T");
}
else if(id==5)
{
BookPrimaryKeyList=bll.getPrimaryKeyList("cStatus","N");
}
else if(id==6)
{
BookPrimaryKeyList=bll.getPrimaryKeyList("cStatus","F");
}
Data.Model.BookData model=new Data.Model.BookData();
if(BookPrimaryKeyList.Count<count*row||count<=0)
{
count=BookPrimaryKeyList.Count;
}
for(int r=0;r<row;r++)
{
strHtml.Append("<TR>");
for(int i=r*count;i<count+(r*count)&&i<BookPrimaryKeyList.Count;i++)
{
if(id==4)
{
strHtml.Append("<TD><TABLE cellSpacing=0 cellPadding=0 width=290 border=0><TBODY>");
}
else if(id==5)
{
strHtml.Append("<TD class=unnamed1 width=\"50%\" height=138><TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0><TBODY>");
}
else if(id==6)
{
strHtml.Append("<TD class=unnamed1 width=\"50%\" height=138><TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0><TBODY>");
}
model=bll.getModel(BookPrimaryKeyList[i].ToString());
string BookName="";
string Editor="";
string Publisher="";
BookName=model.cBookName.ToString().Trim();
Editor=model.cEditor.ToString().Trim();
Publisher=model.cPublisher.ToString().Trim();
if(BookName.Length>12)
{
BookName=BookName.Substring(0,10)+"...";
}
if(Editor.Length>12)
{
Editor=Editor.Substring(0,10)+"...";
}
if(Publisher.Length>12)
{
Publisher=Publisher.Substring(0,10)+"...";
}
strHtml.Append("<TR>");
strHtml.AppendFormat("<TD width=\"34%\" rowSpan=6><DIV align=center><A title=\"{0}\" ",model.cBookName);
strHtml.AppendFormat("href=\"BookDetails.aspx?name={0}\" target=_blank>",System.Web.HttpUtility.UrlEncode(model.cBookName.ToString().Trim()));
strHtml.AppendFormat("<IMG class=img height=113 src=\"{0}\" width=84 align=top border=0></A></DIV></TD>",model.cImagePath);
strHtml.Append("<TD width=\"14%\" height=23><DIV class=style22 align=center>书名:</DIV></TD>");
strHtml.AppendFormat("<TD width=\"52%\" height=23><A class=blackl href=\"BookDetails.aspx?name={0}\" target=_blank>",System.Web.HttpUtility.UrlEncode(model.cBookName.ToString().Trim()));
strHtml.AppendFormat("<FONT title=\"{0}\" color=#6699cc>",model.cBookName);
strHtml.AppendFormat("{0}</FONT></A></TD>",BookName);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.Append("<TD height=23><DIV class=style22 align=center>定价:</DIV></TD>");
strHtml.AppendFormat("<TD height=23><FONT color=#6699cc><SPAN class=style22>¥{0}</SPAN></FONT></TD></TR>",model.mPrice);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.Append("<TD height=23><DIV class=style22 align=center>作者:</DIV></TD>");
strHtml.AppendFormat("<TD height=23><FONT color=#6699cc><SPAN class=style22>{0}</SPAN></FONT></TD></TR>",Editor);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.Append("<TD height=23><DIV class=style22 align=center>出版:</DIV></TD>");
strHtml.AppendFormat("<TD height=23><FONT color=#6699cc><SPAN class=style22>{0}</SPAN></FONT></TD></TR>",Publisher);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.Append("<TD height=23><DIV class=style22 align=center>ISBN:</DIV></TD>");
strHtml.AppendFormat("<TD height=23><FONT color=#6699cc><SPAN class=style22>{0}</SPAN></FONT></TD></TR>",model.cISBN);
strHtml.Append("</TR>");
strHtml.Append("</TBODY></TABLE></TD>");
}
strHtml.Append("</TR>");
}
return strHtml.ToString();
}
/// <summary>
/// 在前台书本列表页上获得书本列表
/// </summary>
/// <param name="count">每页显示的行数</param>
/// <param name="page">当前页数</param>
/// <param name="id">数字标识符</param>
/// <param name="values">数字标识符对应的值</param>
/// <returns></returns>
public static string getBookList(int count,int page,int id,string values)
{
Data.BLL.BookData bll=new BookData();
Data.Model.BookData model=new Data.Model.BookData();
ArrayList list=new ArrayList();
string cFieldName="";
if(id==4)
{
values="T";
}
else if(id==5)
{
values="N";
}
else if(id==6)
{
values="F";
}
if(id==10)
{
ArrayList l=new ArrayList();
for(int i=1;i<=8;i++)
{
if(id==3||id==4||id==5||id==6)
{
continue;
}
cFieldName=getField(i);
l=bll.getPrimaryKeyList(cFieldName,values);
for(int j=0;j<l.Count;j++)
{
list.Add(l[j].ToString());
}
l.Clear();
}
}
else
{
cFieldName=getField(id);
list=bll.getPrimaryKeyList(cFieldName,values);
}
int acount=list.Count;//记录数
int pages=(acount-1)/count+1;//页数
StringBuilder strHtml=new StringBuilder();
strHtml.Append("<TR><TD width=\"593\"><DIV align=center><TABLE height=130 cellSpacing=0 cellPadding=0 width=575 border=0><TBODY>");
for(int i=(page-1)*count;i<page*count&&i<acount;i++)
{
model=bll.getModel(list[i].ToString());
string Description=model.cDescription.ToString().Trim();
if(Description.Length>80)
{
Description=Description.Substring(0,80)+"...";
}
string Editor="";
string BookName="";
string Publisher="";
Editor=model.cEditor.ToString().Trim();
BookName=model.cBookName.ToString().Trim();
Publisher=model.cPublisher.ToString().Trim();
if(Editor.Length>6)
{
Editor=Editor.Substring(0,6)+"...";
}
if(BookName.Length>6)
{
BookName=BookName.Substring(0,6)+"...";
}
if(Publisher.Length>6)
{
Publisher=Publisher.Substring(0,6)+"...";
}
strHtml.Append("<TR>");
strHtml.Append("<TD class=xuxian width=111 rowSpan=6><DIV align=center>");
strHtml.Append("<TABLE height=125 width=\"100%\" background=\"\" border=0>");
strHtml.Append("<TBODY>");
strHtml.Append("<TR>");
strHtml.AppendFormat("<TD><DIV align=center><A href=\"BookDetails.aspx?name={0}\" target=_blank>",System.Web.HttpUtility.UrlEncode(model.cBookName.ToString().Trim()));
strHtml.AppendFormat("<IMG src=\"{0}\" alt=\"{1}\" width=84 height=113 border=0 align=top></A></DIV></TD>",model.cImagePath,model.cBookName);
strHtml.Append("</TR>");
strHtml.Append("</TBODY>");
strHtml.Append("</TABLE>");
strHtml.Append("</DIV></TD>");
strHtml.AppendFormat("<TD width=138 height=20><DIV align=left><FONT color=#6699cc size=2 title=\"{0}\">书名:",model.cBookName);
strHtml.AppendFormat("<A class=blackl href=\"BookDetails.aspx?name={0}\" target=_blank>",System.Web.HttpUtility.UrlEncode(model.cBookName.ToString().Trim()));
strHtml.AppendFormat("{0}</A></FONT></DIV></TD>",BookName);
strHtml.AppendFormat("<TD class=xuxian vAlign=top width=271 rowSpan=6><DIV align=left><p><FONT title=\"{0}\"color=#6699cc size=2>简介:{1}</FONT></p>",model.cDescription,Description);
strHtml.Append("<table width=\"251\" border=\"0\">");
strHtml.Append("<tr>");
strHtml.Append("<td width=\"245\" height=\"33\"><FONT color=#6699cc size=2>");
strHtml.AppendFormat("<a href=\"ShopCart.aspx?cid={0}\" target=\"_blank\">订购>> </a>",System.Web.HttpUtility.UrlEncode(model.cBookName));
strHtml.AppendFormat("<a href=\"BookDetails.aspx?name={0}\" target=_blank>详细>> </a>",System.Web.HttpUtility.UrlEncode(model.cBookName));
strHtml.Append("</FONT></td>");
strHtml.Append("</tr>");
strHtml.Append("</table>");
strHtml.Append("</DIV></TD>");
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.AppendFormat("<TD width=138 height=20><DIV align=left><FONT color=#6699cc size=2>定价:{0} </FONT></DIV></TD>",model.mPrice);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.AppendFormat("<TD width=138 height=20><DIV align=left><FONT color=#6699cc size=2>折扣价格:{0} </FONT></DIV></TD>",model.mCheapPrice);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.AppendFormat("<TD width=138 height=20><DIV align=left><FONT title=\"{0}\"color=#6699cc size=2>作者:{1} </FONT></DIV></TD>",model.cEditor,Editor);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.AppendFormat("<TD width=138 height=20><DIV align=left><FONT title=\"{0}\"color=#6699cc size=2>出版:{1} </FONT></DIV></TD>",model.cPublisher,Publisher);
strHtml.Append("</TR>");
strHtml.Append("<TR>");
strHtml.AppendFormat("<TD class=\"xuxian\" width=138 height=20><DIV align=left><FONT color=#6699cc size=2>ISBN:{0} </FONT></DIV></TD>",model.cISBN);
strHtml.Append("</TR>");
}
strHtml.Append("</TBODY></TABLE></DIV></TD></TR>");
strHtml.Append("<TR><TD height=\"48\"><FORM action=nlist.asp method=get><DIV align=center>");
strHtml.AppendFormat(" 第 {0} 页 ",page);
strHtml.AppendFormat(" 共 {0} 页 ",pages);
// strHtml.AppendFormat("<a href=\" ?page=1\"> 首页 </a>");
// if(page>1)
// {
// strHtml.AppendFormat("<a href=\" ?page={0}\"> 上一页 </a>",page-1);
// }
// for(int j=1;j<pages+1;j++)
// {
// strHtml.AppendFormat("<a href=\" ?page={0}\"> {1} </a>",j,j);
// }
// if(page<pages)
// {
// strHtml.AppendFormat("<a href=\" ?page={0}\"> 下一页 </a>",page+1);
// }
// strHtml.AppendFormat("<a href=\" ?page={0}\"> 尾页 </a>",pages);
string param="&id="+id+"&name="+System.Web.HttpUtility.UrlEncode(values);
strHtml.AppendFormat("<a href=\" ?page=1{0}\"> 首页 </a>",param);
if(page>1)
{
strHtml.AppendFormat("<a href=\" ?page={0}{1}\"> 上一页 </a>",page-1,param);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -