电话计费系统分析与设计
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
电话计费系统分析与设计
摘要
随着近年来我国电信业的迅猛发展,各项业务量快速增长,新的业务种类和新的服务形式不断推出,而旧的电信业务的计费处理从体制到技术都越来越不能适应形势的需要,甚至在某种程度上已经限制和阻碍了业务的发展。
新的时期,新的挑战。
近年来,我国移动电话的普及全国各个角落,种类繁多,形式多样。
同时业务的需求也是千变万化,作为一家好的电话服务公司要想在现代电信产业中稳步发展,求的生存,就的有良好管理体制和先进的管理系统和优秀的技术。
如今计算机软件产业的不断进步,在一些面向对象的编程语言中融合了强大的数据库开发能力,数据库访问技术[8]和Visual Studio2005开发平台的引入。
使数据库开发更加成熟化。
SQL2000数据库的强大数据处理能力,市局管理更现代化、自动化、智能化、人性化。
在这些软件的帮助下使得数据管理变得简单,条理清晰,科学。
易保存,以及一些以前方法无法达到的功能。
为了适应现代社会的高节奏,高效率的工作要求,为电话计费管理者对数据的管理带来极大的方便。
电话计费管理系统采用全新的设计理念,本系统采用Windows应用程序设计提供完善的功能模块,无论是从客户还是管理人员对自己的业务需求都能够满足。
客户可以方便的实现各种业务的查询,管理员可以很方便的管理各种各样的客户业务,办理业务,更新,删除业务,备份,优化数据等功能。
而这些功能的实现都对于客户和管理员都是透明的,都是在可视化的窗体上操作,操作方便简单。
关键词: Windows应用程序电话计费系统分析设计
软件设计
软件设计是在做好需求的基础上来完成的,具体是在本章完成两方面的工作,一方面是将软件需求的DFD图通过SD方法转换为SC图,即进行模块化设计或称为总体设计;另一方面是对每一模块进行详细设计即过程设计,这部分工作在这里使用的表达工具是PDL语言。
系统逻辑组成结构
经过分析要完成电话记费的基本功能首先要建立以下基本表:
客户资料表:客户资料表记录了客户的基本信息,设计表如下页图3.1-1
收费员资料表:收费员资料表记录了收费员的基本信息,设计表如下图
3.1-2
应收款额表:应收款额表记录了客户的缴费及余额信息,设计表如下图
3.1-3
话费信息库表:话费信息库表记录了客户的基本话费信息,设计表如下页
图3.1-4
客户受理表:客户受理表记录了客户受理结果的基本信息,设计表如下图
3.1-5
列名数据类型长度允许空客户姓名varChar 15
联系电话 Varchar 15
联系地址 Varchar 40 Y
套餐名称 Varchar 20 Y
手机号码 Char 11
手机密码 Char 10
图.客户资料表
列名数据类型长度允许空收费员ID Char 8
姓名 varChar 15
年龄 Varchar 3 Y
密码 varchar 10
图.收费员资料表
列名数据类型长度允许空客户姓名char 15
手机号码char 11 Y
应收费用money 8 Y
实收费用money 8 Y
专用卡余额money 8 Y
图.应收款额表
列名数据类型长度允许空手机号码Char 11
客户姓名 varchar 15
通话费 Money 8 Y
新业务费 Money 8 Y
费用合计 Money 8 Y
套餐名称 Varchar 20 Y
图.话费信息库表
列名数据类型长度允许空
图.客户受理表
系统概念结构
图. 系统E-R图
功能模块图
分析电话计费系统的功能模块图,可以看出系统有两个动作分支构成,即客户查询和管理员管理系统,做功能模块如图.
客户姓名 Varhar 15
手机号码 Char 11
受理内容 Varchar 50 Y
受理时间 Date time 8 Y 姓名编号手机号
地址名称
电话应收费客户实时费用
使用
支付
历史话费库支付
收费
收费员编号姓名
客户请求受理支付
手机号码手机号码手机号码
图.功能模块图
系统实现
系统登陆模块
登录界面模块是通过访问数据库中的用户表中的帐号和密码两个字段来判断用户名和密码是否匹配,如果匹配就和进入主界面,如果不匹配则不能进入主界面。
用户分两个级别(客户和管理员),不同的用户级别登录,其权限在主界面中得以体现。
如图4.1所示。
图.用户登录窗口
电话计费管理系统
客户查询 管理员办理业务
个人信息查询
余额查询
交话费
套餐查询 话费查询 办理开户
办理套餐业务
打印话费单
更新客户信息
业务报表
实现代码:
using System.Data.SqlClient;
class linkdatabase
{
private string strSQL;
private string connectionString = "workstation id=localhost;Integrated Security = SSPI;database=电话计费系统";
private SqlConnection myConnection;
private DataSet ds = new DataSet();
private SqlDataAdapter da;
public linkdatabase()
{
}
public DataSet SelectDataBase(string tempStrSQL, string tempTableName) {
this.strSQL = tempStrSQL;
this.myConnection = new SqlConnection(connectionString);
this.da = new SqlDataAdapter(this.strSQL, this.myConnection);
this.ds.Clear();
this.da.Fill(ds, tempTableName);
return ds;}}
private void button1_Click(object sender, EventArgs e)
{for (int i = 0; i < mytable.Rows.Count; i++)
{ this.myrow = mytable.Rows[i];
if (myrow[0].ToString().Trim() ==
this.txt_id.Text.ToString().Trim() && myrow[1].ToString().Trim() ==
this.txt_pwd.Text.ToString().Trim()){ blcanlogin = true;
MessageBox.Show("密码验证成功,欢迎使用本系统!!","登录成功",MessageBoxButtons.OKCancel,rmation);
主页面 aa = new主页面();aa.Show();this.Hide();txt_pwd.Clear(); return;} 主窗体
主窗体是显示电话计费管理系统的主要功能(客户信息、业务查询、业务办理系统维护等)。
不同的用户级别登录到主界面有不同的权限。
如图4.2所示。
图. 主窗口
客户业务查询
客户查询窗口只要是为客户提供花费查询、个人信息查询、余额查询和套餐查询等信息。
如图4.3所示。
图 4.3 客户业务查询窗口
private void button1_Click(object sender, EventArgs e)
{
图.客户查询窗口
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "data source=(local);initial catalog=电话计费系统; integrated security=true;";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "select * from 话费信息库表 where(手机号码=@id);";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@id";
p1.SqlDbType = SqlDbType.Char;
p1.Value = txtb1.Text;
cmd.Parameters.Add(p1);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = cmd;
da.Fill(ds, "话费信息库表");
dataGrid1.DataSource = ds.Tables["话费信息库表"];
conn.Close();
txtb1.Clear();
}
private void button6_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "data source=(local);initial catalog=电话计费系统; integrated security=true;";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "SELECT 手机号码 , 姓名 , 帐户余额 FROM 收款额表where(手机号码=@id);";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@id";
p1.SqlDbType = SqlDbType.Char;
p1.Value = textBox2.Text;
cmd.Parameters.Add(p1);
conn.Open();
SqlDataAdapter da1 = new SqlDataAdapter();
DataSet ds1 = new DataSet();
da1.SelectCommand = cmd;
da1.Fill(ds1, "话费信息库表");
dataGrid3.DataSource = ds1.Tables["话费信息库表"];
conn.Close();
txtb1.Clear();
}
private void button4_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "data source=(local);initial catalog=电话计费系统; integrated security=true;";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "SELECT 手机号码 , 姓名 , 套餐名称 FROM 话费信息库表 where(手机号码=@id);";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@id";
p1.SqlDbType = SqlDbType.Char;
p1.Value = textBox1.Text;
cmd.Parameters.Add(p1);
conn.Open();
SqlDataAdapter da2 = new SqlDataAdapter();
DataSet ds2 = new DataSet();
da2.SelectCommand = cmd;
da2.Fill(ds2, "话费信息库表");
dataGrid2.DataSource = ds2.Tables["话费信息库表"];
conn.Close();
txtb1.Clear();
}
办理业务
业务办理窗口主要是系统管理员根据客户需求为客户办理各种业务,如办理新帐户、套餐、更新、删除客户业务等信息。
如图4.4所示。
图.业务办理
using System.Data.SqlClient;
SqlConnection conn;
SqlDataAdapter da;
DataSet ds;
CurrencyManager cm;
public partial class办理业务 : Form
{
SqlConnection conn;
SqlDataAdapter da;
DataSet ds;
CurrencyManager cm;
private void Bangding()
{
DataRow dr =
ds.Tables[0].Rows[BindingContext[ds.Tables[0]].Position];
this.txtzhbh.Text = dr["帐户编号"].ToString();
this.txtsjhm.Text = dr["手机号码"].ToString();
this.txtxm.Text = dr["姓名"].ToString();
this.txtsllx.Text = dr["受理类型"].ToString();
this.txtslsj.Text = dr["受理时间"].ToString();
}
private void Display()
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "data source=(local);initial catalog=电话计费系统; integrated security=true;";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "select * from 客户受理表 where(手机号码=@id);";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@id";
p1.SqlDbType = SqlDbType.Char;
p1.Value = txtsjhm.Text;
cmd.Parameters.Add(p1);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = cmd;
da.Fill(ds, "客户受理表");
dataGrid1.DataSource = ds.Tables["客户受理表"];
conn.Close();
}
private void办理业务_Load(object sender, EventArgs e)
{
conn = new SqlConnection();
conn.ConnectionString = "data source=.;initial catalog=电话计费系统;integrated security=true;";
da = new SqlDataAdapter("select *from 客户受理表", conn);
ds = new DataSet();
da.Fill(ds);
cm = (CurrencyManager)BindingContext[this.ds.Tables[0]];
Bangding();
}
private void button2_Click(object sender, EventArgs e)
{
if (cm.Position <= cm.Count - 1) cm.Position--;
Bangding();
}
private void button3_Click(object sender, EventArgs e)
{
if (cm.Position >= 0) cm.Position++;
Bangding();
}
private void button5_Click(object sender, EventArgs e)
{
conn = new SqlConnection();
conn.ConnectionString = "data source=.;initial catalog=电话计费系
统;integrated security=true;";
da = new SqlDataAdapter("select *from 客户受理表", conn);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "Insert into 客户受理表
values(@zhbh,@sjhm,@xm,@sllx,@slsj)";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@zhbh";
p1.SqlDbType = SqlDbType.Char;
p1.Value =txtzhbh.Text;
cmd.Parameters.Add(p1);
SqlParameter p2 = new SqlParameter();
p2.ParameterName = "@sjhm";
p2.SqlDbType = SqlDbType.Char;
p2.Value = txtsjhm.Text;
cmd.Parameters.Add(p2);
SqlParameter p3 = new SqlParameter();
p3.ParameterName = "@xm";
p3.SqlDbType = SqlDbType.VarChar;
p3.Value = txtxm.Text;
cmd.Parameters.Add(p3);
SqlParameter p4= new SqlParameter();
p4.ParameterName = "@sllx";
p4.SqlDbType = SqlDbType.VarChar;
p4.Value = txtsllx.Text;
cmd.Parameters.Add(p4);
SqlParameter p5 = new SqlParameter();
p5.ParameterName = "@slsj";
p5.SqlDbType = SqlDbType.DateTime;
p5.Value = txtslsj.Text;
cmd.Parameters.Add(p5);
cmd.ExecuteNonQuery();
Bangding();
MessageBox.Show("开户成功");
Display();
}
private void button7_Click(object sender, EventArgs e)
{
conn = new SqlConnection();
conn.ConnectionString = "data source=.;initial catalog=电话计费系统;integrated security=true;";
da = new SqlDataAdapter("select *from 客户受理表", conn);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "delete 客户受理表 where (帐户编号=@zhbh)";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@zhbh";
p1.SqlDbType = SqlDbType.Char;
p1.Value = txtzhbh.Text;
cmd.Parameters.Add(p1);
cmd.ExecuteNonQuery();
MessageBox.Show("数据删除成功!");
Bangding();
conn.Close();
}
//交话费
using System.Data.SqlClient;
using System.Runtime.InteropServices;
public partial class交话费 : Form
{ //定义win32API函数
[DllImport("Shell32.dll")]
public extern static int ShellExecute(int hwnd, string operation, string Filename, string parameter, string directory, int showcmd);
SqlConnection conn;
SqlDataAdapter da;
public交话费()
{
InitializeComponent();
}
private void Display()
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "data source=(local);initial catalog=电话计费系统; integrated security=true;";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "select * from 收款额表 where(手机号码=@id);";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@id";
p1.SqlDbType = SqlDbType.Char;
p1.Value = txtsjhm.Text;
cmd.Parameters.Add(p1);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = cmd;
da.Fill(ds, "收款额表");
dataGrid1.DataSource = ds.Tables["收款额表"];
conn.Close();
}
//添加客户话费
private void button5_Click(object sender, EventArgs e)
{
conn = new SqlConnection();
conn.ConnectionString = "data source=.;initial catalog=电话计费系统;integrated security=true;";
da = new SqlDataAdapter("select *from 收款额表", conn);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
mandType = CommandType.Text;
mandText = "Insert into 收款额表
values(@zhbh,@sjhm,@xm,@ysfy,@ssfy,@zhye)";
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@zhbh";
p1.SqlDbType = SqlDbType.Char;
p1.Value = txtzhbh.Text;
cmd.Parameters.Add(p1);
SqlParameter p2 = new SqlParameter();
p2.ParameterName = "@sjhm";
p2.SqlDbType = SqlDbType.Char;
p2.Value = txtsjhm.Text;
cmd.Parameters.Add(p2);
SqlParameter p3 = new SqlParameter();
p3.ParameterName = "@xm";
p3.SqlDbType = SqlDbType.VarChar;
p3.Value = txtxm.Text;
cmd.Parameters.Add(p3);
SqlParameter p4 = new SqlParameter();
p4.ParameterName = "@ysfy";
p4.SqlDbType = SqlDbType.Money;
p4.Value = txtysfy.Text;
cmd.Parameters.Add(p4);
SqlParameter p5 = new SqlParameter();
p5.ParameterName = "@ssfy";
p5.SqlDbType = SqlDbType.Money;
p5.Value = txtssfy.Text;
cmd.Parameters.Add(p5);
SqlParameter p6 = new SqlParameter();
p6.ParameterName = "@zhye";
p6.SqlDbType = SqlDbType.Money;
p6.Value = txtksye.Text;
cmd.Parameters.Add(p6);
cmd.ExecuteNonQuery();
MessageBox.Show("交费成功");
txtzhbh.Clear();
txtxm.Clear();
txtysfy.Clear();
txtzhbh.Clear();
txtssfy.Clear();
Display();
}
private void button7_Click(object sender, EventArgs e)
{
txtsjhm.Clear();
txtzhbh.Clear();
txtxm.Clear();
txtysfy.Clear();
txtzhbh.Clear();
txtssfy.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
IntPtr p = this.Handle;
int hwnd = p.ToInt32()
ShellExecute(hwnd, "open", "calc.exe", "", "", 3); } 打印报表
图4.5 打印报表
private void button1_Click(object sender, EventArgs e)
{ SqlConnection conn = new SqlConnection();
String MyString = "data source=(local);integrated
security=true;initial catalog=电话计费系统;"; conn.ConnectionString = MyString;
string strsql = "SELECT * From 收款额表 WHERE 手机号码 like @a "; conn.Open();SqlCommand sqlCommand1 = new SqlCommand();
sqlCommand1.Connection = conn;mandType = CommandType.Text;
mandText = strsql;
sqlCommand1.Parameters.Add(new SqlParameter("@a", SqlDbType.Char, 15));
sqlCommand1.Parameters[0].Value = textBox1.Text + "%";
SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
da.SelectCommand = sqlCommand1;
DataSet1 ds = new DataSet1();
da.Fill(ds, "收款额表");
c2.SetDataSource(ds);
crystalReportViewer1.ReportSource = c2;
}
客户留言簿
图4.6 客户留言簿
// 应用GDI+技术实现客户留言簿的字体大小,颜色和字体的设置
using System.Drawing.Text;
using System.Drawing.Printing;
using System.IO;
private static readonly string noFilename = "Untitled";
private string curFilename = null;
private bool dirty = false;
private bool fileOnDiskModified = false;
private PageSettings storedPageSettings = null;
private IContainer components;
private Color textColor;
private int textSize;
private void button2_Click(object sender, EventArgs e)
{
textSize = (int)numericUpDown1.Value;
string selFont = comboBox1.SelectedText;
Font textFont = new Font(selFont, textSize);
richTextBox1.ForeColor = textColor;
richTextBox1.Font = textFont;
}
private void ReadTextFile()
{
richTextBox1.TextChanged -= new
System.EventHandler(this.richTextBox1_TextChanged);
fileSystemWatcher1.EnableRaisingEvents = false;
try
{
Stream fs = new FileStream(curFilename, FileMode.Open);
FileInfo filInfo = new FileInfo(curFilename);
string extn = filInfo.Extension.ToUpper();
if (extn.Equals(".RTF"))
richTextBox1.LoadFile(fs, RichTextBoxStreamType.RichText);
else
richTextBox1.LoadFile(fs, RichTextBoxStreamType.PlainText); fs.Close();
fileSystemWatcher1.Path = filInfo.DirectoryName;
fileSystemWatcher1.Filter = ;
}
catch (Exception exp)
{
MessageBox.Show(exp.Message.ToString());
}
finally
{
richTextBox1.TextChanged += new
System.EventHandler(this.richTextBox1_TextChanged);
}
}
private void OpenFile_Click(object sender, System.EventArgs e)
{
OpenFileDialog openDlg = new OpenFileDialog();
if (openDlg.ShowDialog() == DialogResult.OK)
{
curFilename = openDlg.FileName;
ReadTextFile();
}
}
private void button1_Click(object sender, EventArgs e)
{
ColorDialog colorDlg = new ColorDialog();
if (colorDlg.ShowDialog() == DialogResult.OK)
{
textColor = colorDlg.Color;
}
}
private void Form1_Load(object sender, EventArgs e)
{
numericUpDown1.Value = 10;
InstalledFontCollection
sysFontCollection = new InstalledFontCollection();
FontFamily[] fontFamilies = sysFontCollection.Families;
for (int i = 0; i < fontFamilies.Length; ++i)
{
comboBox1.Items.Add(fontFamilies[i].Name);
}
comboBox1.Select(0, 20); }
2008-11-29
软件学院
王峥亮。