private void ShowPawnItemDetail(DataGridViewCellMouseEventArgs e)
        {
            DataGridViewRow myRow = MerchandiseDataGridView.Rows[e.RowIndex];

            if (e.ColumnIndex == 1 && e.RowIndex >= 0)
            {
                PawnLoan pawnLoan = GlobalDataAccessor.Instance.DesktopSession.CurrentPawnLoan;

                string icn = Utilities.GetStringValue(myRow.Cells[ICN.Index].Value, "");

                int iDx = pawnLoan.Items.FindIndex(p => p.Icn == icn);

                if (iDx >= 0)
                {
                    // Need to populate pawnLoan from GetCat5
                    int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask(pawnLoan.Items[iDx].CategoryCode);
                    DescribedMerchandise dmPawnItem = new DescribedMerchandise(iCategoryMask);
                    Item pawnItem = pawnLoan.Items[iDx];
                    Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, true);
                    pawnLoan.Items.RemoveAt(iDx);
                    pawnLoan.Items.Insert(iDx, pawnItem);
                    // End GetCat5 populate
                    //Add the current loan as the active pawn loan
                    GlobalDataAccessor.Instance.DesktopSession.PawnLoans.Insert(0, pawnLoan);
                    // Placeholder for ReadOnly DescribedItem.cs
                    DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, iDx)
                    {
                        SelectedProKnowMatch = pawnLoan.Items[iDx].SelectedProKnowMatch
                    };
                    myForm.ShowDialog(this);
                }
            }
        }
コード例 #2
0
 private void firearmDescEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (gunItemData != null)
     {
         LoadItemData();
         int iCategoryMask = Utilities.GetIntegerValue(gunCACCCode);
         DescribedMerchandise dmPawnItem = new DescribedMerchandise(iCategoryMask);
         Item pawnItem = CashlinxDesktopSession.Instance.ActivePawnLoan.Items[0];
         if (pawnItem.Jewelry == null || pawnItem.Jewelry.Count == 0)
         {
             dmPawnItem.SelectedPawnItem.Jewelry = null;
         }
         // Due to holding and updated Item Amount, add it to Selected Pawn Item
         dmPawnItem.SelectedPawnItem.ItemAmount = pawnItem.ItemAmount;
         Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, false);
         // Update local PFI Active Loan Pawn Item with Cat5 Info
         pawnItem.CategoryMask = iCategoryMask;
         pawnItem.ItemReason   = ItemReason.BLNK;
         GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.RemoveAt(0);
         GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.Insert(0, pawnItem);
         GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext       = CurrentContext.GUNEDIT;
         GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = 0;
         NavControlBox.IsCustom     = true;
         NavControlBox.CustomDetail = "DescribeMerchandise";
         NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
     }
 }
コード例 #3
0
        private void dataGridViewMdse_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex == 0)
            {
                try
                {
                    string   errorMsg;
                    int      storeId = Utilities.GetIntegerValue(_storeNumber, 0);
                    PawnLoan custPawnLoan;
                    if (customDataGridViewTransactions.CurrentRow != null)
                    {
                        int ticketNumber = Utilities.GetIntegerValue(customDataGridViewTransactions.CurrentRow.Cells[12].Value);
                        //Send the control back if the ticket number is not valid
                        if (!(ticketNumber > 0))
                        {
                            return;
                        }
                        string errorCode;
                        bool   retValue = HoldsProcedures.GetPawnLoanHolds(storeId, ticketNumber, "0", out custPawnLoan, out errorCode, out errorMsg);

                        if (retValue)
                        {
                            var activePawnLoan = GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan;
                            if (custPawnLoan != null)
                            {
                                //Go to describe item read only view
                                if (custPawnLoan.Items[e.RowIndex].CategoryMask < 1)
                                {
                                    // Need to populate pawnLoan from GetCat5
                                    int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask
                                                            (custPawnLoan.Items[e.RowIndex].CategoryCode);
                                    var  dmPawnItem = new DescribedMerchandise(iCategoryMask);
                                    Item pawnItem   = custPawnLoan.Items[e.RowIndex];
                                    Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, true);
                                    pawnItem.CategoryMask = iCategoryMask;
                                    custPawnLoan.Items.RemoveAt(e.RowIndex);
                                    custPawnLoan.Items.Insert(e.RowIndex, pawnItem);
                                    // End GetCat5 populate
                                }

                                GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan = custPawnLoan;
                                // Call Describe Item Page
                                DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, e.RowIndex)
                                {
                                    SelectedProKnowMatch = custPawnLoan.Items[e.RowIndex].SelectedProKnowMatch
                                };
                                myForm.ShowDialog(this);
                                GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan = activePawnLoan;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    BasicExceptionHandler.Instance.AddException("Error trying to view details of selected item", new ApplicationException(ex.Message));
                    this.NavControlBox.Action = NavBox.NavAction.CANCEL;
                }
            }
        }
コード例 #4
0
        private void firearmDescEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (gunItemData != null)
            {
                LoadItemData();
                int iCategoryMask = Utilities.GetIntegerValue(gunCACCCode);
                DescribedMerchandise dmPawnItem = new DescribedMerchandise(iCategoryMask);
                Item pawnItem = CashlinxPawnSupportSession.Instance.ActivePawnLoan.Items[0];
                if (pawnItem.Jewelry == null || pawnItem.Jewelry.Count == 0)
                {
                    dmPawnItem.SelectedPawnItem.Jewelry = null;
                }
                // Due to holding and updated Item Amount, add it to Selected Pawn Item
                dmPawnItem.SelectedPawnItem.ItemAmount = pawnItem.ItemAmount;
                Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, false);
                // Update local PFI Active Loan Pawn Item with Cat5 Info
                pawnItem.CategoryMask = iCategoryMask;
                pawnItem.ItemReason   = ItemReason.BLNK;

                GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.RemoveAt(0);
                GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.Insert(0, pawnItem);
                GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext       = CurrentContext.GUNEDIT;
                GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = 0;

                var cdSession = CashlinxPawnSupportSession.Instance;
                //cdSession.ResourceProperties.oldvistabutton_blue = Properties.Resources.oldvistabutton_blue;
                cdSession.ResourceProperties.vistabutton_blue = Properties.Resources.vistabutton_blue;
                cdSession.ResourceProperties.cl1 = Common.Properties.Resources.cl1;
                cdSession.ResourceProperties.cl2 = Common.Properties.Resources.cl2;
                cdSession.ResourceProperties.cl3 = Common.Properties.Resources.cl3;
                cdSession.ResourceProperties.cl4 = Common.Properties.Resources.cl4;
                cdSession.ResourceProperties.cl5 = Common.Properties.Resources.cl5;
                cdSession.ResourceProperties.newDialog_400_BlueScale = Common.Properties.Resources.newDialog_400_BlueScale;
                cdSession.ResourceProperties.newDialog_512_BlueScale = Common.Properties.Resources.newDialog_512_BlueScale;
                cdSession.ResourceProperties.newDialog_600_BlueScale = Common.Properties.Resources.newDialog_600_BlueScale;

                cdSession.ResourceProperties.OverrideMachineName = global::Support.Properties.Resources.OverrideMachineName;
                cdSession.HistorySession.Trigger = Commons.TriggerTypes.GUNBOOKEDIT;

                NavControlBox.IsCustom     = true;
                NavControlBox.CustomDetail = "DescribeMerchandise";
                NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;

                //DescribeMerchandise descMerchFrm = new DescribeMerchandise(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.GUNEDIT);
                //descMerchFrm.ShowDialog();
            }
        }
        private void ShowBuyDetail(DataGridViewCellMouseEventArgs e)
        {
            DataGridViewRow myRow            = MerchandiseDataGridView.Rows[e.RowIndex];
            int             itemTicketNumber = GlobalDataAccessor.Instance.DesktopSession.TicketLookedUp;

            if (e.ColumnIndex == 1 && e.RowIndex >= 0)
            {
                var purchases = GlobalDataAccessor.Instance.DesktopSession.Purchases;

                string icn = Utilities.GetStringValue(myRow.Cells[ICN.Index].Value, "");

                var purchaseItems = purchases.SelectMany(purchaseVo => purchaseVo.Items).ToList();

                int iDx = purchaseItems.FindIndex(item => item.Icn == icn);

                if (iDx >= 0)
                {
                    // Need to populate pawnLoan from GetCat5
                    int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask(purchaseItems[iDx].CategoryCode);
                    DescribedMerchandise dmPurchaseItem = new DescribedMerchandise(iCategoryMask);
                    Item purchaseItem = purchaseItems[iDx];
                    Item.PawnItemMerge(ref purchaseItem, dmPurchaseItem.SelectedPawnItem, true);

                    purchaseItems.RemoveAt(iDx);
                    purchaseItems.Insert(iDx, purchaseItem);

                    PurchaseVO activePurchase = purchases.Find(p => p.TicketNumber == itemTicketNumber);
                    activePurchase.Items = purchaseItems;

                    GlobalDataAccessor.Instance.DesktopSession.ActivePurchase = activePurchase;
                    DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, iDx, true)
                    {
                        SelectedProKnowMatch = purchaseItems[iDx].SelectedProKnowMatch
                    };
                    myForm.ShowDialog(this);
                }
            }
        }
コード例 #6
0
        private void itemSearchFormNavAction(object sender, object data)
        {
            NavBox     itemSearchNavBox = (NavBox)sender;
            ItemSearch itemSearchForm   = (ItemSearch)data;

            NavBox.NavAction action = itemSearchNavBox.Action;
            if (action == NavBox.NavAction.BACKANDSUBMIT)
            {
                GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                action = NavBox.NavAction.SUBMIT;
            }
            switch (action)
            {
            case NavBox.NavAction.SUBMIT:
                if (itemSearchNavBox.IsCustom)
                {
                    string custDet = itemSearchNavBox.CustomDetail;
                    if (custDet.Equals("GetCategory") || custDet.Equals("TemporaryICN"))
                    {
                        itemSearchForm.Hide();
                        this.nextState = SaleFlowState.DescribeMerchandise;
                    }
                    else if (custDet.Equals("ViewItemDetails"))
                    {
                        //Show describe item form as show dialog
                        int iItemIdx      = GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex;
                        int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask(GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.RetailItems[iItemIdx].CategoryCode);
                        DescribedMerchandise dmPawnItem = new DescribedMerchandise(iCategoryMask);
                        Item pawnItem = GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.RetailItems[iItemIdx];
                        Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, true);
                        ((CustomerProductDataVO)GlobalDataAccessor.Instance.DesktopSession.ActiveRetail).Items.Insert(0, pawnItem);
                        // End GetCat5 populate
                        // Placeholder for ReadOnly DescribedItem.cs
                        DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, 0)
                        {
                            SelectedProKnowMatch = ((CustomerProductDataVO)GlobalDataAccessor.Instance.DesktopSession.ActiveRetail).Items[0].SelectedProKnowMatch
                        };
                        myForm.ShowDialog(itemSearchForm);
                    }
                    else if (custDet.Equals("LookupCustomer"))
                    {
                        itemSearchForm.Hide();
                        if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null && !string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber))
                        {
                            this.nextState = SaleFlowState.ManagePawnApplication;
                        }
                        else
                        {
                            this.nextState = SaleFlowState.LookupCustomer;
                        }
                    }
                    else if (custDet.Equals("Reload"))
                    {
                        GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop();
                        this.nextState = SaleFlowState.ItemSearch;
                    }
                    else if (custDet.Equals("ProcessTender"))
                    {
                        GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop();
                        this.nextState = SaleFlowState.TenderIn;
                    }
                }
                else
                {
                    //Default happy path next state
                    this.parentForm = itemSearchForm;
                    this.nextState  = SaleFlowState.ProcessTender;
                }
                break;

            case NavBox.NavAction.CANCEL:
                this.nextState = SaleFlowState.CancelFlow;
                break;

            default:
                throw new ApplicationException("" + action.ToString() + " is not a valid state for ItemSearch");
            }

            this.executeNextState();
        }
コード例 #7
0
        private void DoDefaultJewelryAdd()
        {
            DescribedMerchandise tmpPawnItem = new DescribedMerchandise(1700);

            Jewelry = tmpPawnItem.SelectedPawnItem.Jewelry;
        }
コード例 #8
0
        /*__________________________________________________________________________________________*/
        private void IH_AddItemToNewPawnLoan_Click(object sender, EventArgs e)
        {
            var pawnLoan = GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans
                           .First(pl => pl.TicketNumber == _ActiveTicketNumber);

            if (pawnLoan != null)
            {
                Item pawnItem = pawnLoan.Items
                                .First(pi => pi.Icn == _ActiveICN);

                if (pawnItem != null)
                {
                    if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan == null)
                    {
                        GlobalDataAccessor.Instance.DesktopSession.PawnLoans = new List <PawnLoan>(1)
                        {
                            new PawnLoan()
                        };
                        if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan != null)
                        {
                            GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items = new List <Item>();
                        }
                        GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = 0;
                    }
                    else if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.TicketNumber != pawnLoan.TicketNumber &&
                             GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.TicketNumber != 0
                             )
                    {
                        GlobalDataAccessor.Instance.DesktopSession.PawnLoans = new List <PawnLoan>(1)
                        {
                            new PawnLoan()
                        };
                        GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items      = new List <Item>();
                        GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = 0;
                    }
                    else
                    {
                        int itemAlreadyExists = GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.FindIndex(s => s.Icn == pawnItem.Icn);
                        if (itemAlreadyExists >= 0)
                        {
                            GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.RemoveAt(itemAlreadyExists);
                        }
                        GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.Count;
                    }


                    //The attributes of the pawn item need to be derived
                    int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask
                                            (pawnItem.CategoryCode);

                    var dmPawnItem = new DescribedMerchandise(iCategoryMask);
                    Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, false);
                    pawnItem.CategoryMask = iCategoryMask;
                    pawnItem.ItemReason   = ItemReason.BLNK;
                    pawnItem.mDocType     = "1";
                    if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan != null)
                    {
                        if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.Count > 0)
                        {
                            pawnItem.mItemOrder = GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.Count - 1;
                        }
                        else
                        {
                            pawnItem.mItemOrder = 0;
                        }
                    }

                    pawnItem.mStore = Convert.ToInt32(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber);
                    pawnItem.mYear  = Convert.ToInt16(ShopDateTime.Instance.ShopDate.Year.ToString().Substring(ShopDateTime.Instance.ShopDate.Year.ToString().Length - 1));
                    if (pawnItem.IsGun)
                    {
                        QuickCheck quickInfo = new QuickCheck
                        {
                            GunType = pawnItem.CategoryDescription
                        };
                        pawnItem.QuickInformation = quickInfo;
                    }
                    GlobalDataAccessor.Instance.DesktopSession.DescribeItemSelectedProKnowMatch = pawnItem.SelectedProKnowMatch;

                    GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext = CurrentContext.NEW;
                    if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan != null)
                    {
                        GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Fees.Clear();
                        GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.Add(pawnItem);
                    }
                    NavControlBox.CustomDetail = "AddNewLoan";
                    NavControlBox.IsCustom     = true;
                    NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// Main execution function for ChangeRetailPriceFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = suspendedState;
            }
            ChangeRetailPriceFlowState inputState = (ChangeRetailPriceFlowState)inputData;

            switch (inputState)
            {
            case ChangeRetailPriceFlowState.ItemSearch:
                if (GlobalDataAccessor.Instance.DesktopSession.ActiveRetail == null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.Sales.Add(new SaleVO());
                    GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = 0;
                }
                ChangeRetailPriceSearch itemSearchFrm = new ChangeRetailPriceSearch(GlobalDataAccessor.Instance.DesktopSession);
                Form currForm = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(itemSearchFrm);
                if (currForm.GetType() == typeof(ChangeRetailPriceSearch))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm itemSearchBlk = CommonAppBlocks.Instance.CreateChangeRetailPriceSearchShowBlock(this.parentForm, this.itemSearchFormNavAction);
                    if (!itemSearchBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Change Retail Price Search block");
                    }
                }

                break;

            case ChangeRetailPriceFlowState.DescribeItem:
                //Show describe item form as show dialog
                int  iItemIdx      = GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex;
                int  iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask(GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.RetailItems[iItemIdx].CategoryCode);
                var  dmPawnItem    = new DescribedMerchandise(iCategoryMask);
                Item pawnItem      = GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.RetailItems[iItemIdx];
                Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, true);
                ((CustomerProductDataVO)GlobalDataAccessor.Instance.DesktopSession.ActiveRetail).Items.Insert(0, pawnItem);
                // End GetCat5 populate
                // Placeholder for ReadOnly DescribedItem.cs

                GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext = CurrentContext.CHANGE_RETAIL_PRICE;
                var describeItemBlk = CommonAppBlocks.Instance.DescribeItemChangeRetailPriceBlock(this.parentForm, this.describeItemFormAction, ((CustomerProductDataVO)GlobalDataAccessor.Instance.DesktopSession.ActiveRetail).Items[0].SelectedProKnowMatch);
                if (!describeItemBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Item Block");
                }
                break;

            case ChangeRetailPriceFlowState.CancelFlow:
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case ChangeRetailPriceFlowState.ExitFlow:
                break;

            default:
                throw new ApplicationException("Invalid change retail price flow state");
            }

            return(true);
        }
コード例 #10
0
        public void execute()
        {
            //Perform lookup customer

            /*this.AddLoadForm("LookupCustomer", new LookupCustomer(), 1,
             *  new Dictionary<string, string>()
             *  {
             *      {
             *          "lookupCustomerLastName",
             *          this.input.LastName
             *      },
             *      {
             *          "lookupCustomerFirstName",
             *          this.input.FirstName
             *      }
             *  },
             *  new Dictionary<string, TupleType<Control, ControlType, ControlTriggerType>>()
             *  {
             *      {
             *          "lookupCustomerFindButton",
             *          new TupleType<Control, ControlType, ControlTriggerType>(null, ControlType.BUTTON, ControlTriggerType.CLICK)
             *
             *      }
             *  });
             * this.SetFieldsOnForm("LookupCustomer");
             * this.TriggerControlOnForm("LookupCustomer", "lookupCustomerFindButton");*/
            //Get the site id
            SiteId curSite = cds.CurrentSiteId;

            //Perform customer lookup
            DateTime  dtFullStart = DateTime.Now;
            DateTime  custLookupStart = DateTime.Now;
            DataTable customerTable, customerIds, customerContacts, customerAddress, customerEmails, customerNotes, customerStoreCredit;
            string    errorCode, errorMesg;
            var       dbProcedures = new CustomerDBProcedures(this.cds);

            //CustomerProcedures custProcedures = new CustomerProcedures();
            try
            {
                bool retVal = dbProcedures.ExecuteLookupCustomer(this.input.Mid.FirstName, this.input.Mid.LastName,
                                                                 "", "", "", "", "", "", "", "", "", "", out customerTable,
                                                                 out customerIds, out customerContacts, out customerAddress,
                                                                 out customerEmails, out customerNotes, out customerStoreCredit, out errorCode,
                                                                 out errorMesg);
                if (!retVal || customerTable == null || customerTable.Rows == null || customerTable.Rows.Count <= 0)
                {
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", 0.0d));
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d));
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                    return;
                }
            }
            catch (Exception eX)
            {
                input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                return;
            }
            DateTime custLookupStop     = DateTime.Now;
            DateTime managePawnAppStart = DateTime.Now;
            //Choose first customer returned
            DataRow    chosenCust = customerTable.Rows[0];
            var        partyId    = (string)chosenCust["party_id"];
            CustomerVO cust       = null;

            try
            {
                cust = CustomerProcedures.getCustomerDataInObject(partyId, customerIds, customerContacts,
                                                                  customerAddress, customerEmails, customerNotes,
                                                                  customerStoreCredit, chosenCust);
            }
            catch (Exception eX)
            {
                TimeSpan custLookupTimeEx = custLookupStop - custLookupStart;
                input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                return;
            }
            if (cust == null)
            {
                TimeSpan custLookupTimeEx = custLookupStop - custLookupStart;
                input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                return;
            }

            //Create pawn application
            cds.ActiveCustomer = cust;
            string pawnAppId = "1";

            try
            {
                IdentificationVO curId          = cust.getFirstIdentity();
                bool             createdPawnApp = dbProcedures.InsertPawnApplication(
                    cust.CustomerNumber,
                    curSite.StoreNumber,
                    " ",
                    " ",
                    curId.IdType,
                    curId.IdValue,
                    curId.IdIssuer,
                    curId.IdExpiryData.Date.ToShortDateString(),
                    cds.UserName,
                    out pawnAppId,
                    out errorCode,
                    out errorMesg);

                if (!createdPawnApp || string.IsNullOrEmpty(pawnAppId))
                {
                    TimeSpan custLookupTimeEx = custLookupStop - custLookupStart;
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds));
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d));
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                    input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                    return;
                }
            }
            catch (Exception eX)
            {
                TimeSpan custLookupTimeEx = custLookupStop - custLookupStart;
                input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                return;
            }
            DateTime managePawnAppStop = DateTime.Now;

            //Start building pawn loan
            DateTime pawnLoanTenderStart = DateTime.Now;
            PawnLoan curLoan             = cds.ActivePawnLoan;

            curLoan.OrgShopNumber = curSite.StoreNumber;
            curLoan.PawnAppId     = pawnAppId;
            cds.CurPawnAppId      = pawnAppId;
            cds.Clothing          = " ";
            cds.TTyId             = "1";
            //Choose what will be on the loan (max 3) (one of each, or a combo of general, jewelry, and/or gun)
            var randClass         = new Random();
            int numberOfLoanItems = 1 + (int)(randClass.NextDouble() * 2.0d);
            int randGenCat        = 1 + (int)(randClass.NextDouble() * 2.0d);
            int randJewCat        = 1 + (int)(randClass.NextDouble() * 2.0d);
            int randGunCat        = 1 + (int)(randClass.NextDouble() * 2.0d);



            try
            {
                //We have one loan item
                int finalGenCat = randGenCat - 1;
                if (finalGenCat < 0 || finalGenCat > 2)
                {
                    finalGenCat = 0;
                }
                int finalJewCat = randJewCat - 1;
                if (randJewCat < 0 || randJewCat > 2)
                {
                    randJewCat = 0;
                }
                int finalGunCat = randGunCat - 1;
                if (randGunCat < 0 || randGunCat > 2)
                {
                    randGunCat = 0;
                }

                curLoan.Fees = new List <Fee>(numberOfLoanItems);
                if (numberOfLoanItems == 1)
                {
                    int catG     = genCategories[randGenCat - 1];
                    var descMerc = new DescribedMerchandise(catG);
                    curLoan.Items.Add(descMerc.SelectedPawnItem);
                    curLoan.Items[0].TicketDescription = "TestGenDesc";
                    Item firstItem = curLoan.Items[0];
                    firstItem.mStore       = 6016;
                    firstItem.CategoryCode = genCategories[randGenCat - 1];
                }
                //We have two loan items
                else if (numberOfLoanItems == 2)
                {
                    int catGenG     = genCategories[randGenCat - 1];
                    int catJewG     = jewCategories[randJewCat - 1];
                    var descGenMerc = new DescribedMerchandise(catGenG);
                    var descJewMerc = new DescribedMerchandise(catJewG);
                    curLoan.Items.Add(descGenMerc.SelectedPawnItem);
                    curLoan.Items.Add(descJewMerc.SelectedPawnItem);
                    curLoan.Items[0].TicketDescription = "TestGenDesc";
                    curLoan.Items[1].TicketDescription = "TestJewDesc";
                    Item firstItem = curLoan.Items[0];
                    firstItem.mStore       = 6016;
                    firstItem.CategoryCode = genCategories[randGenCat - 1];
                    Item secItem = curLoan.Items[1];
                    secItem.mStore       = 6016;
                    secItem.CategoryCode = jewCategories[randJewCat - 1];
                }
                //We have 3 loan items
                else
                {
                    int catGenG     = genCategories[randGenCat - 1];
                    int catJewG     = jewCategories[randJewCat - 1];
                    int catGunG     = gunCategories[randGunCat - 1];
                    var descGenMerc = new DescribedMerchandise(catGenG);
                    var descJewMerc = new DescribedMerchandise(catJewG);
                    var descGunMerc = new DescribedMerchandise(catGunG);
                    curLoan.Items.Add(descGenMerc.SelectedPawnItem);
                    curLoan.Items.Add(descJewMerc.SelectedPawnItem);
                    curLoan.Items.Add(descGunMerc.SelectedPawnItem);
                    curLoan.Items[0].TicketDescription = "TestGenDesc";
                    curLoan.Items[1].TicketDescription = "TestJewDesc";
                    curLoan.Items[2].TicketDescription = "GUNTestGunDesc";
                    Item firstItem = curLoan.Items[0];
                    firstItem.mStore       = 6016;
                    firstItem.CategoryCode = genCategories[randGenCat - 1];
                    Item secItem = curLoan.Items[1];
                    secItem.mStore       = 6016;
                    secItem.CategoryCode = jewCategories[randJewCat - 1];
                    Item thdItem = curLoan.Items[2];
                    thdItem.mStore       = 6016;
                    thdItem.CategoryCode = gunCategories[randGunCat - 1];
                }
            }
            catch (Exception eX)
            {
                TimeSpan custLookupTimeEx = custLookupStop - custLookupStart;
                TimeSpan mngAppTimeEx     = managePawnAppStop - managePawnAppStart;
                input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", mngAppTimeEx.TotalSeconds));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                return;
            }

            //Call underwrite
            try
            {
                //Set loan amount prior to underwriting
                decimal tryAmt;
                curLoan.Amount = 60;
                if (Decimal.TryParse("" + (60 * (1 + (uint)Math.Floor(randClass.NextDouble() * 4))), out tryAmt))
                {
                    curLoan.Amount = tryAmt;
                }
                var upwUtil = new UnderwritePawnLoanUtility(this.cds);
                upwUtil.RunUWP(curSite);
                curLoan.ObjectUnderwritePawnLoanVO = upwUtil.PawnLoanVO;
                //Call process tender execute
                this.tender.ExecuteProcessTender(
                    ProcessTenderController.ProcessTenderMode.NEWLOAN);

                //cleanup once done
                this.cds.ClearCustomerList();
                this.cds.ClearPawnLoan();
                curLoan = null;
            }
            catch (Exception eX)
            {
                //MessageBox.Show("Exception thrown during process tender: " + eX.Message + ", " + eX.StackTrace);
                TimeSpan custLookupTimeEx = custLookupStop - custLookupStart;
                TimeSpan mngAppTimeEx     = managePawnAppStop - managePawnAppStart;
                input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTimeEx.TotalSeconds));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", mngAppTimeEx.TotalSeconds));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", 0.0d));
                input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", 0.0d));
                return;
            }
            DateTime pawnLoanTenderStop = DateTime.Now;

            DateTime dtFullFinish = DateTime.Now;
            //Thread finished

            //Compute times
            TimeSpan finishTime     = dtFullFinish - dtFullStart;
            TimeSpan custLookupTime = custLookupStop - custLookupStart;
            TimeSpan mngAppTime     = managePawnAppStop - managePawnAppStart;
            TimeSpan pwnLoanTender  = pawnLoanTenderStop - pawnLoanTenderStart;

            input.Right.Add(new TupleType <int, string, double>(input.Left, "CUSTOMER", custLookupTime.TotalSeconds));
            input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNAPPL", mngAppTime.TotalSeconds));
            input.Right.Add(new TupleType <int, string, double>(input.Left, "PAWNTEND", pwnLoanTender.TotalSeconds));
            input.Right.Add(new TupleType <int, string, double>(input.Left, "TOTALNEW", finishTime.TotalSeconds));
        }