private CustLoanLostTicketFee getCustLoanObject(string loanNumber) { CustLoanLostTicketFee custLoan = _custLoans.Find(delegate(CustLoanLostTicketFee loanObj) { return(loanObj.LoanNumber == loanNumber); }); return(custLoan); }
private void buttonContinue_Click(object sender, EventArgs e) { //string userId = CashlinxDesktopSession.Instance.UserName; //Get the number of rows in the datagrid where the lost or stolen or destroyed ticket //values are checked //int numRows = 0; List <string> storeNbr = new List <string>(); List <string> tktNumber = new List <string>(); List <string> lsdValue = new List <string>(); foreach (DataGridViewRow dgvr in customDataGridViewPickupLoans.Rows) { customDataGridViewPickupLoans.RowHeadersVisible = false; DataGridViewTextBoxCell loannbrcell = (DataGridViewTextBoxCell)dgvr.Cells[0]; DataGridViewTextBoxCell storenumbercell = (DataGridViewTextBoxCell)dgvr.Cells[5]; DataGridViewRadioButtonCell tktstolencell = (DataGridViewRadioButtonCell)dgvr.Cells[2]; DataGridViewRadioButtonCell tktdestroyedcell = (DataGridViewRadioButtonCell)dgvr.Cells[3]; DataGridViewRadioButtonCell tktlostcell = (DataGridViewRadioButtonCell)dgvr.Cells[1]; if (tktstolencell.CHECKED || tktdestroyedcell.CHECKED || tktlostcell.CHECKED) { //numRows++; storeNbr.Add(storenumbercell.Value.ToString()); tktNumber.Add(loannbrcell.Value.ToString()); CustLoanLostTicketFee custLoanObject = GetCustLoanObject(loannbrcell.Value.ToString()); if (custLoanObject.LoanNumber != null) { custLoanObject.LostTicketFee = _lostFeeAmount; if (tktstolencell.CHECKED) { custLoanObject.LSDTicket = CustLoanLostTicketFee.STOLENTICKETTYPE; lsdValue.Add(CustLoanLostTicketFee.STOLENTICKETTYPE); } else if (tktlostcell.CHECKED) { custLoanObject.LSDTicket = CustLoanLostTicketFee.LOSTTICKETTYPE; lsdValue.Add(CustLoanLostTicketFee.LOSTTICKETTYPE); } else if (tktdestroyedcell.CHECKED) { custLoanObject.LSDTicket = CustLoanLostTicketFee.DESTROYEDTICKETTYPE; lsdValue.Add(CustLoanLostTicketFee.DESTROYEDTICKETTYPE); } } } } Close(); Dispose(true); }
private void buttonCancel_Click(object sender, EventArgs e) { foreach (DataGridViewRow dgvr in customDataGridViewPickupLoans.Rows) { customDataGridViewPickupLoans.RowHeadersVisible = false; DataGridViewTextBoxCell loannbrcell = (DataGridViewTextBoxCell)dgvr.Cells[0]; CustLoanLostTicketFee custLoanObject = GetCustLoanObject(loannbrcell.Value.ToString()); if (custLoanObject.LoanNumber != null) { custLoanObject.LostTicketFee = 0; custLoanObject.TicketLost = false; } } Close(); Dispose(true); }
private void buttonContinue_Click(object sender, EventArgs e) { string errorCode; string errorMsg; string userId = GlobalDataAccessor.Instance.DesktopSession.UserName; //Get the number of rows in the datagrid where the lost or stolen or destroyed ticket //values are checked int numRows = 0; List <string> storeNbr = new List <string>(); List <string> tktNumber = new List <string>(); List <string> lsdValue = new List <string>(); foreach (DataGridViewRow dgvr in dataGridViewPickupLoans.Rows) { dataGridViewPickupLoans.RowHeadersVisible = false; DataGridViewTextBoxCell loannbrcell = (DataGridViewTextBoxCell)dgvr.Cells[0]; DataGridViewTextBoxCell storenumbercell = (DataGridViewTextBoxCell)dgvr.Cells[5]; DataGridViewRadioButtonCell tktstolencell = (DataGridViewRadioButtonCell)dgvr.Cells[2]; DataGridViewRadioButtonCell tktdestroyedcell = (DataGridViewRadioButtonCell)dgvr.Cells[3]; DataGridViewRadioButtonCell tktlostcell = (DataGridViewRadioButtonCell)dgvr.Cells[1]; if (tktstolencell.CHECKED || tktdestroyedcell.CHECKED || tktlostcell.CHECKED) { numRows++; storeNbr.Add(storenumbercell.Value.ToString()); tktNumber.Add(loannbrcell.Value.ToString()); CustLoanLostTicketFee custLoanObject = getCustLoanObject(loannbrcell.Value.ToString()); if (custLoanObject.LoanNumber != null) { custLoanObject.LostTicketFee = lostFeeAmount; if (tktstolencell.CHECKED) { custLoanObject.LSDTicket = CustLoanLostTicketFee.STOLENTICKETTYPE; lsdValue.Add(CustLoanLostTicketFee.STOLENTICKETTYPE); } else if (tktlostcell.CHECKED) { custLoanObject.LSDTicket = CustLoanLostTicketFee.LOSTTICKETTYPE; lsdValue.Add(CustLoanLostTicketFee.LOSTTICKETTYPE); } else if (tktdestroyedcell.CHECKED) { custLoanObject.LSDTicket = CustLoanLostTicketFee.DESTROYEDTICKETTYPE; lsdValue.Add(CustLoanLostTicketFee.DESTROYEDTICKETTYPE); } } } } if (numRows > 0) { string[] storeNumbers = new string[numRows]; int[] ticketNumbers = new int[numRows]; string[] lsdFlag = new string[numRows]; for (int i = 0; i < numRows; i++) { storeNumbers[i] = storeNbr[i]; try { ticketNumbers[i] = Convert.ToInt32(tktNumber[i]); } catch (FormatException) { if (FileLogger.Instance.IsLogDebug) { FileLogger.Instance.logMessage(LogLevel.DEBUG, this, "Ticket number is invalid. Value is " + tktNumber[i]); } throw new ApplicationException("Ticket number is not valid"); } lsdFlag[i] = lsdValue[i]; } DialogResult dgr = DialogResult.Retry; do { bool retValue = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).updatePawnLostTicketFlag(new List <string>(storeNumbers), new List <int>(ticketNumbers), userId, new List <string>(lsdFlag), out errorCode, out errorMsg); if (retValue) { MessageBox.Show("Lost Pawn ticket status successfully updated"); break; } else { dgr = MessageBox.Show(Commons.GetMessageString("ProcessLostTktFeeError"), "Error", MessageBoxButtons.RetryCancel); } } while (dgr == DialogResult.Retry); if (dgr == DialogResult.Cancel) { throw new ApplicationException("Error when updating the database for the ticket to update lost ticket status"); } } this.Close(); this.Dispose(true); }