Asp.net??????????????????
???????????? ???????[ 2014/7/16 13:31:37 ] ????????Asp.net net ???????
???????????е????
List<SearchModel> ss = new List<SearchModel>();
if (!string.IsNullOrEmpty(Request.Form["txtName"]))//?????????????????????????
{
SearchModel model = new SearchModel();
model.Name = "BookName";//???????????????
model.Value = Request.Form["txtName"];//???????????????????
model.Action = Action.Like;//?????like
ss.Add(model);
}//????????
if (!string.IsNullOrEmpty(Request.Form["txtAuthor"]))
{
SearchModel model = new SearchModel();
model.Name = "Author";
model.Value = Request.Form["txtAuthor"];
model.Action = Action.Like;
ss.Add(model);
}
if (!string.IsNullOrEmpty(Request.Form["categoryId"]))
{
SearchModel model = new SearchModel();
model.Name = "CategoryId";
model.Value = Request.Form["categoryId"];
model.Action = Action.Equart;
ss.Add(model);
}
if (!string.IsNullOrEmpty(Request.Form["publisherId"]))
{
SearchModel model = new SearchModel();
model.Name = "PublisherId";
model.Value = Request.Form["publisherId"];
model.Action = Action.Equart;
ss.Add(model);
}
if (!string.IsNullOrEmpty(Request.Form["txtISBN"]))
{
SearchModel model = new SearchModel();
model.Name = "ISBN";
model.Value = Request.Form["txtISBN"];
model.Action = Action.Like;
ss.Add(model);
}
if (!string.IsNullOrEmpty(Request.Form["isDiscount"]))
{
SearchModel model = new SearchModel();
model.Name = "Discount";
model.Value = "1";
model.Action = Action.Equart;
ss.Add(model);
}
List<T_Books> books = searchBll.Searc(ss);//???????Bll???в???
|
????Bll???????????Dal???sql???
public List<T_Books> Search(List<SearchModel> ss)//???????????????????????????????б???
{
string sql = "select * from T_Books where IsDelete=0 and ";//??????sql???
for (int i = 0; i < ss.Count; i++)
{
if (ss[i].Action == Action.Like)
{
sql += ss[i].Name + " like '%" + ss[i].Value + "%'";
}
if (ss[i].Action == Action.Equart)
{
sql += ss[i].Name + " = " + ss[i].Value;
}
if (ss[i].Action == Action.Greatthan)
{
sql += ss[i].Name + " > " + ss[i].Value;
}
if (ss[i].Action == Action.Lessthan)
{
sql += ss[i].Name + " < " + ss[i].Value;
}
if (i != ss.Count - 1)
{
sql += " and ";
}
}
List<T_Books> list = new List<T_Books>();
DataTable table = SqlHelper.ExecuteDataTable(sql?? CommandType.Text);//???????sql????????????????
foreach (DataRow row in table.Rows)
{
T_Books book = GetModelByDataRow.GetBooks(row);
list.Add(book);
}
return list;//???????????????鼯??????
}
|
??????????????????????????
?????????????????sql???????
????select * from T_Books where IsDelete=0 and BookName like '%C++%' and Author like '%JChubby%' and CategoryId = 15 and PublisherId = 16 and ISBN like '%1111%' and Discount = 1
?????????~??
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Asp.net MVC??ζ???????????????????????Trim????Asp.Net WebForm????????????asp.net ???????????Linux???Jexus?й?Asp.Net Core??ó???asp.net??????????????ASP.NET???????JSON????????????????ASP.NET MVC???????????Щ?£?Asp.net Core MVC?????SessionASP.NET Core???????7??????????????????[???]ASP.NET Core???????6??????????????????[???]ASP.NET Core???????5??????????????????ASP.NET???License Key??????ASP.NET Core 1.0?е???-?м????ASP.NET Core???????3???? ?????e??????[???]ASP.NET Core???????2??????????????ASP.NET?е????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????