private void addCard(CardModel item) { try { UCPaymentCard ucCard = new UCPaymentCard(); item.PayMenyID = 2; ucCard.lblStt.Text = "#" + CountUcPayMent().ToString(); ucCard.lblMethodType.Text = item.CardName; ucCard.lblTotal.Text = "$" + money.Format2(item.SubTotal * 1000); ucCard.Tag = item; ucCard.Click += ucCard_Click; flpPaymentType.Controls.Add(ucCard); } catch (Exception ex) { LogPOS.WriteLog("frmPayment::::::::::::::::::::::::::::addCard::::::::::::::::::::" + ex.Message); } }
void ucCard_Click(object sender, EventArgs e) { UCPaymentCard ucCard = (UCPaymentCard)sender; try { CardModel data = (CardModel)ucCard.Tag; for (int i = 0; i < lstPayment.Count; i++) { if (lstPayment[i].PaymentTypeID == data.PayMenyID) { lstPayment[i].Total = lstPayment[i].Total - data.SubTotal; } } flpPaymentType.Controls.Remove(ucCard); RemoveUc = true; CheckTotal(); } catch (Exception ex) { LogPOS.WriteLog("frmPayment:::::::::::::::::::::ucCard_Click::::::::::::::::::::::" + ex.Message); } }