110,533
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace BLL
{
public class BumenxinxiBLL
{
//查询所有的部门信息
public DataTable bumenquerry()
{
Database db = DatabaseFactory.CreateDatabase();
DbCommand dbc = db.GetStoredProcCommand("Getselect");
db.AddInParameter(dbc, "@tablename", DbType.String, "branch");
return DA.SqlHelper.getDB.queryDt(dbc);
}
//查询部门的Br_code
public DataTable querrycode(string Br_code)
{
string where = "Br_code='"+Br_code+"'";
Database db = DatabaseFactory.CreateDatabase();
DbCommand dbc = db.GetStoredProcCommand("Getselect");
db.AddInParameter(dbc, "@tablename", DbType.String, "branch");
db.AddInParameter(dbc, "@where", DbType.String, where);
return DA.SqlHelper.getDB.queryDt(dbc);
}
//修改部门信息
public bool bumenupdate(int Br_id,string Br_name,string Br_code)
{
Common.Branch br = new Common.Branch();
br.BrId = Br_id;
br.BrName = Br_name;
br.BrCode = Br_code;
if (DA.SqlHelper.getDB.Update<Common.Branch>(br))
{
return true;
}
else
{
return false;
}
}
//添加部门
public bool bumenadd(string Br_name, string Br_code)
{
Common.Branch br = new Common.Branch();
br.BrName = Br_name;
br.BrCode = Br_code;
if (DA.SqlHelper.getDB.Add<Common.Branch>(br))
{return true;}
else{return false;}
}
//删除部门
public bool bumendelete(string code)
{
string str = "delete branch where Br_code like '"+code+"%'";
return DA.SqlHelper.getDB.querysql(str);
}
}
}