📄 test_telcustomer.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_TelCustomer
{
private static String errorfile="F:\\net_project\\callcenter\\error.log";
private static String logfile="F:\\net_project\\callcenter\\log.log";
public Test_TelCustomer()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void test_addTelCustomer()
{
TelCustomerInfo info = new TelCustomerInfo();
info.cid=11;
info.telnumber="0411-83700295";
info.position =100;
string [] arrayTel = new string[]{"0411-6897525","599564","9648723","13596798644","65975656","5765657","875465","5694646","139754575456","4656786","37953476"};
TelCustomerBLL bll = new TelCustomerBLL();
try
{
foreach(string tel in arrayTel)
{
info.telnumber = tel;
bll.addTelCustomer(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_delTelCustomerById(int id)
{
TelCustomerBLL bll = new TelCustomerBLL();
try
{
bll.delTelCustomerById(id);
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
public void test_delTelCustomerByCid(string cids)
{
TelCustomerBLL bll = new TelCustomerBLL();
try
{
bll.delTelCustomerByCid(cids);
}
catch(Exception e)
{
TextWriter error = new StreamWriter(errorfile,true);
error.WriteLine(e.Message.ToString());
error.WriteLine(e.StackTrace);
error.Close();
}
finally
{
}
}
public void test_getTelCustomer(string telnumber)
{
TelCustomerBLL bll = new TelCustomerBLL();
try
{
ArrayList list = bll.getTelCustomerByTelnumber(telnumber);
TextWriter log = new StreamWriter(logfile,true);
IEnumerator enu = list.GetEnumerator();
enu.Reset();
while(enu.MoveNext())
{
TelCustomerInfo info = (TelCustomerInfo)enu.Current;
log.WriteLine(info.ToString());
}
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_updateTelCustomer(int id)
{
TelCustomerInfo info = new TelCustomerInfo();
info.cid=333;
info.telnumber="0411-83700261";
info.position =300;
info.id =id;
TelCustomerBLL bll = new TelCustomerBLL();
try
{
bll.updateTelCustomer(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_getTelCustomerByCid(int cid){
TelCustomerBLL bll = new TelCustomerBLL();
try
{
ArrayList list = bll.getTelCustomerByCid(cid);
TextWriter log = new StreamWriter(logfile,true);
IEnumerator enu = list.GetEnumerator();
enu.Reset();
while(enu.MoveNext())
{
TelCustomerInfo info = (TelCustomerInfo)enu.Current;
log.WriteLine(info.ToString());
}
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 + -