asp.net 3.5 SQL Server 2005 开发的一个电子商务平台
public Operation() {
//
// TODO: 在此处添加构造函数逻辑
//
}
DataBase data = new DataBase();
#region 添加供求信息
/// <summary>
/// 添加供求信息
/// </summary>
/// <param name="type">信息类别</param>
/// <param name="title">标题</param>
/// <param name="info">内容</param>
/// <param name="linkMan">联系人</param>
/// <param name="tel">联系电话</param>
public void InsertInfo(string type, string title, string info, string linkMan, string tel)
{
SqlParameter[] parms ={
data.MakeInParam("@type",SqlDbType.VarChar,50,type),
data.MakeInParam("@title",SqlDbType.VarChar,50,title),
data.MakeInParam("@info",SqlDbType.VarChar,500,info),
data.MakeInParam("@linkMan",SqlDbType.VarChar,50,linkMan),
data.MakeInParam("@tel",SqlDbType.VarChar,50,tel),
};
int i = data.RunProc("INSERT INTO tb_info (type, title, info, linkman, tel,checkState) VALUES (@type, @title,@info,@linkMan, @tel, 0)", parms);
}
#endregion
#region 修改供求信息
/// <summary>
/// 修改供求信息的审核状态
/// </summary>
/// <param name="id">信息ID</param>
/// <param name="type">信息类型</param>
public void UpdateInfo(string id, string type)
{
DataSet ds = this.SelectInfo(type, Convert.ToInt32(id));
bool checkState = Convert.ToBoolean(ds.Tables[0].Rows[0][6].ToString());
int i;
if (checkState)
{
i = data.RunProc("UPDATE tb_info SET checkState = 0 WHERE (ID = " id ")");
}
else
{
i = data.RunProc("UPDATE tb_info SET checkState = 1 WHERE (ID = " id ")");
}
}
#endregion
#region 删除供求信息
/// <summary>
/// 删除指定的供求信息
/// </summary>
/// <param name="id">供求信息ID</param>
public void DeleteInfo(string id)
{
int d = data.RunProc("Delete from tb_info where id='" id "'");
}
#endregion
}
评论