📄 customerinquiryform.cs
字号:
//
this.textBox4.Location = new System.Drawing.Point(120, 64);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(136, 21);
this.textBox4.TabIndex = 3;
this.textBox4.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(120, 24);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(136, 21);
this.textBox3.TabIndex = 2;
this.textBox3.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 32);
this.label3.Name = "label3";
this.label3.TabIndex = 1;
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(8, 112);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(368, 168);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(592, 405);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "客户查询界面";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
//查询余额
private void radioButton1_Click(object sender, System.EventArgs e)
{
decimal Balance;
if(IsVerified)
{
Balance=service.QueryBalance(textBox1.Text);
richTextBox1.AppendText("卡号:"+textBox1.Text+"的余额是:"+Balance+"\r\n");
}
else
{
richTextBox1.AppendText("请首先验证卡号!\r\n");
}
}
//验证卡号是否正确
private void button1_Click(object sender, System.EventArgs e)
{
if(service.VerifyCard(textBox1.Text,textBox2.Text))
{
IsVerified=true;
textBox1.ReadOnly=true;
textBox2.ReadOnly=true;
button1.Enabled=false;
richTextBox1.AppendText("卡号验证通过,可以执行其他操作了!\r\n");
}
else
richTextBox1.AppendText("卡号验证失败!\r\n");
}
//结束操作
private void radioButton7_Click(object sender, System.EventArgs e)
{
IsVerified=false;
textBox1.ReadOnly=false;
textBox2.ReadOnly=false;
button1.Enabled=true;
richTextBox1.AppendText("操作结束!想重新进行操作,"+
"请首先首先输入卡号和PIN码并验证!\r\n");
}
//每月话费查询
private void radioButton2_Click(object sender, System.EventArgs e)
{
if(IsVerified)
{
IsQueryBill=true;
IsRecharge=false;
IsUnlock=false;
IsUpdatePIN=false;
label3.Text="年(4位数字)";
label4.Text="月(2位数字)";
}
else
richTextBox1.AppendText("请首先进行验证!\r\n");
}
//挂失
private void radioButton4_Click(object sender, System.EventArgs e)
{
if(IsVerified)
{
if(service.ReportOfLost(textBox1.Text))
{
richTextBox1.AppendText("挂失成功!操作结束!\r\n");
IsVerified=false;
textBox1.ReadOnly=false;
textBox2.ReadOnly=false;
button1.Enabled=true;
}
else
richTextBox1.AppendText("挂失失败!\r\n");
}
else
{
richTextBox1.AppendText("请首先验证卡号!\r\n");
}
}
//冲值
private void radioButton3_Click(object sender, System.EventArgs e)
{
if(IsVerified)
{
IsQueryBill=false;
IsRecharge=true;
IsUnlock=false;
IsUpdatePIN=false;
label3.Text="冲值卡号:";
label4.Text="冲值卡口令:";
textBox4.PasswordChar='*';
}
else
richTextBox1.AppendText("请首先进行验证!\r\n");
}
//解锁
private void radioButton5_Click(object sender, System.EventArgs e)
{
IsQueryBill=false;
IsRecharge=false;
IsUnlock=true;
IsUpdatePIN=false;
label3.Text="PUK码:";
textBox3.PasswordChar='*';
label4.Enabled=false;
textBox4.Enabled=false;
}
//修改PIN码
private void radioButton6_Click(object sender, System.EventArgs e)
{
if(IsVerified)
{
IsQueryBill=false;
IsRecharge=false;
IsUnlock=false;
IsUpdatePIN=true;
label3.Text="输入PIN码:";
label4.Text="确认PIN码:";
textBox3.PasswordChar='*';
textBox4.PasswordChar='*';
}
else
richTextBox1.AppendText("请首先进行验证!\r\n");
}
//确认输入的信息,并进行相应的操作
private void button2_Click(object sender, System.EventArgs e)
{
//查询每月话费
if(IsQueryBill)
{
decimal Amount,SMAmount,CallAmount;
string CardNo=textBox1.Text;
int year=int.Parse(textBox3.Text);
int month=int.Parse(textBox4.Text);
Amount=service.QueryBill(CardNo,year,month);
SMAmount=service.QuerySMBill(CardNo,year,month);
CallAmount=service.QueryCallBill(CardNo,year,month);
richTextBox1.AppendText("卡号:"+CardNo+"在"+year+"年"+month+"月的总话费是:"
+Amount+"\r\n");
richTextBox1.AppendText("通话话费是:"+CallAmount+",短信话费是:"+SMAmount+"\r\n");
IsQueryBill=false;
}
//冲值
if(IsRecharge)
{
bool result;
string CardNo=textBox1.Text;
string RechargeCard=textBox3.Text;
string Password=textBox4.Text;
result=service.Recharge(CardNo,RechargeCard,Password);
if(result)
{
richTextBox1.AppendText("冲值成功!\r\n");
}
else
richTextBox1.AppendText("冲值失败!\r\n");
IsRecharge=false;
textBox4.Text="";
textBox4.PasswordChar=char.Parse("\0");
}
//解锁
if(IsUnlock)
{
bool result;
string CardNo=textBox1.Text;
string PUK=textBox3.Text;
result=service.Unlock(CardNo,PUK);
if(result)
{
richTextBox1.AppendText("解锁成功!\r\n");
}
else
richTextBox1.AppendText("解锁失败或者卡号没有被暂时锁定\r\n");
IsUnlock=false;
textBox3.Text="";
textBox3.PasswordChar=char.Parse("\0");
label4.Enabled=true;
textBox4.Enabled=true;
}
//修改PIN码
if(IsUpdatePIN)
{
bool result;
string CardNo=textBox1.Text;
string Pwd=textBox3.Text;
string RePwd=textBox4.Text;
if(Pwd==RePwd)
{
result=service.UpdatePIN(CardNo,Pwd);
if(result)
{
richTextBox1.AppendText("修改PIN码成功!\r\n");
}
else
{
richTextBox1.AppendText("修改PIN码不成功!\r\n");
}
IsUpdatePIN=false;
}
else
{
richTextBox1.AppendText("两次输入PIN码不一样,请重新输入!\r\n");
this.InvokeOnClick(button3,new EventArgs());
}
if(!IsUpdatePIN)
{
textBox3.Text="";
textBox4.Text="";
textBox3.PasswordChar=char.Parse("\0");
textBox4.PasswordChar=char.Parse("\0");
}
}
}
//重新输入
private void button3_Click(object sender, System.EventArgs e)
{
textBox3.Text="";
textBox4.Text="";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -