📄 catories.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DataAccess;
/// <summary>
/// Catories 的摘要说明
/// 类别处理 信息
/// </summary>
public class Catories
{
public Catories()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
//////////////////////////////////////////
CDataAccess o_ExECatories = new CDataAccess();
/// <summary>
/// 删除,以编号为删除条件
/// </summary>
/// <param name="item_id"></param>
/// <returns></returns>
public bool delete(string item_id)
{
string sqistr = "delete [Categories] where[category_id]= '"+ item_id+"'";
if (o_ExECatories.ExecuteQuery(sqistr))
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 显示这张 "Catories"表里的全部数据
/// </summary>
/// <returns></returns>
public DataTable ShowTable()
{
string sqlstr = "select* from Categories ";
return o_ExECatories.GetDataTable(sqlstr);
}
public bool Add(string category_id, string category_name)
{
string sqistr = "insert into [Categories]([category_id],[name]) VALUES('" + category_id + "','" + category_name + "')";
if (o_ExECatories.ExecuteQuery(sqistr))
{
return true;
}
else
{
return false;
}
}
public bool update(string category_id, string category_name)
{
string sqlstr = "update [Categories] SET [name] ='" + category_name + "' WHERE [category_id]='" + category_id + "'";
if (o_ExECatories.ExecuteQuery(sqlstr))
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 显示这张 "Catories"表里的满足条件的数
/// </summary>
/// <returns></returns>
public DataTable SelectTable(string category_id)
{
string sqlstr = "select* from Categories where category_id='"+category_id+"'";
return o_ExECatories.GetDataTable(sqlstr);
}
/*
Description :显示这张 "Catories"表里的满足条件的数据表,采用模糊查询
......
Parameters : (用到的参数必须定义)string category_id,string name;
XXXX(参数名)) I/O(输入/输出)XXXX(参数说明)
......
Return Value :
XXXX(返回值) XXXX(返回值说明) returu DataTable
......
*/
public DataTable GetTable(string category_id,string name)
{
string strSql = null;
DataTable dt = null;
if(category_id!=""&&name!="")
{
strSql = "select* from Categories where category_id='"+category_id+"'and name ='" + name +"'";
dt=o_ExECatories.GetDataTable(strSql);
switch(dt.Rows.Count)
{
case 0:
strSql = "select* from Categories";
dt = o_ExECatories.GetDataTable(strSql);
break;
}
}
if (category_id == "")
{
strSql = "select* from Categories where name like'%" + name + "%'";
dt=o_ExECatories.GetDataTable(strSql);
}
if(name=="")
{
strSql = "select* from Categories where category_id like'%" + category_id + "%'";
dt=o_ExECatories.GetDataTable(strSql);
}
return dt;
////string Sql = " ";
////if (CheckBox1.Checked)
////{
//// Sql = Sql + "and CompanyName like '%" + TN.Text + "%' ";
////}
////if (CheckBox2.Checked)
////{
//// Sql = Sql + "and CommodityName like '%" + PN.Text + "%' ";
////}
////if (CheckBox3.Checked)
////{
//// Sql = Sql + "and ManageMan like '%" + MM.Text + "%' ";
////}
////if (CheckBox4.Checked)
////{
//// Sql = Sql + "and StockDate between '" + SD.Text + "' and '" + ED.Text + "'";
////}
////Session["sql"] = Sql;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -