private void PointsForm_KeyDown(object sender, KeyEventArgs e) { //检查是否取消了交易 Config cfg = new Config(); if (e.KeyValue.ToString() == cfg.getCancelKeyValue()) { this.Close(); } else if (e.KeyCode == Keys.NumPad1) //积分消费 { do_points_payment(); } else if (e.KeyCode == Keys.NumPad2) //积分充值(积分累计) { do_points_deposit(); } }
private void OperatorForm_KeyDown(object sender, KeyEventArgs e) { Config cfg = new Config(); if (e.KeyValue.ToString() == cfg.getCancelKeyValue()) //检查是否取消了交易 { this.Close(); } else if (e.KeyCode == Keys.NumPad1) // 结算 { do_settlement(); } else if (e.KeyCode == Keys.NumPad2) // 操作员改密码 { do_change_password(); } else if (e.KeyCode == Keys.NumPad3) // 添加操作员 { do_add_operator(); } }
private void OthersForm_KeyDown(object sender, KeyEventArgs e) { //检查是否取消了交易 Config cfg = new Config(); if (e.KeyValue.ToString() == cfg.getCancelKeyValue()) { this.Close(); } switch (e.KeyCode) { case Keys.NumPad1: do_settlement(); break; case Keys.NumPad2: do_bind_member(); break; } }
private void OthersForm_KeyDown(object sender, KeyEventArgs e) { //检查是否取消了交易 Config cfg = new Config(); if (e.KeyValue.ToString() == cfg.getCancelKeyValue()) { this.Close(); } switch (e.KeyCode) { case Keys .NumPad1: do_settlement(); break; case Keys .NumPad2: do_bind_member(); break; } }
private void InputForm_KeyDown(object sender, KeyEventArgs e) { Config cfg = new Config(); if (e.KeyValue.ToString() == cfg.getCancelKeyValue()) //按下了交易取消键 { MainForm.trans.Is_Canceled = true; this.InitPara(); this.Close(); } //根据不同的输入类型来进行不同的操作 switch (inputType) { case "password": //密码 if (e.KeyCode == Keys.Enter) { MainForm.trans.Password = this.textBox1.Text.Trim(); this.Close(); } else if (this.isKeyInNumRange(e) && this.textBox1.Text.Length < 20) { this.Password += this.getNumKeyFace(e); this.textBox1.Text = this.Password; } break; case "newpassword": //新密码 if (e.KeyCode == Keys.Enter) { MainForm.newPasswrod = this.textBox1.Text.Trim(); this.Close(); } else if (this.isKeyInNumRange(e) && this.textBox1.Text.Length < 20) { this.newpassword += this.getNumKeyFace(e); this.textBox1.Text = this.newpassword; } break; case "repassword": //重新输入一遍密码 if (e.KeyCode == Keys.Enter) { MainForm.rePasswrod = this.textBox1.Text.Trim(); this.Close(); } else if (this.isKeyInNumRange(e) && this.textBox1.Text.Length < 20) { this.repassword += this.getNumKeyFace(e); this.textBox1.Text = this.repassword; } break; case "card": //刷卡 if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim().Length == 18) //输入的卡号需是18位 { MainForm.trans.Card_No = this.textBox1.Text.Trim(); this.Close(); } } break; case "batch_no": // 批次号输入 if (this.isKeyInNumRange(e)) { this.batch_no += this.getNumKeyFace(e); this.textBox1.Text = this.batch_no; } else if (e.KeyCode == Keys.Enter) { MainForm.trans.Old_Batch_No = this.textBox1.Text.Trim(); this.Close(); } break; case "trace_no": //流水号输入 if (this.isKeyInNumRange(e) && this.textBox1.Text.Length < 20) { this.trace_no += this.getNumKeyFace(e); this.textBox1.Text = this.trace_no; } else if (e.KeyCode == Keys.Enter) { MainForm.trans.Old_Trace_No = this.textBox1.Text.Trim(); this.Close(); } break; case "point": //积分输入 if (this.textBox1.Text.Trim() == "") { //第一个输入的字符不能是"0" if (e.KeyValue >= 97 && e.KeyValue <= 105) { this.point += this.getNumKeyFace(e); this.textBox1.Text = this.point; } } else { if (this.isKeyInNumRange(e)) { this.point += this.getNumKeyFace(e); this.textBox1.Text = this.point; } } if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim() != "") { MainForm.trans.Amount = this.textBox1.Text.Trim(); this.Close(); } } break; case "amount": //金额输入 if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim() != "0.00") { MainForm.trans.Amount = amount; this.Close(); } } else if (this.isKeyInNumRange(e)) { amount = amount + this.getNumKeyFace(e); //amount = amount.Replace(".", "").ToLower().Replace("numpad", "").Trim(); //检查money是否以"0"开头,如果允许以"0"开头的话则会出现"000000.00"格式的金额 if (amount.Substring(0, 1).ToString() == "0") { amount = amount.Substring(1, amount.Length - 1); } //每输入一个数字则清空一次输入框,并赋予其新的金额数值 switch (amount.Trim().Length) { case 0: this.textBox1.Text = "0.00"; break; case 1: this.textBox1.Text = "0.0" + amount; break; case 2: this.textBox1.Text = "0." + amount; break; default: this.textBox1.Text = amount.Insert(amount.Length - 2, "."); break; } } break; case "date": //日期输入 if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim().Length != 8) //长度不为8则格式不正确 { return; } else { if (!IsDate(this.textBox1.Text.Trim().Insert(4, "-").Insert(7, "-"))) //不符合日期格式不正确 { return; } else { MainForm.trans.Overdue_Date = this.textBox1.Text.Trim(); this.Close(); } } } else if (this.isKeyInNumRange(e)) { this.date += this.getNumKeyFace(e); this.textBox1.Text = this.date; } break; } }
private void InputForm_KeyDown(object sender, KeyEventArgs e) { Config cfg = new Config(); if (e.KeyValue.ToString() == cfg.getCancelKeyValue()) //按下了交易取消键 { MainForm.trans .Is_Canceled = true; this.InitPara(); this.Close(); } //根据不同的输入类型来进行不同的操作 switch (inputType) { case "password": //密码 if (e.KeyCode == Keys.Enter) { MainForm.trans.Password = this.textBox1.Text.Trim(); this.Close(); } else if(this.isKeyInNumRange(e) && this.textBox1 .Text .Length < 20) { this.Password += this.getNumKeyFace(e); this.textBox1.Text =this.Password; } break; case "newpassword": //新密码 if (e.KeyCode == Keys.Enter) { MainForm.newPasswrod = this.textBox1.Text.Trim(); this.Close(); } else if(this.isKeyInNumRange(e) && this.textBox1 .Text .Length < 20) { this.newpassword += this.getNumKeyFace(e); this.textBox1.Text = this.newpassword; } break; case "repassword": //重新输入一遍密码 if (e.KeyCode == Keys.Enter) { MainForm.rePasswrod = this.textBox1.Text.Trim(); this.Close(); } else if(this.isKeyInNumRange (e) && this.textBox1 .Text .Length < 20) { this.repassword += this.getNumKeyFace(e); this.textBox1.Text = this.repassword; } break; case "card": //刷卡 if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim().Length == 18) //输入的卡号需是18位 { MainForm.trans.Card_No = this.textBox1.Text.Trim(); this.Close(); } } break; case "batch_no": // 批次号输入 if (this.isKeyInNumRange(e)) { this.batch_no += this.getNumKeyFace(e); this.textBox1.Text = this.batch_no; } else if (e.KeyCode == Keys.Enter) { MainForm.trans.Old_Batch_No = this.textBox1.Text.Trim(); this.Close(); } break; case "trace_no": //流水号输入 if (this.isKeyInNumRange(e) && this.textBox1 .Text .Length < 20) { this.trace_no += this.getNumKeyFace(e); this.textBox1.Text = this.trace_no; } else if (e.KeyCode == Keys.Enter) { MainForm.trans.Old_Trace_No = this.textBox1 .Text .Trim (); this.Close(); } break; case "point": //积分输入 if (this.textBox1.Text.Trim() == "") { //第一个输入的字符不能是"0" if (e.KeyValue >= 97 && e.KeyValue <= 105) { this.point += this.getNumKeyFace(e); this.textBox1.Text = this.point; } } else { if (this.isKeyInNumRange(e)) { this.point += this.getNumKeyFace(e); this.textBox1.Text = this.point; } } if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim() != "") { MainForm.trans.Amount = this.textBox1.Text.Trim(); this.Close(); } } break; case "amount": //金额输入 if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim() != "0.00") { MainForm.trans.Amount = amount; this.Close(); } } else if (this.isKeyInNumRange(e)) { amount = amount + this.getNumKeyFace(e); //amount = amount.Replace(".", "").ToLower().Replace("numpad", "").Trim(); //检查money是否以"0"开头,如果允许以"0"开头的话则会出现"000000.00"格式的金额 if (amount.Substring(0, 1).ToString() == "0") { amount = amount.Substring(1, amount.Length - 1); } //每输入一个数字则清空一次输入框,并赋予其新的金额数值 switch (amount.Trim().Length) { case 0: this.textBox1.Text = "0.00"; break; case 1: this.textBox1.Text = "0.0" + amount; break; case 2: this.textBox1.Text = "0." + amount; break; default: this.textBox1.Text = amount.Insert(amount.Length - 2, "."); break; } } break; case "date": //日期输入 if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text.Trim().Length != 8) //长度不为8则格式不正确 { return; } else { if (!IsDate(this.textBox1.Text.Trim().Insert(4, "-").Insert(7, "-"))) //不符合日期格式不正确 { return; } else { MainForm.trans.Overdue_Date = this.textBox1.Text.Trim(); this.Close(); } } } else if (this.isKeyInNumRange(e)) { this.date += this.getNumKeyFace(e); this.textBox1.Text = this.date; } break; } }