📄 test_customer.cs
字号:
using System;
using System.Reflection;
using System.IO;
using System.Globalization;
using System.Resources;
using CallCenter.Modules;
using CallCenter.BusinessLayer;
using CallCenter.OracleDAL;
using System.Collections;
namespace CallCenter.TestCode
{
/// <summary>
/// 测试客户信息操作
/// </summary>
public class Test_Customer
{
private static String errorfile="F:\\net_project\\callcenter\\error.log";
private static String logfile="F:\\net_project\\callcenter\\log.log";
public Test_Customer()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void test_addCustomer()
{
CustomerInfo info = new CustomerInfo() ;
info.caddress = "西岗区黄河路219号";
info.ccontact = "465466645656465";
info.cemail = "ll@runbest.com.cn";
info.cfax = "0411-83700277";
info.cname = "qqq";
info.csex ="女";
info.ctype =1;
info.ccomment="aaaa/r/nbbb/r/nccc";
// string [] arrayName = new string[]{"李发度","张内容","吴金贵","都尉","在演鹏","旺鹏","张要可","利益","李铁","赵均这","李金鱼"};
CustomerBLL bll = new CustomerBLL();
try
{
// foreach(string name in arrayName)
// {
// info.cname = name;
bll.addCustomer(info);
// }
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
public void test_delCustomer(string ids)
{
try
{
CustomerBLL bll = new CustomerBLL();
bll.delCustomer(ids);
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
public void test_updateCustomer(int id)
{
CustomerInfo info = new CustomerInfo();
info.caddress = "西岗区白云街道19号";
info.ccontact = "";
info.cemail = "guo@runbest.com.cn";
info.cfax = "0411-88652496";
info.cname = "王花花";
info.csex = "男";
info.ctype =3;
info.id = id;
CustomerBLL bll = new CustomerBLL();
try
{
bll.updateCustomer(info);
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
public void test_getCustomerById(int id)
{
CustomerBLL bll = new CustomerBLL();
try
{
TextWriter log = new StreamWriter(logfile,true);
log.WriteLine(bll.getCustomerById(id));
log.Close();
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
public void test_getCustomerByIds(string ids){
CustomerBLL bll = new CustomerBLL();
try
{
ArrayList list = bll.getCustomerByIds(ids);
IEnumerator enu = list.GetEnumerator();
enu.Reset();
while(enu.MoveNext())
{
TextWriter log = new StreamWriter(logfile,true);
log.WriteLine((CustomerInfo)enu.Current);
log.Close();
}
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
public void test_queryCustomer(){
CustomerBLL bll = new CustomerBLL();
CustomerInfo info = new CustomerInfo();
// info.caddress = "白云街道";
// info.ccontact = "";
// info.cemail = "guo@runbest.com.cn";
// info.cfax = "0411-88652496";
// info.cname = "王花花";
// info.csex = "男";
// info.ctype =3;
info.ctelnumber="875465";
try
{
ArrayList list = bll.queryCustomer(info);
IEnumerator enu = list.GetEnumerator();
enu.Reset();
TextWriter log = new StreamWriter(logfile,false);
while(enu.MoveNext())
{
log.WriteLine((CustomerInfo)enu.Current);
}
log.Close();
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -