📄 customerbll.cs
字号:
using System;
using CallCenter.DALFactory;
using CallCenter.IDAL;
using CallCenter.Modules;
using System.Collections;
using System.Data;
namespace CallCenter.BusinessLayer
{
/// <summary>
/// 客户信息操作类
/// </summary>
public class CustomerBLL
{
private ICustomer dal = CustomerDAL.Create();
public CustomerBLL()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 保存客户信息
/// </summary>
/// <param name="info"></param>
/// <returns>客户编号</returns>
public int addCustomer(CustomerInfo info)
{
try
{
// CallCenter.BusinessLayer.TelCustomerBLL tcb = new CallCenter.BusinessLayer.TelCustomerBLL();
// TelCustomerInfo tcinfo = new TelCustomerInfo();
// int cid = dal.addCustomer(info);
// if(cid>0)
// {
// tcinfo.cid = cid;
// tcinfo.telnumber = info.ctelnumber;
// return tcb.addTelCustomer(tcinfo);
// }
// else
// {
// throw new Exception("客户信息保存失败!");
// }
return dal.addCustomer(info);
}
catch(Exception e)
{
throw e;
}
}
/// <summary>
/// 更新客户信息
/// </summary>
/// <param name="info"></param>
public int updateCustomer(CustomerInfo info)
{
try
{
// CallCenter.BusinessLayer.TelCustomerBLL tcb = new CallCenter.BusinessLayer.TelCustomerBLL();
// TelCustomerInfo tcinfo = new TelCustomerInfo();
// int num = dal.updateCustomer(info);
// if(num>0)
// {
// tcinfo.cid = info.id;
// tcinfo.telnumber = info.ctelnumber;
// tcb.updateTelCustomer(tcinfo);
// return num;
// }
// else
// {
// throw new Exception("客户信息修改失败!");
// }
return dal.updateCustomer(info);
}
catch(Exception e)
{
throw e;
}
}
/// <summary>
/// 删除客户信息,支持多条
/// 先删除来电-客户信息
/// 再删除客户服务记录信息
/// 最后删除客户信息
/// 此处没有做事务处理
/// </summary>
/// <param name="ids">客户编号字符串,以“,”分隔</param>
public int delCustomer(string ids)
{
try
{
// TelCustomerBLL tbll = new TelCustomerBLL();
// tbll.delTelCustomerByCid(ids);
//此处添加删除客户服务记录的方法
return dal.delCustomer(ids);
}
catch(Exception e)
{
throw e;
}
}
/// <summary>
/// 通过客户编号检索客户信息
/// </summary>
/// <param name="id"></param>
/// <returns>客户信息</returns>
public CustomerInfo getCustomerById(int id)
{
try
{
return dal.getCustomerById(id);
}
catch(Exception e)
{
throw e;
}
}
/// <summary>
/// 通过客户编号的集合检索客户信息
/// </summary>
/// <param name="ids">客户编号字符串,以“,”分隔</param>
/// <returns>客户信息的集合</returns>
public ArrayList getCustomerByIds(string ids)
{
try
{
return dal.getCustomerByIds(ids);
}
catch(Exception e)
{
throw e;
}
}
/// <summary>
/// 检索符合查询条件的客户信息
/// 查询条件:
/// 来电号码-匹配
/// 客户姓名-模糊
/// 客户性别-匹配
/// 客户类别-匹配
/// 客户地址-模糊
/// </summary>
/// <param name="info"></param>
/// <returns>客户信息的集合</returns>
public ArrayList queryCustomer(CustomerInfo info)
{
try
{
return dal.queryCustomer(info);
}
catch(Exception e)
{
throw e;
}
}
/// <summary>
/// 检索客户类别
/// </summary>
/// <returns>
/// 客户信息的集合,只有客户类别编号和类别名称两个属性
/// </returns>
public ArrayList getCustomerType()
{
try
{
return dal.getCustomerType();
}
catch(Exception e)
{
throw e;
}
}
public DataSet getCustomerType_DataSet(string tableName){
try
{
return dal.getCustomerType_DataSet(tableName);
}
catch(Exception e)
{
throw e;
}
}
public DataSet getCustomerByIds_DataSet(string ids,string tableName)
{
try
{
return dal.getCustomerByIds_DataSet(ids,tableName);
}
catch(Exception e)
{
throw e;
}
}
public DataSet queryCustomer_DataSet(CustomerInfo info,string tableName)
{
try
{
return dal.queryCustomer_DataSet(info,tableName);
}
catch(Exception e)
{
throw e;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -