📄 category.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 System.Data.SqlClient;
/// <summary>
/// Category 的摘要说明
/// </summary>
//该源码首发自www.51aspx.com(51aspx.com)
public class Category
{
#region 私有字段和属性
private int id;
public int ID
{
get { return id; }
set { id = value; }
}
private string _bigclass;
public string BigClass
{
get { return _bigclass; }
set { _bigclass = value; }
}
#endregion
public Category()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region 显示全部大类
public DataTable getall()
{
Database gettable = new Database();
try
{
return (gettable.GetTable("GetAllBigClass", null, "BigClass", 1));
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
#endregion
#region 判断类别是否存在
public bool ExistsBigClass(string name)
{
string proanme = "CheckAddBigClass";
Database exeScalar = new Database();
bool end = false;
SqlParameter[] param ={ Database.CreateInParam("@BigClass", SqlDbType.NVarChar, 80,name)};
try
{
int result = exeScalar.GetScalar(proanme, param, 1);
if (result > 0)
end = true;
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return end;
}
#endregion
#region 增加大类
/// <summary>
/// 增加用户
/// </summary>
/// <param name="ManUser">Manager实例</param>
/// <returns></returns>
public int addBigClass(Category Big)
{
string proanme = "AddBigClass";
Database exe = new Database();
SqlParameter[] param ={ Database.CreateInParam("@BigClass", SqlDbType.NVarChar, 80, Big.BigClass) };
try
{
return (exe.execute(proanme, param, 1));
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
#endregion
#region 修改类别
/// <summary>
/// 修改类别
/// </summary>
/// <param name="ManUser">Category实例</param>
/// <returns></returns>
public int EditBigClass(Category edit)
{
string proanme = "EditBigClass";
Database exe = new Database();
SqlParameter[] param ={Database.CreateInParam("@id",SqlDbType.Int,4,edit.ID),
Database.CreateInParam("@BigClass",SqlDbType.NVarChar,50,edit.BigClass)};
try
{
return (exe.execute(proanme, param, 1));
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
#endregion
#region 根据用户id返回产品信息
public DataSet GetoneBigClass(int id)
{
Database gettable = new Database();
SqlParameter[] Param ={ Database.CreateInParam("@ID", SqlDbType.Int, 4, id) };
DataSet ds = new DataSet();
try
{
gettable.GetSet("GetoneBigClass", Param, ref ds,"BigClass", 1);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return ds;
}
#endregion
#region 删除类别
/// <summary>
/// 删除类别
/// </summary>
/// <param name="Category">Category实例</param>
/// <returns></returns>
public int delBigClass(Category del)
{
string proanme = "DelBig";
Database exe = new Database();
SqlParameter[] param ={ Database.CreateInParam("@id", SqlDbType.Int, 4, del.ID) };
try
{
return (exe.execute(proanme, param, 1));
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
#endregion
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -