private void submitForm() { validateForm(); if (isFormValid) { bool returnValue = false; DialogResult dgr = DialogResult.Retry; CustomerVO currentCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; string currDate = ShopDateTime.Instance.ShopDate.FormatDate(); string currDateTime = currDate + " " + ShopDateTime.Instance.ShopTime.ToString(); ReleaseFingerprintsInfo releaseFingerprintsInfo = new ReleaseFingerprintsInfo() { RefType = GlobalDataAccessor.Instance.DesktopSession .TicketTypeLookedUp == ProductType.BUY ? "2" : "1", RefNumber = GlobalDataAccessor.Instance.DesktopSession .TicketLookedUp, Comment = CommentText.Text, StoreNumber = GlobalDataAccessor.Instance.CurrentSiteId. StoreNumber, SubpoenaNumber = SubpoenaNumberText.Text, OfficerFirstName = OfficerFirstNameText.Text, OfficerLastName = OfficerLastNameText.Text, BadgeNumber = BadgeNumberText.Text, CaseNumber = CaseNumberText.Text, Agency = AgencyText.Text, TransactionDate = currDateTime, SeizeStatus = "FPRNT" }; do { int seizeNumber = 0; returnValue = HoldsProcedures.AddReleaseFingerprints(releaseFingerprintsInfo, out seizeNumber); if (returnValue && seizeNumber > 0) { MessageBox.Show("Transaction completed successfully"); //Print release fingerprints document //Print authorization to release fingerprints form printAuthorizationToReleaseFingerprints(releaseFingerprintsInfo, currentCustomer, seizeNumber); break; } dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel); } while (dgr == DialogResult.Retry); this.NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; } else { //Set background color to yellow for any required controls that are empty. this.Controls.OfType <CustomTextBox>() .Where(r => r.Required) .Where(t => !t.isValid).ToList() .ForEach(control => control.BackColor = Color.Yellow); } }
private void printAuthorizationToReleaseFingerprints(ReleaseFingerprintsInfo releaseFingerprintsInfo, CustomerVO currentCustomer, int seizeNumber) { //Call print Police seize form if print is enabled if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled) { var address = currentCustomer.getHomeAddress(); var releaseFingerprintsContext = new Reports.AuthorizationToReleaseFingerprints. ReleaseFingerprintsContext() { EmployeeNumber = GlobalDataAccessor.Instance.DesktopSession. UserName, ShopName = GlobalDataAccessor.Instance.CurrentSiteId. StoreName, ShopAddress = GlobalDataAccessor.Instance.CurrentSiteId. StoreAddress1 + " " + GlobalDataAccessor.Instance.CurrentSiteId. StoreAddress2, ShopCity = GlobalDataAccessor.Instance.CurrentSiteId. StoreCityName, ShopState = GlobalDataAccessor.Instance.CurrentSiteId.State, ShopZipCode = GlobalDataAccessor.Instance.CurrentSiteId. StoreZipCode, CustomerName = currentCustomer.CustomerName, CustomerAddress1 = address.Address1, CustomerAddress2 = address.Address2, CustomerCity = address.City, CustomerState = address.State_Code, CustomerAddressUnit = address.UnitNum, CustomerZipCode = address.ZipCode, TicketNumber = releaseFingerprintsInfo.RefNumber, Agency = releaseFingerprintsInfo.Agency, CaseNumber = releaseFingerprintsInfo.CaseNumber, SubpoenaNumber = releaseFingerprintsInfo.SubpoenaNumber, OfficerName = releaseFingerprintsInfo.OfficerFirstName + " " + releaseFingerprintsInfo.OfficerLastName, BadgeNumber = releaseFingerprintsInfo.BadgeNumber, TransactionDate = releaseFingerprintsInfo.TransactionDate, OutputPath = SecurityAccessor.Instance.EncryptConfig. ClientConfig.GlobalConfiguration. BaseLogPath + "\\AuthorizationToReleaseFingerprints_" + DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") + ".pdf" }; var authorizationToReleaseFingerprints = new AuthorizationToReleaseFingerprints( seizeNumber, GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp, releaseFingerprintsContext, null); authorizationToReleaseFingerprints.Print(); string strReturnMessage = PrintingUtilities.printDocument( releaseFingerprintsContext.OutputPath, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 2); if (!strReturnMessage.Contains("SUCCESS")) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Authorization to release fingerprints : " + strReturnMessage); } //--------------------------------------------------- // Place document into couch var filePath = releaseFingerprintsContext.OutputPath; //authorizationToReleaseFingerprints.Save(policeCardFilePath); var pDoc = new CouchDbUtils.PawnDocInfo(); var dA = GlobalDataAccessor.Instance.OracleDA; var cC = GlobalDataAccessor.Instance.CouchDBConnector; //Set document add calls pDoc.UseCurrentShopDateTime = true; pDoc.SetDocumentSearchType(CouchDbUtils.DocSearchType.POLICE_CARD); pDoc.StoreNumber = GlobalDataAccessor.Instance.DesktopSession.CurrentSiteId.StoreNumber; pDoc.CustomerNumber = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber; pDoc.TicketNumber = seizeNumber; pDoc.DocumentType = Common.Libraries.Objects.Doc.Document.DocTypeNames.PDF; pDoc.DocFileName = filePath; //Add this document to the pawn document registry and document storage string errText; if (!CouchDbUtils.AddPawnDocument(dA, cC, GlobalDataAccessor.Instance.DesktopSession.UserName, ref pDoc, out errText)) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not store release authorization to release fingerprints document in document storage: {0} - FileName: {1}", errText, filePath); } BasicExceptionHandler.Instance.AddException( "Could not store police card document in document storage", new ApplicationException("Could not store authorization to release fingerprints document in document storage: " + errText)); } } }
private void customButtonOK_Click(object sender, EventArgs e) { labelErrorMessage.Visible = false; noDataFound = false; PurchaseVO purchaseObj = null; CustomerVO customerObj = null; SaleVO saleObj = null; LayawayVO layawayObj = null; CashTransferVO bankTransferObj = null; CashTransferVO shopCashTransferObj = null; DataSet mdseInfo = null; string errorCode; string errorText; getCustomerInfo = true; string tenderType; GlobalDataAccessor.Instance.DesktopSession.Purchases = new List <PurchaseVO>(); GlobalDataAccessor.Instance.DesktopSession.Sales = new List <SaleVO>(); GlobalDataAccessor.Instance.DesktopSession.Layaways = new List <LayawayVO>(); ReleaseFingerprintsInfo releaseFingerprintsequest = null; bool retValue = false; if (voidBuyReturn) { retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "RET", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText); } else if (voidBuy) { retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText); } else if (voidSale) { retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "SALE", false, out saleObj, out customerObj, out errorCode, out errorText); } else if (voidLayaway) { retValue = RetailProcedures.GetLayawayData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "4", StateStatus.BLNK, "ALL", false, out layawayObj, out customerObj, out errorCode, out errorText); } else if (voidSaleRefund) { retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "REFUND", false, out saleObj, out customerObj, out errorCode, out errorText); } //BZ # 419 else if (voidBanktoShopCashTransfer) { retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "BANKTOSHOP", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession, out bankTransferObj, out errorCode, out errorText); } else if (voidShopToBankCashTransfer) { retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "SHOPTOBANK", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession, out bankTransferObj, out errorCode, out errorText); }//BZ # 419 end else if (voidStoreCashTransfer) { string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; retValue = ShopCashProcedures.GetShopCashTransferData(customTextBoxTranNo.Text, "", storeNumber, GlobalDataAccessor.Instance.DesktopSession, out shopCashTransferObj, out errorCode, out errorText); } else if (voidMerchandiseTransfer) { string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; string tranNo = customTextBoxTranNo.Text; if (customTextBoxTranNo.Text.Length > 6) { tranNo = tranNo.Substring(5); } retValue = VoidProcedures.getTransferToVoid(Utilities.GetIntegerValue(tranNo, 0), storeNumber, out mdseInfo, out errorCode, out errorText); // retValue = VoidProcedures.GetEligibleToScrapItems(Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), // storeNumber, out mdse , out errorCode, out errorText); } else if (voidReleaseFingerprints) { string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; string tranNo = customTextBoxTranNo.Text; if (tranNo.Length > 6) { tranNo = tranNo.Substring(5); } // Add procedure to VoidsProcedurees to Locate the Release Fingerprint Authorization GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo = HoldsProcedures.GetReleaseFingerprintAuthorization(tranNo, storeNumber, out errorCode, out errorText); } if (voidBuy || voidBuyReturn) { if (retValue && purchaseObj != null) { GlobalDataAccessor.Instance.DesktopSession.Purchases.Add(purchaseObj); if (purchaseObj.EntityType != "V" && customerObj != null) { GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; } GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidSale || voidSaleRefund) { if (retValue && saleObj != null) { if (saleObj.RefType == "4") { MessageBox.Show("This sale originated from a layaway. You have to void the last layaway payment and not the sale"); return; } GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; GlobalDataAccessor.Instance.DesktopSession.Sales.Add(saleObj); GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidLayaway) { if (retValue && layawayObj != null) { GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; GlobalDataAccessor.Instance.DesktopSession.Layaways.Add(layawayObj); GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } //BZ # 419 //else if (voidCashTransfer) else if (voidBanktoShopCashTransfer || voidShopToBankCashTransfer) { //BZ # 419 end if (retValue && bankTransferObj != null) { GlobalDataAccessor.Instance.DesktopSession.CashTransferData = bankTransferObj; GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidStoreCashTransfer) { if (retValue && shopCashTransferObj != null) { GlobalDataAccessor.Instance.DesktopSession.CashTransferData = shopCashTransferObj; GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidMerchandiseTransfer) { if (retValue && mdseInfo != null && mdseInfo.Tables.Count > 0) { if (isFaultyTransferINOUT(mdseInfo)) { noDataFound = true; } else { GlobalDataAccessor.Instance.DesktopSession.MdseTransferData = mdseInfo; GlobalDataAccessor.Instance.DesktopSession.SelectedTransferNumber = customTextBoxTranNo.Text; GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } } else { noDataFound = true; } } else if (voidReleaseFingerprints && GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo != null) { this.DialogResult = DialogResult.OK; //GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } if (noDataFound) { labelErrorMessage.Text = "The number entered is not valid. Please enter another number"; labelErrorMessage.Visible = true; return; } }