private int CheckPaymentSplitBill(CashModel item) { int index = -1; try { if (lstPaymentSplitBill.Count > 0) { for (int i = 0; i < lstPaymentSplitBill.Count; i++) { if (lstPaymentSplitBill[i].PaymentTypeID == item.PaymentID) { index = i; } } } } catch (Exception ex) { LogPOS.WriteLog("frmPayMent::::::::CheckPayment::::::::::::::::::::CashModel::::::::::::::::" + ex.Message); } return index; }
private void addPayment(CashModel item) { try { int result = CheckPayment(item); int resulSplit=CheckPaymentSplitBill(item); if (result != -1) { lstPayment[result].Total = lstPayment[result].Total + item.Total; } else { PayMentModel pay = new PayMentModel(); pay.PaymentTypeID = item.PaymentID; pay.Total = item.Total; lstPayment.Add(pay); } ///////////// if (resulSplit != -1) { lstPaymentSplitBill[result].Total = lstPaymentSplitBill[result].Total + item.Total; } else { PayMentModel pay = new PayMentModel(); pay.PaymentTypeID = item.PaymentID; pay.Total = item.Total; lstPaymentSplitBill.Add(pay); } } catch (Exception ex) { LogPOS.WriteLog("frmPayMent::::::::addPayment:::::::::::::::::::::::::::CashModel::::::::::::::::::::::::::" + ex.Message); } }
private void btnCash_Click(object sender, EventArgs e) { try { if (txtTender.Text != string.Empty && Convert.ToDouble(txtTender.Text)>0) { lockTextChange = true; CashModel item = new CashModel(); item.PaymentID = 1; item.Total = Convert.ToDouble(txtTender.Text); addCash(item); addPayment(item); CheckTotal(); lockTextChange = false; } } catch (Exception ex) { LogPOS.WriteLog("frmPayMent::::::btnCash_Click:::::::::::::::::::::::::::::::::::" + ex.Message); } }
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); }