示例#1
0
        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();
            }
        }
示例#2
0
        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;
        }
 void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     procMsg.Update();
     procMsg.Close();
     procMsg.Dispose();
     SetButtonState(true);
 }
示例#4
0
        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            procMessage.Close();
            if (checkedAddress != null)
            {
                if (checkedAddress.City != null)
                {
                    String oldCity = this.City;
                    this.City = checkedAddress.City;

                    if (!checkedAddress.City.Equals(oldCity) && cityChanging != null)
                    {
                        cityChanging(checkedAddress.City, new RoutedPropertyChangedEventArgs <string>(oldCity, this.City));
                    }
                }
                if (checkedAddress.State != null)
                {
                    String oldState = this.State;
                    this.State = checkedAddress.State;

                    if (!checkedAddress.State.Equals(oldState) && stateChanging != null)
                    {
                        stateChanging(checkedAddress.State, new RoutedPropertyChangedEventArgs <string>(oldState, this.State));
                    }
                }
            }
            else
            {
                this.City  = "";
                this.State = GlobalDataAccessor.Instance.CurrentSiteId.State;
            }
        }
        /// <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);
        }
示例#6
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            if (gvAudits.SelectedRows.Count != 1)
            {
                return;
            }

            InventoryAuditVO audit = gvAudits.SelectedRows[0].Tag as InventoryAuditVO;

            if (audit == null)
            {
                return;
            }

            panelButtons.Enabled = false;
            ProcessingMessage    = new ProcessingMessage("Loading Audit Information", 0);
            ProcessingMessage.Show();
            CommonDatabaseContext dataContext = CreateCommonDatabaseContext();

            InventoryAuditProcedures.GetSummaryInfo(audit, dataContext);
            InventoryAuditProcedures.GetAdditionalAuditInfo(audit, dataContext);
            ProcessingMessage.Close();

            if (!dataContext.Result)
            {
                MessageBox.Show("Error loading CACC information");
                panelButtons.Enabled = true;
                return;
            }

            ADS.ActiveAudit = audit;

            switch (audit.Status)
            {
            case AuditStatus.ACTIVE:
                panelButtons.Enabled       = true;
                NavControlBox.IsCustom     = true;
                NavControlBox.CustomDetail = "VIEWACTIVEAUDIT";
                NavControlBox.Action       = NavBox.NavAction.SUBMIT;
                break;

            case AuditStatus.CLOSED:
                panelButtons.Enabled       = true;
                NavControlBox.IsCustom     = true;
                NavControlBox.CustomDetail = "VIEWCLOSEDAUDIT";
                NavControlBox.Action       = NavBox.NavAction.SUBMIT;
                break;

            default:
                MessageBox.Show("Status not implemented: " + audit.Status.ToString());
                panelButtons.Enabled = true;
                break;
            }
        }
        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;

            //}
        }
示例#8
0
 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();
 }
示例#9
0
 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();
 }
