private void butDelete_Click(object sender, EventArgs e) { if (CreditCardCur.IsNew) { DialogResult = DialogResult.Cancel; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Are you sure you want to delete this credit card?")) { return; } #region X-Charge //Delete the archived X-Charge token if (_isXChargeEnabled && CreditCardCur.XChargeToken != "") { if (CreditCardCur.IsXWeb()) { OpenDentBusiness.WebTypes.Shared.XWeb.XWebs.DeleteCreditCard(PatCur.PatNum, CreditCardCur.CreditCardNum); //Also deletes cc from db } else { DeleteXChargeAlias(); } } #endregion CreditCards.Delete(CreditCardCur.CreditCardNum); List <CreditCard> creditCards = CreditCards.Refresh(PatCur.PatNum); for (int i = 0; i < creditCards.Count; i++) { creditCards[i].ItemOrder = creditCards.Count - (i + 1); CreditCards.Update(creditCards[i]); //Resets ItemOrder. } DialogResult = DialogResult.OK; }
///<summary>Performs base XWebInputDTGForPayment behavior and deletes CreditCard row.</summary> protected override void PostProcessOutput(XWebResponse response) { //Verify result and set response.PayNote. base.PostProcessOutput(response); response.Alias = _cc.XChargeToken; try { response.PayNote = "Deleted CreditCard: " + JsonConvert.SerializeObject(_cc); } catch { } CreditCards.Delete(_cc.CreditCardNum); List <CreditCard> creditCards = CreditCards.Refresh(_patNum); for (int i = 0; i < creditCards.Count; i++) { creditCards[i].ItemOrder = creditCards.Count - (i + 1); CreditCards.Update(creditCards[i]); //Resets ItemOrder. } }
private void butDelete_Click(object sender, EventArgs e) { if (CreditCardCur.IsNew) { DialogResult = DialogResult.Cancel; } CreditCards.Delete(CreditCardCur.CreditCardNum); List <CreditCard> creditCards = CreditCards.Refresh(PatCur.PatNum); for (int i = 0; i < creditCards.Count; i++) { creditCards[i].ItemOrder = creditCards.Count - (i + 1); CreditCards.Update(creditCards[i]); //Resets ItemOrder. } DialogResult = DialogResult.OK; }