private bool doNameCheck() { DataTable custDatatable = new DataTable(); bool retValue = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).CheckDuplicateNameDOB(_strFirstName, _strLastName, _strDob, out custDatatable, out _errorCode, out _errorMsg); if (retValue) { return(custDatatable != null && custDatatable.Rows.Count > 0); } else { throw new ApplicationException("Call to check duplicate name and dob failed"); } }
private bool checkIDDuplicates() { bool checkDuplicates = false; for (int i = 0; i < strIdType.Length; i++) { strIdentTypeCode = strIdType[i]; strIdentNumber = strIdNumber[i]; strIdentIssuer = strIdIssuerCode[i]; var errorCode = string.Empty; var errorMsg = string.Empty; DataTable custDatatable; bool b = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).CheckDuplicateID(strIdentTypeCode, strIdentNumber, strIdentIssuer, out custDatatable, out errorCode, out errorMsg); if (b) { //call to duplicate id check yielded records which means there are users that match the ID if (custDatatable != null && custDatatable.Rows.Count > 0) { errorMessage = new StringBuilder(); errorMessage.Append(Commons.GetMessageString("DuplicateIDMessage")); errorMessage.Append(" <"); errorMessage.Append(strIdentTypeCode); errorMessage.Append(","); errorMessage.Append(strIdentIssuer); errorMessage.Append(","); errorMessage.Append(strIdentNumber); errorMessage.Append(">"); checkDuplicates = true; break; } else { //remove break so that loop will execute checkDuplicates = false; //break; } } else { throw new ApplicationException("An error occurred in the stored procedure call"); } } return(checkDuplicates); }
private bool checkNameDOBDuplicates() { DataTable custDatatable = new DataTable(); var errorCode = string.Empty; var errorMsg = string.Empty; bool b = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).CheckDuplicateNameDOB(strFirstName, strLastName, strDOB, out custDatatable, out errorCode, out errorMsg); if (b) { if (custDatatable != null && custDatatable.Rows.Count > 0) { errorMessage = new StringBuilder(); errorMessage.Append(Commons.GetMessageString("DuplicateNameMessage")); return(true); } } else { throw new ApplicationException("An error occurred in the stored procedure call"); } return(false); }
private void buttonSubmit_Click(object sender, EventArgs e) { int i = 0; if (this.identification1.isValid()) { List <IdentificationVO> customerIds = this.identification1.getIdentificationData(); if (customerIds != null) { _numRows = customerIds.Count; //Array inputs _strIdType = new string[_numRows]; _strIdIssuer = new string[_numRows]; _strIdNumber = new string[_numRows]; _strIdExpiryDate = new string[_numRows]; _strIdentId = new string[_numRows]; _strIdIssuerCode = new string[_numRows]; _strIdTypeDesc = new string[_numRows]; _strIdIssueDate = new string[_numRows]; foreach (IdentificationVO id in customerIds) { _strIdTypeDesc[i] = id.DatedIdentDesc; _strIdType[i] = id.IdType; _strIdIssuer[i] = id.IdIssuer; _strIdNumber[i] = id.IdValue; _strIdIssuerCode[i] = id.IdIssuerCode; _strIdIssueDate[i] = id.IdIssueDate.FormatDate(); _strIdExpiryDate[i] = id.IdExpiryData.FormatDate(); _strIdentId[i] = id.IdentId; i++; } } else { //no id data return; } } else { //id data is invalid return; } string strUserId = GlobalDataAccessor.Instance.DesktopSession.UserName; _updatedIds = new List <IdentificationVO>(); _partyId = _custToEdit.PartyId; if (i > 0) { try { if (identDataChanged()) { bool updateIdData = true; DialogResult dgr; do { _strUpdatedIdType = new string[_updatedIds.Count]; _strUpdatedIdNumber = new string[_updatedIds.Count]; _strUpdatedIdIssuer = new string[_updatedIds.Count]; _strUpdatedIdExpiryDate = new string[_updatedIds.Count]; _strUpdatedIdentId = new string[_updatedIds.Count]; int k = 0; foreach (IdentificationVO id in _updatedIds) { _strUpdatedIdType[k] = id.IdType; _strUpdatedIdNumber[k] = id.IdValue; _strUpdatedIdIssuer[k] = id.IdIssuerCode; _strUpdatedIdExpiryDate[k] = id.IdExpiryData == DateTime.MaxValue ? "" : id.IdExpiryData.ToShortDateString(); _strUpdatedIdentId[k] = id.IdentId; k++; } var errorCode = string.Empty; var errorMsg = string.Empty; updateIdData = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdateCustomerPersonalIdentifications(strUserId, _partyId, _strUpdatedIdNumber, _strUpdatedIdExpiryDate, _strUpdatedIdIssuer, _strUpdatedIdType, _strUpdatedIdentId, out _custIdentities, out errorCode, out errorMsg); if (updateIdData) { MessageBox.Show("Customer Identification update successful"); //Load id data returned from the sp call into the customer object LoadIDDataInObject(); Form ownerForm = this.Owner; if (ownerForm.GetType() == typeof(ViewCustomerInformation)) { var custInfoFrm = (ViewCustomerInformation)ownerForm; custInfoFrm.UpdatedCustomerToView = _updatedCustomer; custInfoFrm.ShowUpdates = true; } break; } else { dgr = MessageBox.Show(Commons.GetMessageString("CustIdentUpdateFailure"), "Error", MessageBoxButtons.RetryCancel); } } while (dgr == DialogResult.Retry); } else { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } } catch (ApplicationException aEx) { //This means there was a duplicate ID error //and the ID belongs to another customer if (aEx.Message == "-1") { return; } else { //This means that a new ID was entered which already //exists for this customer MessageBox.Show(aEx.Message); return; } } this.Close(); this.Dispose(true); } else { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } }
private bool identDataChanged() { _custIds = new List <IdentificationVO>(); DataTable custDatatable; for (int i = 0; i < _strIdType.Length; i++) { IdentificationVO custIdObj = _custToEdit.getIdentity(_strIdType[i], _strIdNumber[i], _strIdIssuer[i]); IdentificationVO identobj = _custToEdit.getIdentity(_strIdType[i], _strIdNumber[i], _strIdIssuerCode[i], _strIdExpiryDate[i]); if (identobj == null) { string strIdentTypeCode = _strIdType[i]; string strIdentNumber = _strIdNumber[i]; string strIdentIssuer = _strIdIssuerCode[i]; //do the id check if the expiry date is not the only change if (custIdObj == null) { string errorCode; string errorMsg; bool retValue = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).CheckDuplicateID(strIdentTypeCode, strIdentNumber, strIdentIssuer, out custDatatable, out errorCode, out errorMsg); if (retValue) { if (custDatatable != null) //call to duplicate id check yielded records which means there are users that match the ID { if (custDatatable.Rows.Count > 0) { StringBuilder errorMessage = new StringBuilder(); errorMessage.Append(Commons.GetMessageString("DuplicateIDMessage")); errorMessage.Append(" <"); errorMessage.Append(strIdentTypeCode); errorMessage.Append(","); errorMessage.Append(strIdentIssuer); errorMessage.Append(","); errorMessage.Append(strIdentNumber); errorMessage.Append(">"); MessageBox.Show(errorMessage.ToString(), "Error"); throw new ApplicationException("-1"); } } } else { //If it is fatal error from the database, it would have been handled at the oracledataaccessor layer FileLogger.Instance.logMessage(LogLevel.ERROR, this, errorMsg); } } else { if (i >= _custToEdit.NumberIdentities && (custIdObj.IdExpiryData).FormatDate() != _strIdExpiryDate[i]) { //no duplicate ID check needed since the user has entered an ID which is the same //as another ID that exists for the customer but only the expiry date is different //This scenario is only when the user enters a brand new row with the exact same ID //as another id for the same user but enters a different expiry date StringBuilder errorMessage = new StringBuilder(); errorMessage.Append(Commons.GetMessageString("DuplicateIDSameCustomerDiffExpiryDt")); errorMessage.Append(System.Environment.NewLine + " <"); errorMessage.Append(strIdentTypeCode); errorMessage.Append(","); errorMessage.Append(strIdentIssuer); errorMessage.Append(","); errorMessage.Append(strIdentNumber); errorMessage.Append(">"); throw new ApplicationException(errorMessage.ToString()); } } IdentificationVO newid = new IdentificationVO(); newid.IdType = _strIdType[i]; newid.IdValue = _strIdNumber[i]; newid.IdIssuer = _strIdIssuer[i]; try { newid.IdExpiryData = DateTime.Parse(_strIdExpiryDate[i], CultureInfo.InvariantCulture); } catch (Exception) { newid.IdExpiryData = DateTime.MaxValue; } newid.IdentId = _strIdentId[i]; newid.DatedIdentDesc = _strIdTypeDesc[i]; newid.IdIssuerCode = _strIdIssuerCode[i]; _updatedIds.Add(newid); _custIds.Add(newid); } else { //The same ID already exists for the customer..check to see //if this was entered as a new row in the datagrid if (i >= _custToEdit.NumberIdentities) { throw new ApplicationException(Commons.GetMessageString("DuplicateIDSameCustomer")); } else { _custIds.Add(identobj); } } } if (_updatedIds.Count == 0) { return(false); } else { return(true); } }
/*__________________________________________________________________________________________*/ private void buttonSubmit_Click(object sender, EventArgs e) { int i = 0; if (this.identification1.isValid()) { List <IdentificationVO> customerIds = this.identification1.getIdentificationData(); if (customerIds != null) { _numRows = customerIds.Count; //Array inputs _strIdType = new string[_numRows]; _strIdIssuer = new string[_numRows]; _strIdNumber = new string[_numRows]; _strIdExpiryDate = new string[_numRows]; _strIdentId = new string[_numRows]; _strIdIssuerCode = new string[_numRows]; _strIdTypeDesc = new string[_numRows]; _strIdIssueDate = new string[_numRows]; foreach (IdentificationVO id in customerIds) { _strIdTypeDesc[i] = id.DatedIdentDesc; _strIdType[i] = id.IdType; _strIdIssuer[i] = id.IdIssuer; _strIdNumber[i] = id.IdValue; _strIdIssuerCode[i] = id.IdIssuerCode; _strIdIssueDate[i] = id.IdIssueDate.FormatDate(); _strIdExpiryDate[i] = id.IdExpiryData.FormatDate(); _strIdentId[i] = id.IdentId; i++; } } else { //no id data return; } } else { //id data is invalid return; } string strUserId = GlobalDataAccessor.Instance.DesktopSession.UserName; _updatedIds = new List <IdentificationVO>(); _partyId = _custToEdit.PartyId; if (i > 0) { try { if (identDataChanged()) { bool updateIdData = true; DialogResult dgr; do { _strUpdatedIdType = new string[_updatedIds.Count]; _strUpdatedIdNumber = new string[_updatedIds.Count]; _strUpdatedIdIssuer = new string[_updatedIds.Count]; _strUpdatedIdExpiryDate = new string[_updatedIds.Count]; _strUpdatedIdentId = new string[_updatedIds.Count]; int k = 0; foreach (IdentificationVO id in _updatedIds) { _strUpdatedIdType[k] = id.IdType; _strUpdatedIdNumber[k] = id.IdValue; _strUpdatedIdIssuer[k] = id.IdIssuerCode; _strUpdatedIdExpiryDate[k] = id.IdExpiryData == DateTime.MaxValue ? "" : id.IdExpiryData.ToShortDateString(); _strUpdatedIdentId[k] = id.IdentId; k++; } var errorCode = string.Empty; var errorMsg = string.Empty; updateIdData = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdateCustomerPersonalIdentifications(strUserId, _partyId, _strUpdatedIdNumber, _strUpdatedIdExpiryDate, _strUpdatedIdIssuer, _strUpdatedIdType, _strUpdatedIdentId, out _custIdentities, out errorCode, out errorMsg); if (updateIdData) { MessageBox.Show("Customer Identification update successful"); //Load id data returned from the sp call into the customer object //LoadIDDataInObject(); //Form ownerForm = this.Owner; //Console.WriteLine("ownerForm.GetType() -->" + ownerForm.GetType()); //if (ownerForm.GetType() == typeof(ViewCustomerInformation)) { //var custInfoFrm = (ViewCustomerInformation)ownerForm; /* * DataTable custDatatable = new DataTable(); * DataTable custPhoneDatatable = new DataTable(); * DataTable custIdentDatatable = new DataTable(); * DataTable custAddrDatatable = new DataTable(); * DataTable custEmailDatatable = new DataTable(); * DataTable custNotesDatatable = new DataTable(); * DataTable custStoreCreditDatatable = new DataTable(); * * Support.Controllers.Database.Procedures.CustomerDBProcedures customerDBProceduresForSupport * = new Support.Controllers.Database.Procedures.CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession); * * bool b = customerDBProceduresForSupport.ExecuteLSupporApptookupCustomer( * "", "", "", "", _updatedCustomer.CustomerNumber, "", "", "", "", "", "", "", "", "", "", "", "CUST_INFO", out custDatatable, out custIdentDatatable, out custPhoneDatatable, * out custAddrDatatable, out custEmailDatatable, out custNotesDatatable, out custStoreCreditDatatable, out errorCode, out errorMsg); * * if (b) * { * _custIdentities = custIdentDatatable; * Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer = _updatedCustomer; * LoadIDDataInObject(); * } */ //custInfoFrm.UpdatedCustomerToView = _updatedCustomer; //custInfoFrm.ShowUpdates = true; LoadIDDataInObject(); } break; } else { dgr = MessageBox.Show(Commons.GetMessageString("CustIdentUpdateFailure"), "Error", MessageBoxButtons.RetryCancel); } } while (dgr == DialogResult.Retry); } else { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } } catch (ApplicationException aEx) { //This means there was a duplicate ID error //and the ID belongs to another customer if (aEx.Message == "-1") { return; } else { //This means that a new ID was entered which already //exists for this customer MessageBox.Show(aEx.Message); return; } } this.NavControlBox.IsCustom = true; this.NavControlBox.CustomDetail = "ViewCustomerInformationReadOnly"; this.NavControlBox.Action = NavBox.NavAction.BACK; //this.Close(); //this.Dispose(true); } else { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } }
private void Setup() { DataSet dsCustStats = new DataSet(); string errorCode; string errorText; bool bRetValue; //Save the stats data in session until the user wishes to cancel out of the screen //including any of the tabs or when the user does not wish to continue with the same //customer so that we do not call the SP multiple times in the same session //if not needed. //string fromdate = ShopDateTime.Instance.ShopDate.AddMonths(-6).ToShortDateString(); string todate = ShopDateTime.Instance.ShopDate.ToShortDateString(); dsCustStats = GlobalDataAccessor.Instance.DesktopSession.CustStatsDataSet; Sts_StatisticsLabel.Text = "Customer Statistics as of " + todate; custNumber = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber; if (dsCustStats == null) { bRetValue = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).GetCustomerStatsData( GlobalDataAccessor.Instance.OracleDA, custNumber, out dsCustStats, out errorCode, out errorText); if (bRetValue && dsCustStats != null) { GlobalDataAccessor.Instance.DesktopSession.CustStatsDataSet = dsCustStats; } } else { bRetValue = true; } if (bRetValue) { //Sts_StoreCreditAvailablePanel.Visible = false; Customer_Since = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerSince; Sts_General_CustomerSinceLabel.Text = "Customer Since: " + Customer_Since.Year; Sts_creditAsOfLabel.Text = string.Format("Store Credit as of: {0:g}", DateTime.Now); if (dsCustStats != null) { // CheckBox for Store credit DataTable outputDt = dsCustStats.Tables["OUTPUT"]; if (outputDt != null && outputDt.IsInitialized && outputDt.Rows != null && outputDt.Rows.Count > 0) { DataRow dr = outputDt.Rows[0]; if (dr != null && dr.ItemArray.Length > 0) { string storeCredit_obj = dr.Field <string> (1); if (storeCredit_obj != "null") { Sts_StoreCreditAvailablePanel.Visible = true; Amount_StoreCreditAvailable = decimal.Parse(storeCredit_obj); } } } if (dsCustStats.Tables["customer_stats"] == null) { MessageBox.Show("No stats returned for Current Customer.", "Customer Loan Lookup"); //Sts_PawnLoanPanel.Visible = false; //Sts_BuysPanel.Visible = false; //Sts_LayAwaysPanel.Visible = false; //Sts_PawnLoanPanel.Visible = false; //Sts_SalesPanel.Visible = false; //panel3.Visible = false; } else { DataTable custData = dsCustStats.Tables[0]; Sts_StatisticsLabel.Text = "Customer Statistics as of " + custData.Rows[0].Field <DateTime>("LASTUPDATEDATE").ToShortDateString(); Number_Loans = Utilities.GetIntegerValue(custData.Rows[0]["loan_count"], 0); Amount_Loans = Utilities.GetDecimalValue(custData.Rows[0]["loan_amount"], 0); Number_LoansInPawn = Utilities.GetIntegerValue(custData.Rows[0]["loans_ip_count"], 0); Amount_LoansInPawn = Utilities.GetDecimalValue(custData.Rows[0]["loans_ip_amount"], 0); //Buy data Number_Buys = Utilities.GetIntegerValue(custData.Rows[0]["purchase_count"], 0); Amount_Buys = Utilities.GetDecimalValue(custData.Rows[0]["purchase_amount"], 0); //Police Seized Loans Data Number_LoansPoliceSeized = Utilities.GetIntegerValue(custData.Rows[0]["seize_count"], 0); Amount_LoansPoliceSeized = Utilities.GetDecimalValue(custData.Rows[0]["seize_amount"], 0); //Total fees paid by the customer when they did extension,pickup,renewal and paydown plus //the amount of the loans picked up Amount_PawnServiceCharges = Utilities.GetDecimalValue(custData.Rows[0]["pawn_svc_charges"], 0); PCT_LoanPick = Utilities.GetDecimalValue(custData.Rows[0]["loan_pu_pct"]); PCT_LoanPickJewelry = Utilities.GetDecimalValue(custData.Rows[0]["loan_pu_pct_jew"]); PCT_LoanPickUpGenMerchandise = Utilities.GetDecimalValue(custData.Rows[0]["loan_pu_pct_gen"]); //Sales Data Number_Sales = Utilities.GetIntegerValue(custData.Rows[0]["sales_count"], 0); Amount_Sales = Utilities.GetDecimalValue(custData.Rows[0]["sales_amount"], 0); //Refund Data Number_Refunds = Utilities.GetIntegerValue(custData.Rows[0]["refund_count"], 0); Amount_Refunds = Utilities.GetDecimalValue(custData.Rows[0]["refund_amount"], 0); //Discount percentages PCT_AverageDiscount = Utilities.GetDecimalValue(custData.Rows[0]["cust_avg_disc_pct"], 0); Cust_Overall_PCT = Utilities.GetDecimalValue(custData.Rows[0]["cust_ovl_gp_pct"], 0); //Layaway data Number_ActiveLayAways = Utilities.GetIntegerValue(custData.Rows[0]["layaway_count"], 0); Amount_ActiveLayAways = Utilities.GetDecimalValue(custData.Rows[0]["layaway_amount"], 0); Number_PaidLayAways = Utilities.GetIntegerValue(custData.Rows[0]["layaway_paid_count"], 0); Amount_PaidLayAways = Utilities.GetDecimalValue(custData.Rows[0]["layaway_paid_amount"], 0); //store credit Amount_StoreCreditAvailable = Utilities.GetDecimalValue(custData.Rows[0]["store_credit"], 0); } labelLoansNumber.Text = String.Format("{0}", Number_Loans); labelLoansAmount.Text = String.Format("{0:0.00}", Amount_Loans); labelLoansInPawnNumber.Text = String.Format("{0}", Number_LoansInPawn); labelLoansInPawnAmount.Text = String.Format("{0:0.00}", Amount_LoansInPawn); labelSeizeNumber.Text = String.Format("{0}", Number_LoansPoliceSeized); labelSeizeAmount.Text = String.Format("{0:0.00}", Amount_LoansPoliceSeized); labelPawnSVCChargesPaid.Text = String.Format("{0:0.00}", Amount_PawnServiceCharges); labelLoansPUPct.Text = String.Format("{0:0.00%}", PCT_LoanPick); labelLoansPUPctJewel.Text = String.Format("{0:0.00%}", PCT_LoanPickJewelry); labelLoansPUPctGenMdse.Text = String.Format("{0:0.00%}", PCT_LoanPickUpGenMerchandise); labelBuyNumber.Text = String.Format("{0}", Number_Buys); labelBuyAmount.Text = String.Format("{0:0.00}", Amount_Buys); labelSalesNumber.Text = String.Format("{0}", Number_Sales); labelSalesAmount.Text = String.Format("{0:0.00}", Amount_Sales); labelRefundNumber.Text = String.Format("{0}", Number_Refunds); labelRefundAmount.Text = String.Format("{0:0.00}", Amount_Refunds); labelAvgDiscPct.Text = String.Format("{0:0.00%}", PCT_AverageDiscount); labelCustOverallGPPCT.Text = String.Format("{0:0.00%}", Cust_Overall_PCT); labelActiveLayawayNumber.Text = String.Format("{0}", Number_ActiveLayAways); labelActiveLayawayAmount.Text = String.Format("{0:0.00}", Amount_ActiveLayAways); labelPaidLayawayNumber.Text = String.Format("{0}", Number_PaidLayAways); labelPaidLayawayAmount.Text = String.Format("{0:0.00}", Amount_PaidLayAways); labelStoreCreditAmountAvail.Text = String.Format("{0:0.00}", Amount_StoreCreditAvailable); } } }
private void buttonSubmit_Click(object sender, EventArgs e) { DialogResult dgr; checkDateOfBirth(); if (custDateOfBirth.isValid) { checkReqFields(); if (_isFormValid) { bool retValue = false; getFormData(); if (custInfoChanged()) { /* ***** * ***** Skip duplicate check. Refer to Bugzilla #117 * ***** (http://192.168.106.16/bugzilla/show_bug.cgi?id=117) * ***** * //If name and dob is changed check to see if there are * //any other customers in the system with the same information * if (_nameChanged || _dobChanged) * { * if (doNameCheck()) * { * //if there are duplicate customers, show the error message and let the user * //decide whether they would like to continue with the change or not * dgr = MessageBox.Show(Commons.GetMessageString("DuplicateNameMessage"), "Warning", MessageBoxButtons.YesNo); * if (dgr == DialogResult.No) * return; * } * } ***** */ try { do { retValue = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdatePersonalInfoDetails(_strTitle, _strFirstName, _strMiddleName, _strLastName, _strTitleSuffix, _strLanguage, _strDob, _strSsn, _strUserId, _partyId, out _errorCode, out _errorMsg); if (retValue) { MessageBox.Show("Customer information updated"); CustomerVO updatedCustomer = new CustomerVO { FirstName = _strFirstName, MiddleInitial = _strMiddleName, LastName = _strLastName, DateOfBirth = _dateOfBirth, CustTitle = _strTitle, CustTitleSuffix = _strTitleSuffix, NegotiationLanguage = _strLanguage, SocialSecurityNumber = _strSsn }; updatedCustomer.Age = _age != 0 ? _age : _custToEdit.Age; Form ownerForm = this.Owner; if (ownerForm.GetType() == typeof(ViewCustomerInformation)) { ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = updatedCustomer; ((ViewCustomerInformation)ownerForm).ShowUpdates = true; } updatedCustomer = null; break; } else { dgr = _errorCode.Equals("1") ? MessageBox.Show(Commons.GetMessageString("DuplicateSSNMessage"), "Warning", MessageBoxButtons.OK) : MessageBox.Show(Commons.GetMessageString("CustPersInfoUpdateFailure"), "Error", MessageBoxButtons.RetryCancel); } } while (dgr == DialogResult.Retry); if (_errorCode.Equals("1")) { return; } } catch (ApplicationException aEx) { //exception already handled at the oracledataaccessor level MessageBox.Show(aEx.Message); } } else { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } this.Close(); this.Dispose(true); } else { MessageBox.Show(Commons.GetMessageString("FormRequiredFieldsFilledError")); } } else { MessageBox.Show(Commons.GetMessageString("FormRequiredFieldsFilledError")); } }
private void buttonSubmit_Click(object sender, EventArgs e) { bool newCustCreated = false; var partyId = string.Empty; var custNumber = string.Empty; bool updatePhysData = false; if (isFormValid()) { getFormData(); if (string.IsNullOrEmpty(CustToView.PartyId) || physDescDataChanged()) { _strUserId = GlobalDataAccessor.Instance.DesktopSession.UserName; _strStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; _strCustNumber = CustToView.CustomerNumber; DateTime noteDate = ShopDateTime.Instance.ShopDate; DialogResult dgr = DialogResult.Retry; bool retVal = false; var errorDesc = string.Empty; //The following is true when this form is called in the Manage customer use case if (CustToView.PartyId == string.Empty) { do { retVal = CustomerProcedures.AddCustomer(GlobalDataAccessor.Instance.DesktopSession, CustToView, _strUserId, _strStoreNumber, out custNumber, out partyId, out errorDesc); if (retVal) { break; } else { dgr = MessageBox.Show(Commons.GetMessageString("CustDataAddFailure"), "Error", MessageBoxButtons.RetryCancel); } }while (dgr == DialogResult.Retry); if (retVal) { newCustCreated = true; _strCustNumber = custNumber; CustToView.CustomerNumber = _strCustNumber; CustToView.PartyId = partyId; do { retVal = CustomerProcedures.AddCustomerAddress(GlobalDataAccessor.Instance.DesktopSession, CustToView, _strUserId, _strStoreNumber); if (retVal) { break; } else { dgr = MessageBox.Show(Commons.GetMessageString("CustDataAddFailure"), "Error", MessageBoxButtons.RetryCancel); } }while (dgr == DialogResult.Retry); } else { //the call to add customer failed and the user pressed cancel when asked //if they would like to keep trying so go to desktop //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.CANCEL; //CustomerController.NavigateUser(ownerFrm); NavControlBox.Action = NavBox.NavAction.CANCEL; } } else { retVal = true; } if (retVal) { do { updatePhysData = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdateCustPhysicalDescription(_strRace, _strGender, _strHairColor, _strEyeColor, _strHeight, _strWeight, _strUserId, CustToView.PartyId, _strCustNumber, _strOthers, _strContactProductNoteId, _strStoreNumber, out _strNewContactProductNoteId, out _errorCode, out _errorMsg); if (updatePhysData) { Form ownerForm = this.Owner; if (ownerForm.GetType() == typeof(ViewCustomerInformation)) { CustomerVO updatedCustomer = new CustomerVO(); updatedCustomer.addNotes(CustToView.getPhysicalDescNote()); updatedCustomer.Race = _strRace; updatedCustomer.Gender = _strGender; updatedCustomer.HairColor = _strHairColor; updatedCustomer.EyeColor = _strEyeColor; updatedCustomer.Height = _strHeight; if (_strNewContactProductNoteId.Equals(string.Empty)) { _strNewContactProductNoteId = _strContactProductNoteId; } try { updatedCustomer.Weight = Convert.ToInt32(_strWeight); } catch (Exception) { updatedCustomer.Weight = 0; } updatedCustomer.updatePhysicalDescNote(_strOthers, _strStoreNumber, noteDate, _strUserId, _strNewContactProductNoteId); ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = updatedCustomer; ((ViewCustomerInformation)ownerForm).ShowUpdates = true; } break; } else { dgr = MessageBox.Show(Commons.GetMessageString("CustPhysicalDescUpdateFailure"), "Error", MessageBoxButtons.RetryCancel); } }while (dgr == DialogResult.Retry); } else { //Adding customer address was a failure and the user pressed cancel when asked //if they would like to retry so take them to desktop //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.CANCEL; //CustomerController.NavigateUser(ownerFrm); NavControlBox.Action = NavBox.NavAction.CANCEL; } } else if (CustToView.PartyId != string.Empty) { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } } else { MessageBox.Show(Commons.GetMessageString("FormRequiredFieldsFilledError")); return; } if (newCustCreated) { MessageBox.Show(Commons.GetMessageString("CustCreationSuccess") + " " + custNumber); CustomerVO customerObj = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, custNumber); if (customerObj != null) { GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; } //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.ADDCUSTOMERCOMPLETE; //CustomerController.NavigateUser(ownerFrm); NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; } else { if (updatePhysData) { MessageBox.Show("Physical details updated"); } this.Close(); this.Dispose(true); } }
private void buttonSubmit_Click(object sender, EventArgs e) { string strIdentNumber = customTextBoxCWPNumber.Text; Boolean cancelSubmit = false; //BZ # 753 //if (!_retailFirearmCheck && !customTextBoxRefNumber.isValid) if (!_retailFirearmCheck && !customTextBoxRefNumber.isValid && string.IsNullOrEmpty(strIdentNumber)) { MessageBox.Show(@"Background reference number must be entered"); return; } if (!checkExpDate()) { this.dateCWP.Focus(); return; } //store the background ref check number in the customer object _currentCustomer.BackgroundCheckRefNumber = customTextBoxRefNumber.Text; //store the CWP data against the customer if he did not already //have a cwp and if they entered CWP data in the form ComboBox statelist = (ComboBox)stateCWP.Controls[0]; string cwpIssuerState = statelist.GetItemText(statelist.SelectedItem); string cwpIssuerStateName = statelist.SelectedValue.ToString(); string strIdentExpiryDate = dateCWP.Controls[0].Text; if (strIdentExpiryDate.Equals("mm/dd/yyyy")) { strIdentExpiryDate = string.Empty; } string strIdentTypeCode = CustomerIdTypes.CW.ToString(); IdentificationVO custCWPID = new IdentificationVO(); string storeState = CashlinxDesktopSession.Instance.CurrentSiteId.State; if (_currentCustomer.HasValidConcealedWeaponsPermitInState(storeState, ShopDateTime.Instance.ShopDate)) { custCWPID = _currentCustomer.getIdByTypeandIssuer(CustomerIdTypes.CW.ToString(), storeState); } if (!string.IsNullOrEmpty(custCWPID.IdValue.Trim())) { _idCwpExists = true; //idExpDate = custCWPID.IdExpiryData.Date != DateTime.MaxValue.Date ? custCWPID.IdExpiryData.FormatDate() : string.Empty; //idIssuer = custCWPID.IdIssuerCode; } decimal backgroundCheckFee; if (_retailFirearmCheck || _layawayFirearmCheck) { //Check if ident number and issuer and expiry date is entered if reference number was not entered if (!customTextBoxRefNumber.isValid && (strIdentNumber.Equals(string.Empty) || cwpIssuerState.Equals("Select One") || strIdentExpiryDate == string.Empty || strIdentExpiryDate == string.Empty)) { if (!IsBackgroundCheckRequired) { MessageBox.Show("Either Background reference number or all CWP data should be entered"); return; } else { MessageBox.Show("Background reference number should be entered"); return; } } else if (_layawayFirearmCheck) { //if (!decimal.TryParse(customTextBoxBackgroundCheckFee.Text, out backgroundCheckFee) || backgroundCheckFee < 0) bool formatSuccess = Commons.FormatStringAsDecimal(customTextBoxBackgroundCheckFee.Text, out backgroundCheckFee); //BZ # 503 if (formatSuccess) { if (backgroundCheckFee <= 0.0m) { string msg = "Back ground Check Fee amount is less or equal to zero. Is that okay?"; DialogResult dgr = MessageBox.Show(msg, "Back ground Check Fee equals zero", MessageBoxButtons.YesNo); if (dgr == DialogResult.No) { return; } } else { CashlinxDesktopSession.Instance.BackgroundCheckFeeValue = backgroundCheckFee; } } else { MessageBox.Show("Invalid background check fee"); return; } //BZ # 503 end } else { CashlinxDesktopSession.Instance.BackgroundCheckFeeValue = 0M; } } else { if ((!customTextBoxRefNumber.isValid) && (strIdentNumber.Equals(string.Empty) || cwpIssuerState.Equals("Select One"))) { if (!IsBackgroundCheckRequired) { MessageBox.Show("Either Background reference number or all CWP data should be entered"); return; } else { MessageBox.Show("Background reference number should be entered"); return; } } CashlinxDesktopSession.Instance.BackgroundCheckFeeValue = 0M; } if ((!customTextBoxRefNumber.isValid) && !IsBackgroundCheckRequired && _currentCustomer.HasConcealedWeaponsPermit()) { //check to see if the object has been populated with data. if (custCWPID.IdExpiryData == DateTime.MaxValue) { custCWPID = _currentCustomer.getAllIdentifications().Where(i => i.IdType == CustomerIdTypes.CW.ToString()).FirstOrDefault(); } if (strIdentNumber.Trim() != custCWPID.IdValue.Trim() || cwpIssuerState != custCWPID.IdIssuerCode) { DialogResult dgr = MessageBox.Show("This customer has the following CWP on file: " + custCWPID.IdIssuerCode + "-" + custCWPID.IdValue + ". If you continue, the CWP you entered will replace the one on file.", "Concealed Weapons Permit Already Exists", MessageBoxButtons.YesNo); if (dgr == DialogResult.No) { return; } } } //Check if the ID is a new id entered in this form or it already exists //for the customer //Add to the database only if its a new id if (!string.IsNullOrEmpty(strIdentNumber) && !cwpIssuerState.Equals("Select One")) { IdentificationVO custIdInfo = _currentCustomer.getIdentity(CustomerIdTypes.CW.ToString(), strIdentNumber, cwpIssuerState, strIdentExpiryDate); if (custIdInfo == null) { DialogResult dgr; do { string strUserId = CashlinxDesktopSession.Instance.UserName; string errorMsg = string.Empty; string errorCode = string.Empty; bool updateIdData = new CustomerDBProcedures(CashlinxDesktopSession.Instance).UpdateCustPersonalIdentification(_currentCustomer.PartyId, strIdentNumber, strIdentExpiryDate, strIdentTypeCode, cwpIssuerState, strUserId, out errorCode, out errorMsg); if (updateIdData) { IdentificationVO newCustId = new IdentificationVO { IdType = strIdentTypeCode, IdValue = strIdentNumber, IdIssuerCode = cwpIssuerState, IdIssuer = cwpIssuerStateName, DatedIdentDesc = StateIdTypeDescription.CW.ToString(), IdExpiryData = Utilities.GetDateTimeValue(strIdentExpiryDate, DateTime.MaxValue) }; _currentCustomer.addIdentity(newCustId); break; } dgr = MessageBox.Show(Commons.GetMessageString("CustIdentUpdateFailure"), "Error", MessageBoxButtons.RetryCancel); } while (dgr == DialogResult.Retry); } } //If the user cancelled retrying to update the db when it failed //continue since the CWP can always be added later for the customer and do //not have to stop the pickup flow for it GlobalDataAccessor.Instance.DesktopSession.BackgroundCheckCompleted = true; GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = _currentCustomer; Close(); }
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); }
private void buttonSubmit_Click(object sender, EventArgs e) { if (userCanEdit) { //Number of rows int numRows = customDataGridViewComments.Rows.Count; //Array inputs _strComments = new string[numRows]; _strCustProdNoteId = new string[numRows]; //Get the values from each row int j = 0; for (int i = 0; i < customDataGridViewComments.Rows.Count; i++) { string comment = (string)customDataGridViewComments.Rows[i].Cells[2].EditedFormattedValue; string custprodnoteid = (string)customDataGridViewComments.Rows[i].Cells[4].Value; if (comment != string.Empty) { _strComments[i] = comment; if (custprodnoteid == null) { _strCustProdNoteId[i] = ""; } else { _strCustProdNoteId[i] = custprodnoteid; } j++; } } if (j > 0) { if (commentDataChanged()) { DialogResult dgr; do { _strUpdatedComments = new string[updatedNotes.Count]; _strUpdatedCustProdNoteId = new string[updatedNotes.Count]; _strUpdatedUserId = new string[updatedNotes.Count]; int k = 0; foreach (CustomerNotesVO note in updatedNotes) { _strUpdatedUserId[k] = _strUser; _strUpdatedComments[k] = note.ContactNote; _strUpdatedCustProdNoteId[k] = note.CustomerProductNoteId; k++; } string errorCode; string errorMsg; bool updateCommentData = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdateCustomerComments(_strUpdatedUserId, _custNumber, _strUpdatedComments, _strUpdatedCustProdNoteId, _strStoreNumber, out _notesTable, out errorCode, out errorMsg); if (updateCommentData) { MessageBox.Show("Customer Comments update successful"); //Set updated notes info for the customer LoadUpdatedNotesInCustomerObject(); Form ownerForm = this.Owner; if (ownerForm.GetType() == typeof(ViewCustomerInformation)) { ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = _updatedCustomer; ((ViewCustomerInformation)ownerForm).ShowUpdates = true; } break; } else { dgr = MessageBox.Show(Commons.GetMessageString("CustCommentsUpdateFailure"), "Error", MessageBoxButtons.RetryCancel); } } while (dgr == DialogResult.Retry); } else { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } } else { MessageBox.Show(Commons.GetMessageString("NoChangesInForm")); } this.Close(); this.Dispose(true); } }
public void execute() { //Perform lookup customer /*this.AddLoadForm("LookupCustomer", new LookupCustomer(), 1, * new Dictionary<string, string>() * { * { * "lookupCustomerLastName", * this.input.LastName * }, * { * "lookupCustomerFirstName", * this.input.FirstName * } * }, * new Dictionary<string, TupleType<Control, ControlType, ControlTriggerType>>() * { * { * "lookupCustomerFindButton", * new TupleType<Control, ControlType, ControlTriggerType>(null, ControlType.BUTTON, ControlTriggerType.CLICK) * * } * }); * this.SetFieldsOnForm("LookupCustomer"); * this.TriggerControlOnForm("LookupCustomer", "lookupCustomerFindButton");*/ //Get the site id SiteId curSite = cds.CurrentSiteId; //Perform customer lookup DateTime dtFullStart = DateTime.Now; DateTime custLookupStart = DateTime.Now; DataTable customerTable, customerIds, customerContacts, customerAddress, customerEmails, customerNotes, customerStoreCredit; string errorCode, errorMesg; var dbProcedures = new CustomerDBProcedures(this.cds); //CustomerProcedures custProcedures = new CustomerProcedures(); try { bool retVal = dbProcedures.ExecuteLookupCustomer(this.input.Mid.FirstName, this.input.Mid.LastName, "", "", "", "", "", "", "", "", "", "", out customerTable, out customerIds, out customerContacts, out customerAddress, out customerEmails, out customerNotes, out customerStoreCredit, out errorCode, out errorMesg); if (!retVal || customerTable == null || customerTable.Rows == null || customerTable.Rows.Count <= 0) { input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } } catch (Exception eX) { input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } DateTime custLookupStop = DateTime.Now; DateTime managePawnAppStart = DateTime.Now; //Choose first customer returned DataRow chosenCust = customerTable.Rows[0]; var partyId = (string)chosenCust["party_id"]; CustomerVO cust = null; try { cust = CustomerProcedures.getCustomerDataInObject(partyId, customerIds, customerContacts, customerAddress, customerEmails, customerNotes, customerStoreCredit, chosenCust); } catch (Exception eX) { TimeSpan custLookupTimeEx = custLookupStop - custLookupStart; input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } if (cust == null) { TimeSpan custLookupTimeEx = custLookupStop - custLookupStart; input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } //Create pawn application cds.ActiveCustomer = cust; string pawnAppId = "1"; try { IdentificationVO curId = cust.getFirstIdentity(); bool createdPawnApp = dbProcedures.InsertPawnApplication( cust.CustomerNumber, curSite.StoreNumber, " ", " ", curId.IdType, curId.IdValue, curId.IdIssuer, curId.IdExpiryData.Date.ToShortDateString(), cds.UserName, out pawnAppId, out errorCode, out errorMesg); if (!createdPawnApp || string.IsNullOrEmpty(pawnAppId)) { TimeSpan custLookupTimeEx = custLookupStop - custLookupStart; input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } } catch (Exception eX) { TimeSpan custLookupTimeEx = custLookupStop - custLookupStart; input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } DateTime managePawnAppStop = DateTime.Now; //Start building pawn loan DateTime pawnLoanTenderStart = DateTime.Now; PawnLoan curLoan = cds.ActivePawnLoan; curLoan.OrgShopNumber = curSite.StoreNumber; curLoan.PawnAppId = pawnAppId; cds.CurPawnAppId = pawnAppId; cds.Clothing = " "; cds.TTyId = "1"; //Choose what will be on the loan (max 3) (one of each, or a combo of general, jewelry, and/or gun) var randClass = new Random(); int numberOfLoanItems = 1 + (int)(randClass.NextDouble() * 2.0d); int randGenCat = 1 + (int)(randClass.NextDouble() * 2.0d); int randJewCat = 1 + (int)(randClass.NextDouble() * 2.0d); int randGunCat = 1 + (int)(randClass.NextDouble() * 2.0d); try { //We have one loan item int finalGenCat = randGenCat - 1; if (finalGenCat < 0 || finalGenCat > 2) { finalGenCat = 0; } int finalJewCat = randJewCat - 1; if (randJewCat < 0 || randJewCat > 2) { randJewCat = 0; } int finalGunCat = randGunCat - 1; if (randGunCat < 0 || randGunCat > 2) { randGunCat = 0; } curLoan.Fees = new List <Fee>(numberOfLoanItems); if (numberOfLoanItems == 1) { int catG = genCategories[randGenCat - 1]; var descMerc = new DescribedMerchandise(catG); curLoan.Items.Add(descMerc.SelectedPawnItem); curLoan.Items[0].TicketDescription = "TestGenDesc"; Item firstItem = curLoan.Items[0]; firstItem.mStore = 6016; firstItem.CategoryCode = genCategories[randGenCat - 1]; } //We have two loan items else if (numberOfLoanItems == 2) { int catGenG = genCategories[randGenCat - 1]; int catJewG = jewCategories[randJewCat - 1]; var descGenMerc = new DescribedMerchandise(catGenG); var descJewMerc = new DescribedMerchandise(catJewG); curLoan.Items.Add(descGenMerc.SelectedPawnItem); curLoan.Items.Add(descJewMerc.SelectedPawnItem); curLoan.Items[0].TicketDescription = "TestGenDesc"; curLoan.Items[1].TicketDescription = "TestJewDesc"; Item firstItem = curLoan.Items[0]; firstItem.mStore = 6016; firstItem.CategoryCode = genCategories[randGenCat - 1]; Item secItem = curLoan.Items[1]; secItem.mStore = 6016; secItem.CategoryCode = jewCategories[randJewCat - 1]; } //We have 3 loan items else { int catGenG = genCategories[randGenCat - 1]; int catJewG = jewCategories[randJewCat - 1]; int catGunG = gunCategories[randGunCat - 1]; var descGenMerc = new DescribedMerchandise(catGenG); var descJewMerc = new DescribedMerchandise(catJewG); var descGunMerc = new DescribedMerchandise(catGunG); curLoan.Items.Add(descGenMerc.SelectedPawnItem); curLoan.Items.Add(descJewMerc.SelectedPawnItem); curLoan.Items.Add(descGunMerc.SelectedPawnItem); curLoan.Items[0].TicketDescription = "TestGenDesc"; curLoan.Items[1].TicketDescription = "TestJewDesc"; curLoan.Items[2].TicketDescription = "GUNTestGunDesc"; Item firstItem = curLoan.Items[0]; firstItem.mStore = 6016; firstItem.CategoryCode = genCategories[randGenCat - 1]; Item secItem = curLoan.Items[1]; secItem.mStore = 6016; secItem.CategoryCode = jewCategories[randJewCat - 1]; Item thdItem = curLoan.Items[2]; thdItem.mStore = 6016; thdItem.CategoryCode = gunCategories[randGunCat - 1]; } } catch (Exception eX) { TimeSpan custLookupTimeEx = custLookupStop - custLookupStart; TimeSpan mngAppTimeEx = managePawnAppStop - managePawnAppStart; input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", mngAppTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } //Call underwrite try { //Set loan amount prior to underwriting decimal tryAmt; curLoan.Amount = 60; if (Decimal.TryParse("" + (60 * (1 + (uint)Math.Floor(randClass.NextDouble() * 4))), out tryAmt)) { curLoan.Amount = tryAmt; } var upwUtil = new UnderwritePawnLoanUtility(this.cds); upwUtil.RunUWP(curSite); curLoan.ObjectUnderwritePawnLoanVO = upwUtil.PawnLoanVO; //Call process tender execute this.tender.ExecuteProcessTender( ProcessTenderController.ProcessTenderMode.NEWLOAN); //cleanup once done this.cds.ClearCustomerList(); this.cds.ClearPawnLoan(); curLoan = null; } catch (Exception eX) { //MessageBox.Show("Exception thrown during process tender: " + eX.Message + ", " + eX.StackTrace); TimeSpan custLookupTimeEx = custLookupStop - custLookupStart; TimeSpan mngAppTimeEx = managePawnAppStop - managePawnAppStart; input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", mngAppTimeEx.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d)); return; } DateTime pawnLoanTenderStop = DateTime.Now; DateTime dtFullFinish = DateTime.Now; //Thread finished //Compute times TimeSpan finishTime = dtFullFinish - dtFullStart; TimeSpan custLookupTime = custLookupStop - custLookupStart; TimeSpan mngAppTime = managePawnAppStop - managePawnAppStart; TimeSpan pwnLoanTender = pawnLoanTenderStop - pawnLoanTenderStart; input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTime.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", mngAppTime.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", pwnLoanTender.TotalSeconds)); input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", finishTime.TotalSeconds)); }