示例#10
0
 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 IH_ProductComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_Setup[0])
            {
                Cursor = Cursors.WaitCursor;


                string filter  = string.Empty;
                string docType = null;

                IH_ItemHistoryDataGridView.ClearSelection();
                IH_ItemHistoryDataGridView.CurrentCell = null;
                var test = GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryPurchases;
                SetButtonState(false);
                switch (IH_ProductComboBox.SelectedItem.ToString())
                {
                case "Pawn":
                    docType = "1";
                    filter  = IH_History_DocType.Name + "=" + 1;
                    break;

                case "Buy":
                    docType     = "2";
                    filter      = IH_History_DocType.Name + "=" + 2;
                    procMsgForm = new ProcessingMessage("Retrieving Customer Purchase History");
                    procMsgForm.Show(this);


                    //async_populateGrid(1, "Retrieving Customer Purchase History", CashlinxDesktopSession.Instance.CustomerHistoryPurchases);
                    if (!_Setup[2])
                    {
                        PurchaseProcedures.GetCustomerPurchases(custNumber);

                        sync_populateGrid <PurchaseVO>(2, GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryPurchases, o => o.Items.Count);
                    }
                    break;

                case "Sale":
                    docType = null;
                    //CashlinxDesktopSession.Instance.CustomerHistorySales
                    procMsgForm = new ProcessingMessage("Retrieving Customer Sales History");
                    procMsgForm.Show(this);
                    filter = IH_History_ItemStatusColumn.Name + "= 'SOLD'";

                    //async_populateGrid(0, "Retrieving Customer Sales History", CashlinxDesktopSession.Instance.CustomerHistorySales);
                    if (!_Setup[1])
                    {
                        RetailProcedures.GetCustomerSales(GlobalDataAccessor.Instance.DesktopSession, custNumber);

                        sync_populateGrid <SaleVO>(1, GlobalDataAccessor.Instance.DesktopSession.CustomerHistorySales,
                                                   o => ((SaleVO)o).RetailItems.Count);
                    }
                    break;

                case "Layaway":
                    docType     = null;
                    filter      = IH_History_ItemStatusColumn.Name + "= 'On Layaway'";
                    procMsgForm = new ProcessingMessage("Retrieving Customer Layaway History");
                    procMsgForm.Show(this);

                    //async_populateGrid(2, "Retrieving Customer Layaway History", CashlinxDesktopSession.Instance.CustomerHistoryLayaways);
                    if (!_Setup[3])
                    {
                        RetailProcedures.GetCustomerLayaways(GlobalDataAccessor.Instance.DesktopSession, custNumber);

                        sync_populateGrid <LayawayVO>(3, GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLayaways, o => ((LayawayVO)o).RetailItems.Count);
                    }
                    break;

                case "Refund":
                    docType = null;
                    filter  = IH_History_ItemStatusColumn.Name + "= 'REF'";
                    break;

                case "All":
                    procMsgForm = new ProcessingMessage("Retrieving Customer Item History");
                    procMsgForm.Show(this);
                    if (!_Setup[1])
                    {
                        RetailProcedures.GetCustomerSales(GlobalDataAccessor.Instance.DesktopSession, custNumber);

                        sync_populateGrid <SaleVO>(1, GlobalDataAccessor.Instance.DesktopSession.CustomerHistorySales,
                                                   o => ((SaleVO)o).RetailItems.Count);
                    }

                    if (!_Setup[2])
                    {
                        PurchaseProcedures.GetCustomerPurchases(custNumber);

                        sync_populateGrid <PurchaseVO>(2, GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryPurchases, o => o.Items.Count);
                    }


                    if (!_Setup[3])
                    {
                        RetailProcedures.GetCustomerLayaways(GlobalDataAccessor.Instance.DesktopSession, custNumber);

                        sync_populateGrid <LayawayVO>(3, GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLayaways, o => ((LayawayVO)o).RetailItems.Count);
                    }

                    //async_populateGrid(0, "Retrieving Customer Sales History", CashlinxDesktopSession.Instance.CustomerHistorySales);
                    //async_populateGrid(1, "Retrieving Customer Purchase History", CashlinxDesktopSession.Instance.CustomerHistoryPurchases);
                    //async_populateGrid(2, "Retrieving Customer Layaway History", CashlinxDesktopSession.Instance.CustomerHistoryLayaways);
                    break;
                }


                //-- The filter doesn't seem to handle the very last row
                ((DataView)IH_ItemHistoryDataGridView.DataSource).RowFilter = filter;

                IH_ItemHistoryDataGridView.ClearSelection();
                IH_ItemHistoryDataGridView.CurrentCell = null;

                if (IH_ItemHistoryDataGridView.Rows.Count > 0 && docType != null &&
                    IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Cells[IH_History_DocType.Name].Value != null)
                {
                    if ((string)IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Cells[IH_History_DocType.Name].Value != docType)
                    {
                        IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Visible = false;
                    }
                    else
                    {
                        IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Visible = true;
                    }
                }

                else if (IH_ItemHistoryDataGridView.Rows.Count > 0)
                {
                    IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Visible = true;

                    switch (IH_ProductComboBox.SelectedItem.ToString())
                    {
                    case "Sale":
                        if ((string)IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Cells[this.IH_History_ItemStatusColumn.Name].Value !=
                            "SOLD")
                        {
                            IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Visible = false;
                        }

                        break;

                    case "Layaway":
                        if ((string)IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Cells[this.IH_History_ItemStatusColumn.Name].Value !=
                            "On Layaway")
                        {
                            IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Visible = false;
                        }
                        break;

                    case "Refund":
                        if ((string)IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Cells[this.IH_History_ItemStatusColumn.Name].Value !=
                            "REF")
                        {
                            IH_ItemHistoryDataGridView.Rows[IH_ItemHistoryDataGridView.Rows.Count - 1].Visible = false;
                        }
                        break;
                    }
                }

                sortHistoryData();


                if (procMsgForm != null)
                {
                    procMsgForm.Close();
                }
                Cursor = Cursors.Default;
                SetButtonState(true);
            }
        }
        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;
                        }
                    }
                }
            }
        }
        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);
            }
        }
示例#14
0
        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);
        }
示例#15
0
        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);
            }
        }
示例#16
0
        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;
                }
            }
        }
示例#17
0
        private void DownloadFiles()
        {
            ProcessingMessage = new ProcessingMessage("Retrieving upload files", 0);
            ProcessingMessage.Show();
            try
            {
                string tmpPath       = Path.Combine(Application.StartupPath, "tmp");
                string trakkerPath   = Path.Combine(tmpPath, "uptrak");
                string trakkerIdPath = Path.Combine(tmpPath, "trakker.id");

                if (!Directory.Exists(tmpPath))
                {
                    Directory.CreateDirectory(tmpPath);
                }

                FtpHelper ftpHelper = new FtpHelper(FtpHost, FtpUser, FtpPassword);
                ftpHelper.DownloadFile("tmp_" + ADS.ActiveAudit.StoreNumber + "/uptrak", trakkerPath, false);
                ftpHelper.DownloadFile("tmp_" + ADS.ActiveAudit.StoreNumber + "/trakker.id", trakkerIdPath, false);

                string[] fileContents = File.ReadAllLines(trakkerIdPath);

                if (fileContents.Length == 0 || string.IsNullOrWhiteSpace(fileContents[0]))
                {
                    ProcessingMessage.Close();
                    throw new ApplicationException("trakker.id file is empty");
                }

                int trakkerId = Utilities.GetIntegerValue(fileContents[0].Substring(fileContents[0].IndexOf('|') + 1), 0);

                ProcessingMessage.Hide();
                ConfirmTrakker confirmTrakker = new ConfirmTrakker(trakkerId);
                if (confirmTrakker.ShowDialog() == DialogResult.Cancel)
                {
                    ProcessingMessage.Close();
                    return;
                }
                ProcessingMessage.Show();

                TrakkerFileReader  trakkerFileReader = new TrakkerFileReader(trakkerPath);
                List <TrakkerItem> uploadedItems     = trakkerFileReader.ReadFile();

                int count = 0;
                if (uploadedItems.Count > 0)
                {
                    ADS.beginTransactionBlock();
                    foreach (TrakkerItem item in uploadedItems)
                    {
                        count++;
                        ProcessingMessage.Message = string.Format("Uploading record {0} of {1}", count, uploadedItems.Count);
                        CommonDatabaseContext dataContext = new CommonDatabaseContext();

                        InventoryAuditProcedures.UploadTrakkerItem(item, ADS.ActiveAudit.AuditId, trakkerId, ADS.ActiveAudit.StoreNumber, dataContext);

                        if (!dataContext.Result)
                        {
                            ADS.endTransactionBlock(EndTransactionType.ROLLBACK);
                            MessageBox.Show(dataContext.ErrorText);
                            return;
                        }
                    }
                    ADS.endTransactionBlock(EndTransactionType.COMMIT);
                }

                ProcessingMessage.Close();
                ChangeStatusMessage2("Records Uploaded from Trakker " + trakkerId);
                ChangeStatusValue2(uploadedItems.Count.ToString());
                Uploaded = true;
            }
            catch (Exception exc)
            {
                ProcessingMessage.Close();
                BasicExceptionHandler.Instance.AddException("Failed to upload trakker files", exc);
                MessageBox.Show(exc.Message);
            }
        }
        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;
        }
        /*__________________________________________________________________________________________*/
        private void Setup()
        {
            IH_CategoryComboBox.SelectedText = "Pawn";
            IH_CategoryComboBox.Enabled      = false;
            _ActiveTicketNumber = 0;

            DataView theData = new DataView();

            theData.Table = new DataTable("ItemHistory");
            theData.Table.Columns.Add(IH_History_TransactionNumberColumn.Name);
            theData.Table.Columns.Add(IH_History_StatusDateColumn.Name);
            theData.Table.Columns.Add(IH_History_ItemStatusColumn.Name);
            theData.Table.Columns.Add(IH_History_ItemDescriptionColumn.Name);
            theData.Table.Columns.Add(IH_History_DocType.Name);
            theData.Table.Columns.Add(IH_History_TktNo.Name);


            IH_ItemHistoryDataGridView.DataSource = theData;

            //Get all the customer loans
            if (GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans == null ||
                GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans.Count == 0)
            {
                if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null)
                {
                    custNumber = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber;
                }
                if (!string.IsNullOrEmpty(custNumber))
                {
                    Cursor      = Cursors.WaitCursor;
                    procMsgForm = new ProcessingMessage("Retrieving Customer Loan History");
                    SetButtonState(false);
                    procMsgForm.Show(this);


                    if (!_Setup[0])
                    {
                        CustomerProcedures.GetCustomerLoanData(GlobalDataAccessor.Instance.DesktopSession, custNumber);
                    }

                    //CustomerProcedures.GetCustomerLoanData(custNumber);

                    /*
                     * bgControl[0] = new AutoResetEvent(false);
                     * bg_tasks[0] = new BackgroundWorker();
                     * bg_tasks[0].DoWork += bw_getSales;
                     * bg_tasks[0].RunWorkerAsync();
                     *
                     * bgControl[1] = new AutoResetEvent(false);
                     * bg_tasks[1] = new BackgroundWorker();
                     * bg_tasks[1].DoWork += bw_getBuys;
                     * bg_tasks[1].RunWorkerAsync();
                     *
                     * bgControl[2] = new AutoResetEvent(false);
                     * bg_tasks[2] = new BackgroundWorker();
                     * bg_tasks[2].DoWork += bw_getLayaways;
                     * bg_tasks[2].RunWorkerAsync();
                     */
                    //procMsgForm.Dispose();
                }
            }
            if (GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans != null)
            {
                sync_populateGrid(0, GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans,
                                  o => o.Items.Count);

                //addData(theData,  (List<CustomerProductDataVO>) CashlinxDesktopSession.Instance.CustomerHistorySales.Cast<CustomerProductDataVO>());

                theData.Sort = IH_History_ItemStatusColumn.Name;

                sortHistoryData();

                _Setup[0] = true;

                IH_AddItemToNewPawnLoan.Enabled = false;
                if (GlobalDataAccessor.Instance.DesktopSession.ShowOnlyHistoryTabs)
                {
                    this.customButtonExit.Text = "Exit";
                }
                else
                {
                    this.customButtonExit.Text = "Cancel";
                }
            }

            SetButtonState(true);

            if (procMsgForm != null)
            {
                procMsgForm.Close();
            }

            this.Cursor = Cursors.Default;
        }
        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
        }
        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;
        }
示例#22
0
        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;
        }
示例#23
0
        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();
            }
        }