private void addCash(CashModel item) { UCAllPayMent ucPayment = new UCAllPayMent(); item.PaymentID = 1; ucPayment.lblStt.Text = "#" + CountUcPayMent().ToString(); ucPayment.lblMethodType.Text = btnCash.Text; ucPayment.lblTotal.Text = "$" + money.Format2(item.Total * 1000); ucPayment.Tag = item; ucPayment.Click += ucPayment_Click; flpPaymentType.Controls.Add(ucPayment); }
void ucPayment_Click(object sender, EventArgs e) { UCAllPayMent ucCash = (UCAllPayMent)sender; try { CashModel data = (CashModel)ucCash.Tag; for (int i = 0; i < lstPayment.Count; i++) { if (lstPayment[i].PaymentTypeID == data.PaymentID) { lstPayment[i].Total = lstPayment[i].Total - data.Total; } } flpPaymentType.Controls.Remove(ucCash); RemoveUc = true; CheckTotal(); } catch (Exception ex) { LogPOS.WriteLog("frmPayment:::::::::::::::::::::ucPayment_Click::::::::::::::::::::::" + ex.Message); } }