private static void RunApplication() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { // decrypt pawnsec information from config file var pMesg = new ProcessingMessage("** AUDIT QUERY APP INIT **", 4000); pMesg.Show(); string key = Resources.PrivateKey; string dbHost = StringUtilities.Decrypt(Settings.Default.PawnSecDBHost, key, true); string dbPassword = StringUtilities.Decrypt(Settings.Default.PawnSecDBPassword, key, true); string dbPort = StringUtilities.Decrypt(Settings.Default.PawnSecDBPort, key, true); string dbSchema = StringUtilities.Decrypt(Settings.Default.PawnSecDBSchema, key, true); string dbService = StringUtilities.Decrypt(Settings.Default.PawnSecDBService, key, true); string dbUser = StringUtilities.Decrypt(Settings.Default.PawnSecDBUser, key, true); if (!(string.IsNullOrEmpty(dbHost) || string.IsNullOrEmpty(dbPassword) || string.IsNullOrEmpty(dbPort) || string.IsNullOrEmpty(dbSchema) || string.IsNullOrEmpty(dbService) || string.IsNullOrEmpty(dbUser))) { //Update message pMesg.Message = "** AUDIT QUERY APP SECURITY INIT **"; // create connection with PawnSec SecurityAccessor.Instance.InitializeConnection(dbHost, dbPassword, dbPort, dbSchema, dbService, dbUser); // retrieve data from PawnSec if (!SecurityAccessor.Instance.RetrieveSecurityData(key, ComputeAppHash(), true, PawnSecApplication.AuditQueries)) { pMesg.Close(); pMesg.Dispose(); //TODO: Log error and report exception //No security data means this machine is not allowed to access Cashlinx //Fail immediately. } //Otherwise, the machine is now authenticated to run AuditQueries, proceed with execution else { pMesg.Close(); pMesg.Dispose(); Application.Run(new AuditQueriesForm()); } } else { pMesg.Close(); pMesg.Dispose(); } } catch (Exception eX) { MessageBox.Show("Exception caught in CashlinxDesktop.Program during Application.Run: " + "\nMessage : " + eX.Message + "\nStack Trace: " + eX.StackTrace + "\nTarget Site: " + eX.TargetSite + "\nSource : " + eX.Source + "\nData : " + eX.Data + "\nTerminating Application!", "Application Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
void bwLookupPawnTicket_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { _procMsg.Update(); _procMsg.Close(); _procMsg.Dispose(); if (!_retValue) { MessageBox.Show(Commons.GetMessageString("InvalidTicketMessage"), "Prompt", MessageBoxButtons.OK); errorLabel.Text = Commons.GetMessageString("LookupTicketInvalidMessage"); errorLabel.Visible = true; return; } if (_pawnApplication == null) { errorLabel.Text = Commons.GetMessageString("LookupTicketInvalidMessage"); errorLabel.Visible = true; return; } if (_pawnApplication == null || _pawnLoan == null) { MessageBox.Show(Commons.GetMessageString("InvalidTicketMessage"), "Prompt", MessageBoxButtons.OK); errorLabel.Text = Commons.GetMessageString("LookupTicketInvalidMessage"); errorLabel.Visible = true; return; } if (string.IsNullOrEmpty(_custObject.PartyId)) { DialogResult dgr = MessageBox.Show(Commons.GetMessageString("LookupTicketNoCustomerMessage"), "Warning", MessageBoxButtons.RetryCancel); if (dgr != DialogResult.Retry) { NavControlBox.Action = NavBox.NavAction.CANCEL; } return; } GlobalDataAccessor.Instance.DesktopSession.ClearPawnLoan(); GlobalDataAccessor.Instance.DesktopSession.TicketLookedUp = _ticketNumber; GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp = ProductType.PAWN; GlobalDataAccessor.Instance.DesktopSession.PH_TicketLookedUp = _ticketNumber; GlobalDataAccessor.Instance.DesktopSession.PH_TicketTypeLookedUp = ProductType.PAWN; GlobalDataAccessor.Instance.DesktopSession.PH_TicketLookedUpActive = _pawnLoan.LoanStatus == ProductStatus.IP; GlobalDataAccessor.Instance.DesktopSession.PawnApplications.Add(_pawnApplication); GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = _custObject; GlobalDataAccessor.Instance.DesktopSession.CurPawnAppId = _pawnApplication.PawnAppID.ToString(); GlobalDataAccessor.Instance.DesktopSession.PawnLoans.Add(_pawnLoan); this.NavControlBox.Action = NavBox.NavAction.HIDEANDSHOW; }
/// <summary> /// /// </summary> /// <returns></returns> public bool Setup() { //Processing message var pMesg = new ProcessingMessage("* AUDIT QUERY APP SETUP *"); pMesg.Show(); //Initialize database connection, LDAP connection, and ShopTime var confRef = SecurityAccessor.Instance.EncryptConfig; if (confRef == null) { return(false); } this.userState = UserDesktopState.NOTLOGGEDIN; this.UserName = string.Empty; GlobalDataAccessor.Instance.Init( this, confRef, "AuditQueryApp", auditLogEnabledChangeHandlerBase, auditLogMessageHandlerBase, false); pMesg.Close(); pMesg.Dispose(); return(true); }
/// <summary> /// This method causes the communication listener to close. Close is a terminal state and /// this method allows the communication listener to transition to this state in a /// graceful manner. /// </summary> /// <param name="cancellationToken">Cancellation token</param> /// <returns> /// A <see cref="T:System.Threading.Tasks.Task">Task</see> that represents outstanding operation. /// </returns> public async Task CloseAsync(CancellationToken cancellationToken) { WriteLog("Service Bus Communication Listener closing"); IsClosing = true; _stopProcessingMessageTokenSource.Cancel(); //Wait for Message processing to complete.. await Task.WhenAny( // Timeout task. Task.Delay(CloseTimeout, cancellationToken), // Wait for all processing messages to finish by stealing semaphore entries. Task.Run(() => { for (int i = 0; i < (MaxConcurrentCalls ?? 1); i++) { // ReSharper disable once AccessToDisposedClosure // ReSharper disable once EmptyGeneralCatchClause try { ProcessingMessage.Wait(cancellationToken); } catch { } } }, cancellationToken)); ProcessingMessage.Dispose(); await CloseImplAsync(cancellationToken); }
void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { procMsg.Update(); procMsg.Close(); procMsg.Dispose(); SetButtonState(true); }
/// <summary> /// This method causes the communication listener to close. Close is a terminal state and /// this method allows the communication listener to transition to this state in a /// graceful manner. /// </summary> /// <param name="cancellationToken">Cancellation token</param> /// <returns> /// A <see cref="T:System.Threading.Tasks.Task">Task</see> that represents outstanding operation. /// </returns> public Task CloseAsync(CancellationToken cancellationToken) { WriteLog("Service Bus Communication Listnener closing"); _stopProcessingMessageTokenSource.Cancel(); //Wait for Message processing to complete.. ProcessingMessage.WaitOne(); ProcessingMessage.Dispose(); return(CloseImplAsync(cancellationToken)); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> protected virtual void Dispose(bool disposing) { if (!disposing) { return; } ProcessingMessage.Set(); ProcessingMessage.Dispose(); _stopProcessingMessageTokenSource.Cancel(); _stopProcessingMessageTokenSource.Dispose(); }
void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { procMsg.Close(); procMsg.Dispose(); //loadLookupCustomerSearchCriteria(); //CashlinxDesktopSession.Instance.ActiveLookupCriteria = _lookupCustSearch; //if (retValue && custDatatable != null) //{ // isFormValid = true; // CashlinxDesktop.Desktop.CashlinxDesktopSession.Instance.CustDataTable = custDatatable; // if (custAddrDatatable != null) // CashlinxDesktopSession.Instance.CustAddrDataTable = custAddrDatatable; // if (custIdentDatatable != null) // CashlinxDesktopSession.Instance.CustIdentDataTable = custIdentDatatable; // if (custPhoneDatatable != null) // CashlinxDesktopSession.Instance.CustPhoneDataTable = custPhoneDatatable; // if (custEmailDatatable != null) // CashlinxDesktopSession.Instance.CustEmailDataTable = custEmailDatatable; // if (custNotesDatatable != null) // CashlinxDesktopSession.Instance.CustNotesDataTable = custNotesDatatable; //Call the lookup results form this.NavControlBox.IsCustom = true; this.NavControlBox.CustomDetail = "LoanInquiryResults"; this.NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; //} //else //{ // //Create the search criteria string to be shown in the error control // //If the date of birth is not entered, it should not be shown as '//' in the error message // //hence need to be formatted // string strFilteredDOB = ""; // if (_dob.Equals("mm/dd/yyyy")) // { // strFilteredDOB = ""; // } // else // strFilteredDOB = _dob; // string strFilteredPhone = ""; // if (_phoneAreaCode.Trim().Length > 0 && _phoneNumber.Trim().Length > 0) // { // strFilteredPhone = "(" + _phoneAreaCode + ")" + _phoneNumber.Substring(0, 3) + "-" + _phoneNumber.Substring(3, 4); // } // string searchCriteria = " [" + " " + _ssn + " " + _firstName + " " + _lastName + " " + strFilteredDOB + " " + strFilteredPhone + " " + _idTypeCode + " " + _idNumber + " " + _idIssuer + " " + _custNumber + " " + _loanNumber + " ]"; // _errorMessage = Commons.GetMessageString("ZeroCustSearchResults") + searchCriteria; // this.customButtonAddCustomer.Visible = true; //} }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> protected virtual void Dispose(bool disposing) { if (!disposing) { return; } _stopProcessingMessageTokenSource.Cancel(); _stopProcessingMessageTokenSource.Dispose(); ProcessingMessage.Release(MaxConcurrentCalls ?? 1); ProcessingMessage.Dispose(); }
private void customButtonExit_Click(object sender, EventArgs e) { /* * if (bg_tasks[0].IsBusy) * bg_tasks[0].CancelAsync(); * * if (bg_tasks[1].IsBusy) * bg_tasks[1].CancelAsync(); * * if (bg_tasks[2].IsBusy) * bg_tasks[2].CancelAsync(); */ if (procMsgForm != null) { procMsgForm.Dispose(); } if (GlobalDataAccessor.Instance.DesktopSession.ShowOnlyHistoryTabs) { GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan = null; GlobalDataAccessor.Instance.DesktopSession.ShowOnlyHistoryTabs = false; this.NavControlBox.IsCustom = true; this.NavControlBox.CustomDetail = "Exit"; this.NavControlBox.Action = NavBox.NavAction.BACK; } else if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals("newpawnloan", StringComparison.OrdinalIgnoreCase) || GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals("DescribeMerchandise", StringComparison.OrdinalIgnoreCase)) { GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.None; this.NavControlBox.IsCustom = true; this.NavControlBox.CustomDetail = "Exit"; this.NavControlBox.Action = NavBox.NavAction.BACK; } else { DialogResult dR = MessageBox.Show("Do you want to continue processing this customer?", "Item History", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dR == DialogResult.No) { GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList(); } //1/29/2010 According to QA requirement Cancel should take you to ring menu! this.NavControlBox.IsCustom = true; this.NavControlBox.CustomDetail = "Menu"; this.NavControlBox.Action = NavBox.NavAction.BACK; } }
private void Print_PfiChargeOffList_Load(object sender, EventArgs e) { if (_Records.Count > 0) { ProcessingMessage myForm = new ProcessingMessage("Please wait while we generate report."); myForm.Show(); PrintQueue(); myForm.Close(); myForm.Dispose(); MessageBox.Show("Printing Complete", "PFI Charge Off Report", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No records available to print", "PFI Charge Off Report", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Close(); }
private void Print_AssignPhysicalLocation_Load(object sender, EventArgs e) { if (_Records.Count > 0) { ProcessingMessage myForm = new ProcessingMessage("Please wait while we generate report."); myForm.Show(); PrintQueue(); myForm.Close(); myForm.Dispose(); MessageBox.Show("Printing Complete", "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No records available to print", "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Close(); }
protected override void Dispose(bool disposing) { if (!disposing) { return; } if (MaxConcurrentCalls.HasValue) { ProcessingMessage.Release(MaxConcurrentCalls.Value); } else { ProcessingMessage.Release(); } ProcessingMessage.Dispose(); base.Dispose(disposing); }
private void PrintGunBook_Load(object sender, EventArgs e) { if (records.Count > 0) { ProcessingMessage myForm = new ProcessingMessage("Please wait while we generate report."); myForm.TopMost = true; this.rpttitle.Text = this.reportTitle; Point p = new Point((ClientRectangle.Width - rpttitle.Width) / 2, this.rpttitle.Location.Y); this.rpttitle.Location = p; myForm.Show(); PrintQueue(); FileLogger.Instance.logMessage(LogLevel.DEBUG, this, "********** Print Queue Compelted :" + DateTime.Now); myForm.Close(); myForm.Dispose(); MessageBox.Show("Printing Complete", "Gun Book Reports", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No records available to print", "Gun Book Reports", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Close(); }
private void printDocButton_Click(object sender, EventArgs e) { if (productTypeList1.ComboBox.SelectedValue != null) { if (productTypeList1.ComboBox.SelectedValue.ToString() == DocumentHelper.REPRINT_TAGS) { this.Hide(); var reprintTag = new ReprintTag(); reprintTag.ShowDialog(this); this.Close(); return; } } if (_isLookup) { if (!SetStorageIDFromLookup()) { return; } } //TODO: Finalize printing this.printDocButton.Enabled = false; //Get the accessors var cC = GlobalDataAccessor.Instance.CouchDBConnector; //Retrieve the document data var pLoadMesg = new ProcessingMessage("* Printing Document *"); //Connect to couch and retrieve document Document doc; string errText; if (!CouchDbUtils.GetDocument( this.StorageId, cC, out doc, out errText)) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.ShowErrorMessage("print", errText); this.Close(); } else if (doc != null) { this.DocumentType = doc.TypeName; //Fetch data byte[] fileData; if (!doc.GetSourceData(out fileData)) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.ShowErrorMessage("print", "Cannot retrieve file data to print file"); this.Close(); return; } //Send byte stream to printer based on type var printSuccess = false; switch (this.DocumentType) { case Document.DocTypeNames.PDF: //If we do not have the laser printer info, get out if (!hasLaserInfo) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.ShowErrorMessage("print", "Cannot determine laser printer IP/Port"); this.Close(); return; } //Send raw pdf data to printer var resStrPdf = GenerateDocumentsPrinter.printDocument(fileData, laserIp, laserPort, 1); if (!string.IsNullOrEmpty(resStrPdf) && resStrPdf.Contains("SUCCESS")) { printSuccess = true; } break; case Document.DocTypeNames.RECEIPT: //If we do not have the receipt printer info, get out if (!hasReceiptInfo) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.ShowErrorMessage("print", "Cannot determine receipt printer IP/Port"); this.Close(); return; } //Send raw receipt data to receipt printer var resStrRec = GenerateDocumentsPrinter.printDocument(fileData, receiptIp, receiptPort, 1); if (!string.IsNullOrEmpty(resStrRec) && resStrRec.Contains("SUCCESS")) { printSuccess = true; } break; case Document.DocTypeNames.BARCODE: MessageBox.Show("Nothing to print"); //Nothing for now - should go to Intermec printer break; case Document.DocTypeNames.TEXT: //If we do not have the laser printer info, get out if (!hasLaserInfo && !hasIndianaPoliceCardPrinterInfo) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.ShowErrorMessage("print", "Cannot determine printer IP/Port"); this.Close(); return; } //Send raw text data to laser printer var resStrTxt = GenerateDocumentsPrinter.printDocument( fileData, hasIndianaPoliceCardPrinterInfo ? indianaPoliceCardPrinterIp : laserIp, hasIndianaPoliceCardPrinterInfo ? indianaPoliceCardPrinterPort : laserPort, 1); if (!string.IsNullOrEmpty(resStrTxt) && resStrTxt.Contains("SUCCESS")) { printSuccess = true; } break; case Document.DocTypeNames.BINARY: MessageBox.Show("Nothing to print"); //Nothing for now) //Nothing for now break; case Document.DocTypeNames.INVALID: MessageBox.Show("Nothing to print"); //Nothing for now) //Nothing for now break; } pLoadMesg.Close(); pLoadMesg.Dispose(); if (!printSuccess) { this.ShowErrorMessage("print", "Reprint operation failed"); } else { MessageBox.Show("Document has successfully reprinted", "Pawn Application Message"); } } //Re-enable print button this.printDocButton.Enabled = true; }
void bwLookupLayawayTicket_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { _procMsg.Update(); _procMsg.Close(); _procMsg.Dispose(); SetButtonState(true); if (!_retValue) { ShowInvalidTicketMessage(); return; } //TODO: Make this a rule!!! Also subtract from ShopDateTime.Instance.ShopDate, not datetime.now TimeSpan spanYears = new TimeSpan(); spanYears = DateTime.Now.Subtract(_layaway.DateMade); if (spanYears.Days > 730) { ShowInvalidTicketMessage(); return; } if (_layaway.LoanStatus != ProductStatus.ACT) { string msg = "This ticket number is inactive. Do you want to view the details for the ticket?"; if (MessageBox.Show(msg, "Warning", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } if (_custObject.PartyId == string.Empty || _layaway == null) { DialogResult dgr = MessageBox.Show(Commons.GetMessageString("LookupTicketNoCustomerMessage"), "Warning", MessageBoxButtons.RetryCancel); if (dgr != DialogResult.Retry) { NavControlBox.Action = NavBox.NavAction.CANCEL; } return; } GlobalDataAccessor.Instance.DesktopSession.ClearPawnLoan(); GlobalDataAccessor.Instance.DesktopSession.TicketLookedUp = _ticketNumber; GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp = ProductType.LAYAWAY; GlobalDataAccessor.Instance.DesktopSession.PH_TicketLookedUp = _ticketNumber; GlobalDataAccessor.Instance.DesktopSession.PH_TicketTypeLookedUp = ProductType.LAYAWAY; GlobalDataAccessor.Instance.DesktopSession.PH_TicketLookedUpActive = _layaway.LoanStatus == ProductStatus.ACT; GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = _custObject; GlobalDataAccessor.Instance.DesktopSession.Layaways.Add(_layaway); //BZ # 490 //this.NavControlBox.Action = NavBox.NavAction.HIDEANDSHOW; GlobalDataAccessor.Instance.DesktopSession.CustomerNotPledgor = false; GlobalDataAccessor.Instance.DesktopSession.PawnLoans = new List<PawnLoan>(); NavControlBox.IsCustom = true; NavControlBox.CustomDetail = GlobalDataAccessor.Instance.DesktopSession.PH_TicketLookedUpActive ? "ViewPawnCustomerProductDetails" : "ViewPawnCustomerProductHistory"; if (_layaway.LoanStatus != ProductStatus.ACT) NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; else NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; //BZ # 490 - end }
void pic_Click(object sender, EventArgs e) { if (ADS.ActiveAudit.AuditId > 0) { //Instantiate docinfo which will return info we need to be able to //call reprint ticket. CouchDbUtils.PawnDocInfo docInfo = new CouchDbUtils.PawnDocInfo(); docInfo.DocumentType = Document.DocTypeNames.PDF; /*docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.STORAGE); * docInfo.StoreNumber = ADS.ActiveAudit.StoreNumber; * docInfo.TicketNumber = ADS.ActiveAudit.AuditId; * int receiptNumber = 0;*/ string storageID = ((PictureBox)sender).Name.ToString(); if (!string.IsNullOrEmpty(storageID)) { //Get the accessors SecuredCouchConnector cC = GlobalDataAccessor.Instance.CouchDBConnector; //Retrieve the document data var pLoadMesg = new ProcessingMessage("* Loading Document *"); //Connect to couch and retrieve document Document doc; string errText; if (!CouchDbUtils.GetDocument( storageID, cC, out doc, out errText)) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.showErrorMessage("view", errText, storageID); this.Close(); } else if (doc != null) { pLoadMesg.Message = "* Document Loaded...Displaying *"; //Fetch data string tmpFileName; byte[] fileData; if (!doc.GetSourceData(out fileData)) { this.showErrorMessage("view", "Cannot retrieve file data to show file", storageID); pLoadMesg.Close(); pLoadMesg.Dispose(); this.Close(); return; } //Create temporary file if (!this.createTempFile(fileData, out tmpFileName)) { this.showErrorMessage("view", "Cannot generate file data to show file", storageID); pLoadMesg.Close(); pLoadMesg.Dispose(); this.Close(); return; } pLoadMesg.Close(); pLoadMesg.Dispose(); switch (docInfo.DocumentType) { case Document.DocTypeNames.PDF: AuditDesktopSession.ShowPDFFile(tmpFileName, true); break; } } } } }
public void Print(string totalCost, string totalTags, bool showMsg = true) { if (ReportData == null || ReportData.Rows.Count == 0) { if (showMsg) { MessageBox.Show("No records available to print", ReportTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } return; } ControllerForm.Cursor = Cursors.WaitCursor; ProcessingMessage processingForm = new ProcessingMessage("Please wait while we generate report."); processingForm.Show(); ReportObject reportObject = new ReportObject(); reportObject.ReportTitle = ReportTitle; reportObject.ReportStore = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath; reportObject.CreateTemporaryFullName(); PfiPostReport report = new PfiPostReport(ReportData, totalCost, totalTags, ShopDateTime.Instance.ShopDate.ToShortDateString(), Convert.ToDateTime(ShopDateTime.Instance.ShopTime.ToString()), reportObject, PdfLauncher.Instance); if (!report.CreateReport()) { processingForm.Close(); processingForm.Dispose(); ControllerForm.Cursor = Cursors.Default; MessageBox.Show("Failed to generate report", "PFI POST", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Dictionary<string, string> eDeviceData = GetPrintDeviceData(); if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, "PrintPFIUtilities", "Printing {0} on {1}", ReportTitle, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } string strReturnMessage = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (strReturnMessage.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print " + ReportTitle + " report " + strReturnMessage); } } } processingForm.Close(); processingForm.Dispose(); ControllerForm.Cursor = Cursors.Default; if (showMsg) { MessageBox.Show("Printing Complete", ReportTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public bool View(DesktopSession dSession) { //Get the accessors Document doc; var cds = dSession; var cC = GlobalDataAccessor.Instance.CouchDBConnector; //Retrieve the document data var pLoadMesg = new ProcessingMessage("* Loading Document *"); //Connect to couch and retrieve document string errText; if (!CouchDbUtils.GetDocument( this.StorageId, cC, out doc, out errText)) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.ShowErrorMessage("view", errText); return(true); } else if (doc != null) { pLoadMesg.Message = "* Document Loaded...Displaying *"; //Fetch data string tmpFileName; byte[] fileData; if (!doc.GetSourceData(out fileData)) { this.ShowErrorMessage("view", "Cannot retrieve file data to show file"); pLoadMesg.Close(); pLoadMesg.Dispose(); return(true); } //Create temporary file if (!this.CreateTempFile(fileData, out tmpFileName)) { this.ShowErrorMessage("view", "Cannot generate file data to show file"); pLoadMesg.Close(); pLoadMesg.Dispose(); return(true); } pLoadMesg.Close(); pLoadMesg.Dispose(); string bbyteArrayString = ByteArrayToString(fileData); char[] buf = bbyteArrayString.ToCharArray(); if (this.DocumentType == Document.DocTypeNames.RECEIPT && buf[0] == '%' && buf[1] == 'P' && buf[2] == 'D' && buf[3] == 'F') { this.DocumentType = Document.DocTypeNames.PDF; } switch (this.DocumentType) { case Document.DocTypeNames.PDF: DesktopSession.ShowPDFFile(tmpFileName, true); break; case Document.DocTypeNames.RECEIPT: //GJL - do nothing for now until complete receipt renderer var receiptR = new ReceiptRenderer(fileData); //receiptR.RichTextBoxContent = bbyteArrayString; receiptR.ShowDialog(); //MessageBox.Show("Show receipt renderer"); //Invoke View receipt rendering form break; case Document.DocTypeNames.BARCODE: MessageBox.Show("Nothing to show"); //Nothing for now) break; case Document.DocTypeNames.TEXT: MessageBox.Show("Nothing to show"); //Nothing for now) //Notepad?? break; case Document.DocTypeNames.BINARY: MessageBox.Show("Nothing to show"); //Nothing for now) //Nothing for now break; case Document.DocTypeNames.INVALID: MessageBox.Show("Nothing to show"); //Nothing for now) //Nothing for now break; } //Reset the storage id in case it's called again. //this.StorageId = ""; //Delete temporary file try { File.Delete(tmpFileName); } catch (Exception eX) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not delete file: {0} Exception: {1}", tmpFileName, eX); } } } return(false); }
private void executeQueryButton_Click(object sender, EventArgs e) { this.saveButton.Enabled = false; if (!GlobalDataAccessor.Instance.IsDataAccessorValid()) { MessageBox.Show("There is no valid database connection available at this time. Please exit and try again"); return; } var qStore = AuditQueriesSession.Instance.GetQueryStorage(); var selQ = AuditQueriesSession.Instance.SelectedQueryId; if (qStore == null) { MessageBox.Show("There are no valid queries defined for this audit query session. Please exit and try again."); return; } //Update the parameters for this query bool flagInvalid = false; foreach (var p in this.auditParameters) { if (!qStore.UpdateQueryParameter(selQ, p.ParameterName, p.ParameterValue)) { flagInvalid = true; break; } } if (flagInvalid) { MessageBox.Show("Could not execute the query due to an invalid parameter."); return; } try { //Extract the populated query to execute var qExec = qStore.GetPopulatedQuery(selQ); if (!string.IsNullOrEmpty(qExec) && qExec.Contains("?") == false) { var pMesg = new ProcessingMessage("* QUERY PROCESSING - PLEASE WAIT *", 100000); pMesg.Show(); if (!GlobalDataAccessor.Instance.OracleDA.issueSqlTextSelectCommand(qExec, string.Empty, CommandBehavior.Default, null, out this.resultTable)) { pMesg.Close(); pMesg.Dispose(); MessageBox.Show("Failed to execute query! Please try again"); } else { //Check the number of rows and columns returned, if nothing, query was empty if (this.resultTable != null && this.resultTable.Rows.Count > 0 && this.resultTable.Columns.Count > 0) { pMesg.Close(); pMesg.Dispose(); MessageBox.Show("Query was successful!"); //Put the datatable in the view this.queryResultDataGridView.DataSource = this.resultBindingSource; this.resultBindingSource.DataSource = this.resultTable; this.queryResultDataGridView.Update(); this.saveButton.Enabled = true; } else { pMesg.Close(); pMesg.Dispose(); MessageBox.Show("Query returned zero rows. Please try again with different parameters!"); } } } else { MessageBox.Show("The query parameters are not specified properly. Please try again"); } } catch (SystemException rEx) { MessageBox.Show("Query was not successful and/or returned zero rows. Please try again." + Environment.NewLine + "Error Details: " + rEx, "AuditQueryApp Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (ApplicationException aEx) { MessageBox.Show("Query was not successful and/or returned zero rows. Please try again." + Environment.NewLine + "Error Details: " + aEx, "AuditQueryApp Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception eX) { MessageBox.Show("Query was not successful and/or returned zero rows. Please try again." + Environment.NewLine + "Error Details: " + eX, "AuditQueryApp Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { _procMsg.Update(); _procMsg.Close(); _procMsg.Dispose(); SetButtonState(true); if (_updatePhoneData) { MessageBox.Show(Commons.GetMessageString("CustContactInfoUpdateSuccess")); //Update the customer object with the updated information CustomerVO updatedCustomer = new CustomerVO { NoCallFlag = _noCalls, NoEmailFlag = _noEmails, NoFaxFlag = _noFaxes, NoMailFlag = _noMail, OptOutFlag = _optOut, ReminderContact = _remindPmtDue, PreferredContactMethod = _preferContact, PreferredCallTime = _preferCallTime, HearAboutUs = _howDidYouHear, ReceivePromotionOffers = _receiveOffers }; //set the phone data for the customer if (_custPhone != null) { foreach (DataRow contact in _custPhone.Rows) { ContactVO custcontact = new ContactVO { TelecomNumType = Utilities.GetStringValue( contact.ItemArray[ (int)customerphonerecord.TELECOMNUMTYPECODE], ""), ContactAreaCode = Utilities.GetStringValue( contact.ItemArray[(int)customerphonerecord.AREADIALNUMCODE], ""), ContactPhoneNumber = Utilities.GetStringValue( contact.ItemArray[(int)customerphonerecord.TELECOMNUMBER], ""), ContactExtension = Utilities.GetStringValue( contact.ItemArray[(int)customerphonerecord.EXTENSIONNUMBER], ""), ContactType = Utilities.GetStringValue( contact.ItemArray[(int)customerphonerecord.CONTACTTYPECODE], ""), TeleusrDefText = Utilities.GetStringValue( contact.ItemArray[(int)customerphonerecord.TELEUSRDEFTEXT], ""), CountryDialNumCode = Utilities.GetStringValue( contact.ItemArray[ (int)customerphonerecord.COUNTRYDIALNUMCODE], "") }; updatedCustomer.addContact(custcontact); } } //Set the Email data for the customer if (_custEmail != null) { foreach (DataRow email in _custEmail.Rows) { string emailAddr = Utilities.GetStringValue(email.ItemArray[(int)customeremailrecord.EMAILADDRESS], ""); string emailAddrType = Utilities.GetStringValue(email.ItemArray[(int)customeremailrecord.EMAILADDRESSTYPECODE], ""); string contactinfoid = Utilities.GetStringValue(email.ItemArray[(int)customeremailrecord.CONTACTINFOID], ""); CustomerEmailVO custemail = new CustomerEmailVO(emailAddr, emailAddrType, contactinfoid); updatedCustomer.addEmail(custemail); } } Form ownerForm = this.Owner; if (ownerForm.GetType() == typeof(ViewCustomerInformation)) { ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = updatedCustomer; ((ViewCustomerInformation)ownerForm).ShowUpdates = true; } } }
private void printButton_Click(object sender, EventArgs e) { // Have extra enumeration to go ProKnow with only ONE call List <CustomerProductDataVO> productObjects = new List <CustomerProductDataVO>(); List <String> customerNames = new List <String>(); List <int> tickets = new List <int>(gvLoans.Rows.Count); Cursor = Cursors.WaitCursor; try { // improve efficiency -- only return new numbers if these have been previously loaded foreach (DataGridViewRow myRow in gvLoans.Rows) { if (Convert.ToBoolean(myRow.Cells[colSelect.Name].Value) && !myRow.Cells[colSelect.Name].ReadOnly) { int iTktNumber = Utilities.GetIntegerValue(myRow.Cells[colNumber.Name].Value, 0); if (iTktNumber != 0) { tickets.Add(iTktNumber); } } } string errorCode; string errorTxt; DateTime dt = Convert.ToDateTime(dateCalendarSearchDate.SelectedDate); StoreLoans.Get_PFI_Details(CashlinxDesktopSession.Instance.CurrentSiteId.StoreNumber, dt, tickets, out _PawnLoans, out _PawnApplications, out _CustomerVOs, out _Purchases, out errorCode, out errorTxt); foreach (DataGridViewRow myRow in gvLoans.Rows) { if (Convert.ToBoolean(myRow.Cells[colSelect.Name].Value) && !myRow.Cells[colSelect.Name].ReadOnly) { int iTktNumber = Utilities.GetIntegerValue(myRow.Cells[colNumber.Name].Value, 0); string customer = (string)myRow.Cells[4].Value; PawnLoan pawnLoan = null; if (myRow.Cells[colType.Name].Value.Equals("LOAN")) { if (_PawnLoans != null) { pawnLoan = (from ploan in _PawnLoans where ploan.TicketNumber == iTktNumber && ploan.ProductType == ProductType.PAWN.ToString() select ploan).FirstOrDefault(); } if (pawnLoan != null) { LoanPrinted loanPrinted = _PrintedLoans.Find( l => l.LoanNumber == iTktNumber && l.RefType == 1); loanPrinted.bPrinted = true; _PrintedLoans.RemoveAll( l => l.LoanNumber == iTktNumber && l.RefType == 1); _PrintedLoans.Add(loanPrinted); productObjects.Add(pawnLoan); customerNames.Add(customer); } } else { PurchaseVO purchaseObj = null; if (_Purchases != null) { purchaseObj = (from purchase in _Purchases where purchase.TicketNumber == iTktNumber select purchase).FirstOrDefault(); } if (purchaseObj != null) { LoanPrinted loanPrinted = _PrintedLoans.Find(l => l.LoanNumber == iTktNumber && l.RefType == 2); loanPrinted.bPrinted = true; _PrintedLoans.RemoveAll(l => l.LoanNumber == iTktNumber && l.RefType == 2); _PrintedLoans.Add(loanPrinted); productObjects.Add(purchaseObj); customerNames.Add(customer); } } } } if (productObjects.Count() > 0) { ProcessingMessage processingForm = new ProcessingMessage("Please wait while we generate report."); try { processingForm.Show(); this.Cursor = Cursors.WaitCursor; //----- Tracy 12/15/2010 List <int> lstTicketNumbers = new List <int>(); List <string> lstRefTypes = new List <string>(); string sErrorCode; string sErrorText; foreach (CustomerProductDataVO o in productObjects) { lstTicketNumbers.Add(o.TicketNumber); lstRefTypes.Add(o.ProductType == "PAWN" ? "1" : "2"); } if (lstTicketNumbers.Count > 0 && !StoreLoans.UpdateTempStatus( lstTicketNumbers, StateStatus.PFIW, CashlinxDesktopSession.Instance.CurrentSiteId.StoreNumber, true, lstRefTypes, out sErrorCode, out sErrorText)) { MessageBox.Show("Error updating PFI Verify. " + sErrorText, "PFI Verification Update", MessageBoxButtons.OK, MessageBoxIcon.Warning); } //------- Tracy 12/15/2010 var context = new PickingSlipHelper().GetPickingSlipReportContext(productObjects, customerNames, true); var reportObject = new ReportObject(); reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath; reportObject.CreateTemporaryFullName(); context.ReportObject = reportObject; var pickingSlip = new PickingSlip(context); if (!pickingSlip.CreateReport()) { processingForm.Close(); processingForm.Dispose(); this.Cursor = Cursors.Default; MessageBox.Show("Failed to generate report", "Picking Slip", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Dictionary<string, string> eDeviceData = new PrintUtilities().GetPrintDeviceData("pfipickslip"); if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, "PFI_SelectLoan", "Printing PFI picking slip on {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } string strReturnMessage = PrintingUtilities.printDocument(reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (!strReturnMessage.Contains("SUCCESS")) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print picking slip : " + strReturnMessage); } } processingForm.Close(); processingForm.Dispose(); this.Cursor = Cursors.Default; MessageBox.Show("Printing Complete", "Picking Slip", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exc) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, exc.Message); processingForm.Close(); processingForm.Dispose(); this.Cursor = Cursors.Default; MessageBox.Show(exc.Message); } } //else //{ // continueButton.Enabled = false; //} continueButton.Enabled = true; } catch (Exception exp) { MessageBox.Show("Error in printing. Retry. (" + exp.Message + ")", "PFI Printing"); } Cursor = Cursors.Default; }
public static void RunApplication() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { var pwnSecMsg = new ProcessingMessage("* PAWN SECURITY LOADING *"); pwnSecMsg.Show(); // decrypt pawnsec information from config file string key = Common.Properties.Resources.PrivateKey; string dbHost = StringUtilities.Decrypt( Properties.Settings.Default.PawnSecDBHost, key, true); string dbPassword = StringUtilities.Decrypt( Properties.Settings.Default.PawnSecDBPassword, key, true); string dbPort = StringUtilities.Decrypt( Properties.Settings.Default.PawnSecDBPort, key, true); string dbSchema = StringUtilities.Decrypt( Properties.Settings.Default.PawnSecDBSchema, key, true); string dbService = StringUtilities.Decrypt( Properties.Settings.Default.PawnSecDBService, key, true); string dbUser = StringUtilities.Decrypt( Properties.Settings.Default.PawnSecDBUser, key, true); if (!(string.IsNullOrEmpty(dbHost) || string.IsNullOrEmpty(dbPassword) || string.IsNullOrEmpty(dbPort) || string.IsNullOrEmpty(dbSchema) || string.IsNullOrEmpty(dbService) || string.IsNullOrEmpty(dbUser))) { // create connection with PawnSec SecurityAccessor.Instance.InitializeConnection( dbHost, dbPassword, dbPort, dbSchema, dbService, dbUser); pwnSecMsg.Message = "* PAWN SECURITY PROCESSING *"; // retrieve data from PawnSec if (!SecurityAccessor.Instance.RetrieveSecurityData(Resources.PrivateKey, ComputeAppHash(), true, PawnSecApplication.Cashlinx)) { //SecurityAccessor.Instance.Close(); //Application.Exit(); pwnSecMsg.Close(); pwnSecMsg.Dispose(); } else { pwnSecMsg.Close(); pwnSecMsg.Dispose(); //DO NOT REMOVE THE LINE OF CODE BELOW GlobalDataAccessor.Instance.DesktopSession = CashlinxDesktopSession.Instance; //DO NOT REMOVE THE LINE OF CODE ABOVE Application.Run(new Pawn.Forms.NewDesktop()); } } } catch (Exception eX) { MessageBox.Show("Exception caught in CashlinxDesktop.Program during Application.Run: " + "\nMessage : " + eX.Message + "\nStack Trace: " + eX.StackTrace + "\nTarget Site: " + eX.TargetSite + "\nSource : " + eX.Source + "\nData : " + eX.Data + "\nTerminating Application!", "Application Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
private void viewDocButton_Click(object sender, EventArgs e) { //Ensure that the button is not clicked twice this.viewDocButton.Enabled = false; //Get the accessors var cds = GlobalDataAccessor.Instance.DesktopSession; var cC = GlobalDataAccessor.Instance.CouchDBConnector; //Retrieve the document data var pLoadMesg = new ProcessingMessage("* Loading Document *"); //Connect to couch and retrieve document Document doc; string errText; if (!CouchDbUtils.GetDocument( this.StorageId, cC, out doc, out errText)) { pLoadMesg.Close(); pLoadMesg.Dispose(); this.showErrorMessage("view", errText); this.Close(); } else if (doc != null) { pLoadMesg.Message = "* Document Loaded...Displaying *"; //Fetch data string tmpFileName; byte[] fileData; if (!doc.GetSourceData(out fileData)) { this.showErrorMessage("view", "Cannot retrieve file data to show file"); pLoadMesg.Close(); pLoadMesg.Dispose(); this.Close(); return; } //Create temporary file if (!this.createTempFile(fileData, out tmpFileName)) { this.showErrorMessage("view", "Cannot generate file data to show file"); pLoadMesg.Close(); pLoadMesg.Dispose(); this.Close(); return; } pLoadMesg.Close(); pLoadMesg.Dispose(); switch (this.DocumentType) { case Document.DocTypeNames.PDF: DesktopSession.ShowPDFFile(tmpFileName, true); break; case Document.DocTypeNames.RECEIPT: //GJL - do nothing for now until complete receipt renderer ReceiptRenderer receiptR = new ReceiptRenderer(fileData); //Desktop.PrintQueue.ReceiptRenderer receiptR = new Desktop.PrintQueue.ReceiptRenderer(fileData); //receiptDataRetrieved = receiptR.ExecuteServicePawnLoanForReceiptRenderer(this.DocInfo); //receiptR.RichTextBoxContent = bbyteArrayString; receiptR.ShowDialog(); //MessageBox.Show("Show receipt renderer"); //Invoke View receipt rendering form break; case Document.DocTypeNames.BARCODE: MessageBox.Show("Nothing to show"); //Nothing for now) break; case Document.DocTypeNames.TEXT: MessageBox.Show("Nothing to show"); //Nothing for now) //Notepad?? break; case Document.DocTypeNames.BINARY: MessageBox.Show("Nothing to show"); //Nothing for now) //Nothing for now break; case Document.DocTypeNames.INVALID: MessageBox.Show("Nothing to show"); //Nothing for now) //Nothing for now break; } //Delete temporary file try { File.Delete(tmpFileName); } catch (Exception eX) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not delete file: {0} Exception: {1}", tmpFileName, eX); } } } //Re-enable show button this.viewDocButton.Enabled = true; }