private void txtCardNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { Feature.FormNumericKeypad keyForm = new Feature.FormNumericKeypad(false); keyForm.DisplayText = "请输入密码"; keyForm.IsPassword = true; keyForm.ShowDialog(); if (!string.IsNullOrEmpty(keyForm.KeypadValue)) { _cardPassword = keyForm.KeypadValue; } } }
private void txtVIPCardNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { _card = null; Feature.FormNumericKeypad keyForm = new Feature.FormNumericKeypad(false); keyForm.DisplayText = "请输入密码"; keyForm.IsPassword = true; keyForm.ShowDialog(); if (!string.IsNullOrEmpty(keyForm.KeypadValue)) { string cardNo = txtVIPCardNo.Text.Trim(); string cardPassword = keyForm.KeypadValue; VIPCard card; int result = VIPCardService.GetInstance().SearchVIPCard(cardNo, cardPassword, out card); if (card != null && result == 1) { if (card.Status == 0) { MessageBox.Show("该卡未开通,请先开卡!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } txtName.Text = card.Name; txtBalance.Text = card.Balance.ToString("f2"); txtIntegral.Text = card.Integral.ToString(); txtDiscount.Text = ((1M - card.DiscountRate) * 10M).ToString("f2") + "折"; txtTelephone.Text = card.Telephone; txtAddress.Text = card.Address; if (card.Status == 1) { txtCardStatus.Text = "启用"; } if (card.Status == 2) { txtCardStatus.Text = "锁卡"; } if (card.Status == 3) { txtCardStatus.Text = "挂失"; } if (card.Status == 4) { txtCardStatus.Text = "作废"; } txtOpenCardTime.Text = card.OpenCardTime.ToString("yyyy-MM-dd HH:mm:ss"); if (card.LastConsumeTime != null) { txtLastConsumeTime.Text = Convert.ToDateTime(card.LastConsumeTime).ToString("yyyy-MM-dd HH:mm:ss"); } _cardNo = cardNo; _cardPassword = cardPassword; _card = card; if (card.Balance == 0M) { btnConsume.Enabled = false; btnConsume.BackColor = ConstantValuePool.DisabledColor; } else { btnConsume.Enabled = true; btnConsume.BackColor = btnConsume.DisplayColor; } } else if (result == 2) { txtVIPCardNo.Text = string.Empty; txtName.Text = string.Empty; txtBalance.Text = string.Empty; txtIntegral.Text = string.Empty; txtDiscount.Text = string.Empty; txtTelephone.Text = string.Empty; txtAddress.Text = string.Empty; txtCardStatus.Text = string.Empty; txtOpenCardTime.Text = string.Empty; txtLastConsumeTime.Text = string.Empty; MessageBox.Show("您输入的会员卡号或者密码错误!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { txtVIPCardNo.Text = string.Empty; txtName.Text = string.Empty; txtBalance.Text = string.Empty; txtIntegral.Text = string.Empty; txtDiscount.Text = string.Empty; txtTelephone.Text = string.Empty; txtAddress.Text = string.Empty; txtCardStatus.Text = string.Empty; txtOpenCardTime.Text = string.Empty; txtLastConsumeTime.Text = string.Empty; MessageBox.Show("服务器出现错误,请重新操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void btnRefundPay_Click(object sender, EventArgs e) { bool hasChecked = false; foreach (DataGridViewRow row in this.dataGirdViewExt1.Rows) { hasChecked = Convert.ToBoolean(row.Cells["colCheck"].Value); if (hasChecked) { break; } } if (!hasChecked) { MessageBox.Show("请选择需要进行支付退款操作的卡号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } bool result = true; CardRefundPayService refundPayService = new CardRefundPayService(); foreach (DataGridViewRow row in this.dataGirdViewExt1.Rows) { bool isCheck = Convert.ToBoolean(row.Cells["colCheck"].Value); if (isCheck) { string cardNo = row.Cells["colCardNo"].Value.ToString(); string tradePayNo = row.Cells["colTradePayNo"].Value.ToString(); string cardPassword; //获取卡密码 Feature.FormNumericKeypad keyForm = new Feature.FormNumericKeypad(false); keyForm.DisplayText = string.Format("请输入卡号'{0}'的密码", cardNo); keyForm.IsPassword = true; keyForm.ShowDialog(); if (!string.IsNullOrEmpty(keyForm.KeypadValue)) { cardPassword = keyForm.KeypadValue; } else { continue; } int returnValue = VIPCardTradeService.GetInstance().RefundVipCardPayment(cardNo, cardPassword, tradePayNo); if (returnValue == 0) { result = false; break; } int storeValueId = int.Parse(row.Cells["colStoreValueID"].Value.ToString()); refundPayService.UpdateFixedPayInfo(storeValueId, true); } } if (result) { List <CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList(); if (cardRefundPayList == null || cardRefundPayList.Count == 0) { this.Close(); } else { BindCardRefundPay(cardRefundPayList); } } else { List <CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList(); BindCardRefundPay(cardRefundPayList); MessageBox.Show("退款过程出现错误,请重新操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnRefundPay_Click(object sender, EventArgs e) { bool hasChecked = false; foreach (DataGridViewRow row in this.dataGirdViewExt1.Rows) { hasChecked = Convert.ToBoolean(row.Cells["colCheck"].Value); if (hasChecked) { break; } } if (!hasChecked) { MessageBox.Show("请选择需要进行支付退款操作的卡号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } bool result = true; CardRefundPayService refundPayService = new CardRefundPayService(); foreach (DataGridViewRow row in this.dataGirdViewExt1.Rows) { bool isCheck = Convert.ToBoolean(row.Cells["colCheck"].Value); if (isCheck) { string cardNo = row.Cells["colCardNo"].Value.ToString(); string tradePayNo = row.Cells["colTradePayNo"].Value.ToString(); string cardPassword; //获取卡密码 Feature.FormNumericKeypad keyForm = new Feature.FormNumericKeypad(false); keyForm.DisplayText = string.Format("请输入卡号'{0}'的密码", cardNo); keyForm.IsPassword = true; keyForm.ShowDialog(); if (!string.IsNullOrEmpty(keyForm.KeypadValue)) { cardPassword = keyForm.KeypadValue; } else { continue; } int returnValue = VIPCardTradeService.GetInstance().RefundVipCardPayment(cardNo, cardPassword, tradePayNo); if (returnValue == 0) { result = false; break; } int storeValueId = int.Parse(row.Cells["colStoreValueID"].Value.ToString()); refundPayService.UpdateFixedPayInfo(storeValueId, true); } } if (result) { List<CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList(); if(cardRefundPayList == null || cardRefundPayList.Count == 0) { this.Close(); } else { BindCardRefundPay(cardRefundPayList); } } else { List<CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList(); BindCardRefundPay(cardRefundPayList); MessageBox.Show("退款过程出现错误,请重新操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }