public LoanSearchResults(DataSet s, PawnInquiry criteria, string dataTableName)
            : base(s, criteria, dataTableName)
        {
            #region Data Grid Initialization

            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();

            //Display grid with current principal if partial payments are allowed.
            if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).IsPartialPaymentAllowed(GlobalDataAccessor.Instance.CurrentSiteId))
            {
                this.Shop             = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.ticket           = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.cust_name        = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.DateTime         = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.LnAmount         = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.PrinicipalAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.Status           = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.UserID           = new System.Windows.Forms.DataGridViewTextBoxColumn();

                this.resultsGrid_dg.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[]
                {
                    this.Shop,
                    this.ticket,
                    this.cust_name,
                    this.DateTime,
                    this.LnAmount,
                    this.PrinicipalAmount,
                    this.Status,
                    this.UserID
                });
            }
            else
            {
                this.Shop      = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.ticket    = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.cust_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.DateTime  = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.LnAmount  = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.Status    = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.UserID    = new System.Windows.Forms.DataGridViewTextBoxColumn();

                this.resultsGrid_dg.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[]
                {
                    this.Shop,
                    this.ticket,
                    this.cust_name,
                    this.DateTime,
                    this.LnAmount,
                    this.Status,
                    this.UserID
                });
            }

            //
            // Shop
            //
            this.Shop.DataPropertyName = "STORENUMBER";
            this.Shop.HeaderText       = "Shop";
            this.Shop.Name             = "Shop";
            this.Shop.ReadOnly         = true;
            this.Shop.Width            = 50;
            //
            // ticket
            //
            this.ticket.DataPropertyName = "TICKET_NUMBER";
            this.ticket.HeaderText       = "Current Tkt #";
            this.ticket.Name             = "ticket";
            this.ticket.ReadOnly         = true;
            this.ticket.Width            = 83;
            //
            // cust_name
            //
            this.cust_name.DataPropertyName = "CUST_NAME";
            this.cust_name.HeaderText       = "Name";
            this.cust_name.Name             = "cust_name";
            this.cust_name.ReadOnly         = true;
            this.cust_name.Width            = 170;
            //
            // DateTime
            //
            this.DateTime.DataPropertyName   = "DATE_MADE";
            dataGridViewCellStyle3.Format    = "g";
            dataGridViewCellStyle3.NullValue = null;
            this.DateTime.DefaultCellStyle   = dataGridViewCellStyle3;
            this.DateTime.HeaderText         = "Made Date/Time";
            this.DateTime.Name     = "DateTime";
            this.DateTime.ReadOnly = true;
            this.DateTime.Width    = 115;
            //
            // LnAmount
            //
            this.LnAmount.DataPropertyName   = "PRIN_AMOUNT";
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            dataGridViewCellStyle4.Format    = "C2";
            dataGridViewCellStyle4.NullValue = null;
            this.LnAmount.DefaultCellStyle   = dataGridViewCellStyle4;
            this.LnAmount.HeaderText         = "Loan Amount";
            this.LnAmount.Name     = "LnAmount";
            this.LnAmount.ReadOnly = true;
            this.LnAmount.Width    = 90;
            //
            // Current Prin. Amount
            //
            //Only show current principal column if partial payments are allowed.
            if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).IsPartialPaymentAllowed(GlobalDataAccessor.Instance.CurrentSiteId))
            {
                this.PrinicipalAmount.DataPropertyName = "PartPymtPrinAmt";
                dataGridViewCellStyle5.Alignment       = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
                dataGridViewCellStyle5.Format          = "C2";
                dataGridViewCellStyle5.NullValue       = null;
                this.PrinicipalAmount.DefaultCellStyle = dataGridViewCellStyle5;
                this.PrinicipalAmount.HeaderText       = "Current Prin. Amt";
                this.PrinicipalAmount.Name             = "PrinAmt";
                this.PrinicipalAmount.ReadOnly         = true;
                this.PrinicipalAmount.Width            = 100;
            }
            //
            // Status
            //
            this.Status.DataPropertyName = "STATUS_CD";
            this.Status.HeaderText       = "Status";
            this.Status.Name             = "Status";
            this.Status.ReadOnly         = true;
            this.Status.Width            = 65;
            //
            // UserID
            //
            this.UserID.DataPropertyName = "ENT_ID";
            this.UserID.HeaderText       = "UserID";
            this.UserID.Name             = "UserID";
            this.UserID.ReadOnly         = true;
            this.UserID.Width            = 65;

            this.resultsGrid_dg.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.resultsGrid_dg_CellContentClick);
            #endregion

            if (criteria.byDate)
            {
                resultsGrid_dg.Columns[4].HeaderText =
                    StringDBMap_Enum <PawnInquiry.searchDateType_enum> .displayValue(criteria.dateType) +
                    " Date / Time";

                resultsGrid_dg.Columns[4].DataPropertyName =
                    StringDBMap_Enum <PawnInquiry.searchDateType_enum> .toDBValue(criteria.dateType);
            }
            else
            {
                resultsGrid_dg.Columns[2].HeaderText =
                    StringDBMap_Enum <PawnInquiry.searchTicketType_enum> .displayValue(criteria.ticketType) +
                    " Tkt #";

                resultsGrid_dg.Columns[2].DataPropertyName =
                    StringDBMap_Enum <PawnInquiry.searchTicketType_enum> .toDBValue(criteria.ticketType);
            }

            this.Print_btn.Enabled = true;
            this.Print_btn.Click  += new System.EventHandler(this.Print_btn_Click);
        }
Esempio n. 2
0
        private void Find_btn_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            PawnInquiry.searchDateType_enum   dateSearchType   = (PawnInquiry.searchDateType_enum) this.dateOptions_CB.SelectedIndex;
            PawnInquiry.searchTicketType_enum ticketSearchType = (PawnInquiry.searchTicketType_enum)TicketNumberType_CB.SelectedIndex;

            var loanData = new PawnInquiry()
            {
                byDate     = dateOption_rb.Checked,
                dateType   = dateSearchType,
                startDate  = dateCalendarStart.SelectedDate,
                endDate    = dateCalendarEnd.SelectedDate,
                ticketType = ticketSearchType,
                status     = (PawnInquiry.searchStatus_enum)status_cb.SelectedIndex,
                userID     = userID_tb.Text,
                sortBy     = (PawnInquiry.sortField_enum)sortBy_cb.SelectedIndex,
                sortDir    = (PawnInquiry.sortDir_enum)sortDir_cb.SelectedIndex
            };


            if (fromTicket_tb.Text.Length > 0)
            {
                int.TryParse(fromTicket_tb.Text, out loanData.lowTicketNumber);
            }

            if (toTicket_tb.Text.Length > 0)
            {
                int.TryParse(toTicket_tb.Text, out loanData.highTicketNumber);
            }

            if (lowLoanAmt_tb.Text.Length > 0)
            {
                double.TryParse(lowLoanAmt_tb.Text, out loanData.lowAmount);
            }

            if (highLoanAmt_tb.Text.Length > 0)
            {
                double.TryParse(highLoanAmt_tb.Text, out loanData.highAmount);
            }

            switch (mailer_cb.SelectedIndex)
            {
            case 0:
                loanData.pfiMailer = "Y";
                break;

            case 1:
                loanData.pfiMailer = "N";
                break;

            default:
                loanData.pfiMailer = string.Empty;
                break;
            }

            DataSet s = null;

            try
            {
                s = loanData.getData();

                if (s.IsNullOrEmpty())
                {
                    throw new BusinessLogicException(ReportConstants.NODATA);
                }
            }
            catch (BusinessLogicException blex)
            {
                MessageBox.Show(blex.Message);
                return;
            }
            //this.NavControlBox.Action = NavBox.NavAction.HIDEANDSHOW;
            Cursor.Current = Cursors.Default;

            this.Visible = false;
//            var resultsDisplay = new LoanSearchResults(s, loanData,"PAWN_INFO");

            if (loanData.errorLevel != 0)
            {
                MessageBox.Show(loanData.errorMessage);
            }
            else
            {
                this.Visible = false;
                var resultsDisplay = new LoanSearchResults(s, loanData, "PAWN_INFO");

                resultsDisplay.ShowDialog();

                if (resultsDisplay.DialogResult == DialogResult.Cancel)
                {
                    this.Close();
                }
                else
                {
                    this.Visible = true;
                }
            }
        }