?? 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>
/// 應(yīng)用程序的主入口點。
/// </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("卡號驗證通過,可以執(zhí)行其他操作了!\r\n");
}
else
richTextBox1.AppendText("卡號驗證失敗!\r\n");
}
//結(jié)束操作
private void radioButton7_Click(object sender, System.EventArgs e)
{
IsVerified=false;
textBox1.ReadOnly=false;
textBox2.ReadOnly=false;
button1.Enabled=true;
richTextBox1.AppendText("操作結(jié)束!想重新進行操作,"+
"請首先首先輸入卡號和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位數(shù)字)";
label4.Text="月(2位數(shù)字)";
}
else
richTextBox1.AppendText("請首先進行驗證!\r\n");
}
//掛失
private void radioButton4_Click(object sender, System.EventArgs e)
{
if(IsVerified)
{
if(service.ReportOfLost(textBox1.Text))
{
richTextBox1.AppendText("掛失成功!操作結(jié)束!\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="確認(rèn)PIN碼:";
textBox3.PasswordChar='*';
textBox4.PasswordChar='*';
}
else
richTextBox1.AppendText("請首先進行驗證!\r\n");
}
//確認(rèn)輸入的信息,并進行相應(yīng)的操作
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="";
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -