private void buttonSubmit_Click(object sender, EventArgs e) { bool returnValue = false; DialogResult dgr = DialogResult.Retry; //Release police hold if (!PoliceSeize && !ReleaseToClaimant) { do { if (!customTextBoxAgency.isValid || !customTextBoxBadgeNumber.isValid || !customTextBoxOfficerFirstName.isValid || !customTextBoxOfficerLastName.isValid || !customTextBoxPhoneAreaCode.isValid || !customTextBoxPhoneNumber.isValid || richTextBoxReason.Text.Trim().Length <= 0) { MessageBox.Show("Please enter all the required fields and submit"); return; } returnValue = HoldsProcedures.RemovePoliceHolds(policeHolds, this.richTextBoxReason.Text, customTextBoxOfficerFirstName.Text, customTextBoxOfficerLastName.Text, customTextBoxBadgeNumber.Text, customTextBoxAgency.Text, customTextBoxCaseNumber.Text, customTextBoxPhoneAreaCode.Text, customTextBoxPhoneNumber.Text, customTextBoxPhoneExt.Text); if (returnValue) { MessageBox.Show("selected transactions released from police hold successfully"); break; } else { dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel); } }while (dgr == DialogResult.Retry); } //Process police seize if (PoliceSeize) { if (!customTextBoxAgency.isValid || !customTextBoxBadgeNumber.isValid || !customTextBoxOfficerFirstName.isValid || !customTextBoxOfficerLastName.isValid || !customTextBoxPhoneAreaCode.isValid || !customTextBoxPhoneNumber.isValid || richTextBoxReason.Text.Trim().Length <= 0 || !customTextBoxCaseNumber.isValid) { MessageBox.Show("Please enter all the required fields and submit"); return; } CustomerVO currentCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; foreach (HoldData policeHold in policeHolds) { policeHold.HoldComment = richTextBoxReason.Text; } PoliceInfo policeInfo = new PoliceInfo { Agency = customTextBoxAgency.Text, BadgeNumber = customTextBoxBadgeNumber.Text, CaseNumber = customTextBoxCaseNumber.Text, OfficerFirstName = customTextBoxOfficerFirstName.Text, OfficerLastName = customTextBoxOfficerLastName.Text, PhoneAreaCode = customTextBoxPhoneAreaCode.Text, PhoneExtension = customTextBoxPhoneExt.Text, PhoneNumber = customTextBoxPhoneNumber.Text, RequestType = "" }; do { int seizeNumber = 0; returnValue = HoldsProcedures.AddPoliceSeize( policeHolds, policeHolds[0].HoldComment, policeInfo, currentCustomer, out seizeNumber); if (returnValue && seizeNumber > 0) { policeInfo.SeizeNumber = seizeNumber; ReceiptDetailsVO rDVO = new ReceiptDetailsVO(); if (!HoldsProcedures.insertPoliceReceipt(policeHolds, ref rDVO)) { FileLogger.Instance.logMessage(LogLevel.ERROR, null, "Receipt details could not be entered for police seize " + seizeNumber); } MessageBox.Show("Selected items police seized successfully"); //Print police seize document foreach (HoldData policehold in policeHolds) { policehold.PoliceInformation = policeInfo; } //Call print Police seize form if print is enabled if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled) { //PoliceSeizeform seizeFrm = new PoliceSeizeform(); //seizeFrm.PoliceSeizeLoans = policeHolds; //seizeFrm.ShowDialog(); //Calling policeseizereport(Itextsharp) instead of bitmap(policeseizeform) calling var policeseizereport = new Reports.PoliceSeizeReport(); var reportObject = new ReportObject(); reportObject.ReportTempFileFullName = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\Police Seize" + DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") + ".pdf"; policeseizereport.reportObject = reportObject; policeseizereport.ReportTempFileFullName = reportObject.ReportTempFileFullName; policeseizereport.STORE_NAME = GlobalDataAccessor.Instance.CurrentSiteId.StoreName; policeseizereport.STORE_ADDRESS = GlobalDataAccessor.Instance.CurrentSiteId.StoreAddress1; policeseizereport.STORE_CITY = GlobalDataAccessor.Instance.CurrentSiteId.StoreCityName; policeseizereport.STORE_STATE = GlobalDataAccessor.Instance.CurrentSiteId.State; policeseizereport.STORE_ZIP = GlobalDataAccessor.Instance.CurrentSiteId.StoreZipCode; policeseizereport.CurrentCust = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; policeseizereport.EmpNo = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant(); policeseizereport.TransactionDate = ShopDateTime.Instance.ShopDate.FormatDate(); policeseizereport.HoldData = policeHolds[0]; policeseizereport.CustHomeAddr = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerAddress[0]; policeseizereport.CreateReport(); string strReturnMessage; if (GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, this, "Printing PoliceSeize report on PDA Laser printer: {0}", GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter); } strReturnMessage = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.Port, 2); } else if (GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogWarn) { FileLogger.Instance.logMessage(LogLevel.WARN, this, "Could not find valid PDA laser printer to print the PoliceSeize report." + Environment.NewLine + " Printing on default pawn laser printer: {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } strReturnMessage = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 2); } else { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not find a valid laser printer to print the PoliceSeize report"); } strReturnMessage = "FAIL - NO PRINTER FOUND"; } if (strReturnMessage.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print the PoliceSeize report: " + strReturnMessage); } } } break; } dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel); }while (dgr == DialogResult.Retry); } //Process Release to claimant if (ReleaseToClaimant) { //Store the police info in session if (GlobalDataAccessor.Instance.DesktopSession.PoliceInformation == null) { if (!customTextBoxAgency.isValid || !customTextBoxBadgeNumber.isValid || !customTextBoxOfficerFirstName.isValid || !customTextBoxOfficerLastName.isValid || !customTextBoxPhoneAreaCode.isValid || !customTextBoxPhoneNumber.isValid || richTextBoxReason.Text.Trim().Length <= 0) { MessageBox.Show("Please enter all the required fields and submit"); return; } foreach (HoldData policeHold in policeHolds) { policeHold.HoldComment = richTextBoxReason.Text; } PoliceInfo policeInfo = new PoliceInfo { Agency = customTextBoxAgency.Text, BadgeNumber = customTextBoxBadgeNumber.Text, CaseNumber = customTextBoxCaseNumber.Text, OfficerFirstName = customTextBoxOfficerFirstName.Text, OfficerLastName = customTextBoxOfficerLastName.Text, PhoneAreaCode = customTextBoxPhoneAreaCode.Text, PhoneExtension = customTextBoxPhoneExt.Text, PhoneNumber = customTextBoxPhoneNumber.Text }; GlobalDataAccessor.Instance.DesktopSession.PoliceInformation = policeInfo; GlobalDataAccessor.Instance.DesktopSession.ReleaseToClaimant = true; NavControlBox.IsCustom = true; NavControlBox.CustomDetail = "FindClaimant"; this.NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; } else { bool gunInvolved = false; CustomerVO currentCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; //Check if any of the loans being released has a gun foreach (HoldData pl in policeHolds) { var gunItems = from pItem in pl.Items where pItem.GunNumber > 0 select pItem; if (gunItems.Any()) { gunInvolved = true; break; } } //if gun involved check for cwp bool backgroundCheck = false; if (gunInvolved) { /*DateTime currentDate = ShopDateTime.Instance.ShopDate; * string strStoreState = GlobalDataAccessor.Instance.CurrentSiteId.State; * if (currentCustomer.HasValidConcealedWeaponsPermitInState(strStoreState, currentDate)) * { * if (CustomerProcedures.IsBackgroundCheckRequired()) * { * FirearmsBackgroundCheck backgroundcheckFrm = new FirearmsBackgroundCheck(); * backgroundcheckFrm.ShowDialog(this); * } * else //If the background check is not needed * CashlinxDesktopSession.Instance.BackgroundCheckCompleted = true; * } * //else if they do not have CWP or not a CWP in the store state or expired * //then show the background check form * else * { * FirearmsBackgroundCheck backgroundcheckFrm = new FirearmsBackgroundCheck(); * backgroundcheckFrm.ShowDialog(this); * }*/ FirearmsBackgroundCheck backgroundcheckFrm = new FirearmsBackgroundCheck(); backgroundcheckFrm.ShowDialog(this); if (GlobalDataAccessor.Instance.DesktopSession.BackgroundCheckCompleted) { backgroundCheck = true; } } else { backgroundCheck = true; } if (backgroundCheck) { do { returnValue = HoldsProcedures.AddReleaseToClaimant(policeHolds, policeHolds[0].HoldComment, GlobalDataAccessor.Instance.DesktopSession.PoliceInformation, currentCustomer); if (returnValue) { MessageBox.Show("selected transactions released to claimant successfully"); //Print RTC form foreach (var policeHold in policeHolds) { policeHold.PoliceInformation = GlobalDataAccessor.Instance.DesktopSession.PoliceInformation; policeHold.RestitutionPaid = radioButtonYes.Checked; if (panelRestitution.Visible == true && radioButtonYes.Checked == true) { // there was restitution paid if (customTextBoxResAmount.Text.Trim() == "") { // Probably should have caught this before policeHold.RestitutionAmount = 0; MessageBox.Show("Please enter the restitution amount!", "Restitution amount missing"); customTextBoxResAmount.Focus(); return; } } else { // No restitution paid policeHold.RestitutionPaid = false; policeHold.RestitutionAmount = 0; } } //Call print RTC if print is enabled if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled) { var rtcprintFrm = new RTCform(); rtcprintFrm.RTCLoans = policeHolds; rtcprintFrm.ShowDialog(); } break; } dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel); }while (dgr == DialogResult.Retry); } else { MessageBox.Show("Background check not completed. selected transactions not released to claimant"); RemoveTempStatusOnLoans(); } GlobalDataAccessor.Instance.DesktopSession.PoliceInformation = null; GlobalDataAccessor.Instance.DesktopSession.ReleaseToClaimant = false; } } this.NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; }
/// <summary> /// Main execution function for NewPawnLoanFlowExecutor /// </summary> /// <param name="inputData"></param> /// <returns></returns> private object executorFxn(object inputData) { if (inputData == null) { return(false); } PurchaseReturnFlowState inputState = (PurchaseReturnFlowState)inputData; switch (inputState) { case PurchaseReturnFlowState.BuyReturn: ShowForm buyReturnFrmBlk = CommonAppBlocks.Instance.BuyReturnFormBlock(this.parentForm, this.buyReturnFormNavAction); if (!buyReturnFrmBlk.execute()) { throw new ApplicationException("Cannot show Buy Return form"); } break; case PurchaseReturnFlowState.BuyReturnItems: ShowForm buyReturnItemBlk = CommonAppBlocks.Instance.BuyReturnItemsFormBlock(this.parentForm, this.buyReturnItemsFormNavAction); if (!buyReturnItemBlk.execute()) { throw new ApplicationException("Cannot show Return Items form"); } break; case PurchaseReturnFlowState.CancelFlow: GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList(); GlobalDataAccessor.Instance.DesktopSession.ClearSessionData(); if (this.endStateNotifier != null) { this.endStateNotifier.execute(); } break; case PurchaseReturnFlowState.ManagePawnApplication: ShowForm managePawnAppBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction); if (!managePawnAppBlk.execute()) { throw new ApplicationException("Cannot execute ManagePawnApplication block"); } break; case PurchaseReturnFlowState.FinalGunSubmit: var backgroundcheckFrm = new FirearmsBackgroundCheck(); backgroundcheckFrm.ShowDialog(null); if (GlobalDataAccessor.Instance.DesktopSession.BackgroundCheckCompleted) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop(); GlobalDataAccessor.Instance.DesktopSession.showProcessTender(ProcessTenderProcedures.ProcessTenderMode.RETURNBUY); } break; case PurchaseReturnFlowState.ShowVendor: ShowForm createVendBlk = CommonAppBlocks.Instance.CreateCreateVendorBlock(this.parentForm, this.createVendFormNavAction); if (!createVendBlk.execute()) { throw new ApplicationException("Cannot execute Show Vendor block"); } break; } return(true); }