private void FindItem(List <string> searchFor, List <string> searchValues)
        {
            string            errorText = null;
            string            errorCode = null;
            List <RetailItem> searchItems;
            string            searchFlag = "NORMAL";
            var dSession = GlobalDataAccessor.Instance.DesktopSession;

            RetailProcedures.SearchForItemPUR(searchFor, searchValues, dSession, searchFlag, out searchItems, out errorCode, out errorText);

            RetailItem        item          = null;
            ItemSearchResults searchResults = new ItemSearchResults(dSession, ItemSearchResultsMode.REPRINT_TAG);

            if (searchItems.Count == 0)
            {
                searchResults.Message = "No valid records found.  Please enter another number.";
                searchResults.ShowDialog();
                return;
            }

            if (searchItems.Count == 1)
            {
                item = searchItems[0];
                if (Item.ItemLocked(item))
                {
                    searchResults.Message = Item.ItemLockedMessage;
                    searchResults.ShowDialog();
                    return;
                }
                if (Commons.CheckICNSubItem(item.Icn))
                {
                    MessageBox.Show("Invalid ICN");
                    return;
                }
            }
            else if (searchItems.Count > 1)
            {
                //here remove items with ICNSubItem true
                SelectItems selectItems = new SelectItems(searchItems, ItemSearchResultsMode.REPRINT_TAG);
                selectItems.ErrorMessage = "The Short code entered is a duplicate. Please make your selection from the list";
                if (selectItems.ShowDialog() == DialogResult.OK)
                {
                    item = selectItems.SelectedItem;
                    if (Item.ItemLocked(item))
                    {
                        searchResults.Message = Item.ItemLockedMessage;
                        searchResults.ShowDialog();
                        return;
                    }
                    if (Commons.CheckICNSubItem(item.Icn))
                    {
                        MessageBox.Show("Invalid ICN");
                        DialogResult = DialogResult.None;
                        return;
                    }
                }
                else
                {
                    txtICN.Text = string.Empty;
                    txtICN.Focus();
                    return;
                }
            }

            if (item != null)
            {
                if (item.ItemStatus == ProductStatus.IP || item.ItemStatus == ProductStatus.PS || item.ItemStatus == ProductStatus.SOLD)
                {
                    MessageBox.Show("The ICN# entered is not a valid number.  Please try again.");
                    return;
                }

                ReprintTagVerify tagVerify = new ReprintTagVerify(dSession, item, ReprintVerifySender.ReprintTag);
                tagVerify.ShowDialog(this);
            }

            //BZ: 899 - After the reprint tag verify has finished, do not allow this form to close
            //- this form should only close when the user hits cancel
            //this.Close();
        }
        private bool FindItem(List <string> searchFor, List <string> searchValues)
        {
            bool              retval    = false;
            string            errorText = null;
            string            errorCode = null;
            List <RetailItem> searchItems;
            string            searchFlag = "NORMAL";

            this.customLabelError.Visible = false;
            this.customLabelError.Text    = string.Empty;


            bool loadQty = this.txtQty.Visible;

            RetailProcedures.SearchForItem(searchFor, searchValues, CDS, searchFlag, loadQty, out searchItems, out errorCode, out errorText);

            RetailItem        item          = null;
            ItemSearchResults searchResults = new ItemSearchResults(GlobalDataAccessor.Instance.DesktopSession, ItemSearchResultsMode.CHARGEOFF);

            if (searchItems.Count == 0)
            {
                this.customLabelError.Visible = true;
                this.customLabelError.Text    = " This ICN number was not found in the current shop. Please check the number and try again.";
                return(retval);
            }

            if (searchItems.Count == 1 && searchItems[0].ItemStatus != ProductStatus.PFI)
            {
                searchResults.ShowDialog();
                return(retval);
            }

            if (searchItems.Count == 1)
            {
                item = searchItems[0];
                if (Item.ItemLocked(item))
                {
                    MessageBox.Show(Item.ItemLockedMessage);
                    return(retval);
                }
            }
            else if (searchItems.Count > 1)
            {
                var distinctItems = from sItem in searchItems
                                    where ((sItem.IsJewelry && sItem.Jewelry.Any(j => j.SubItemNumber == 0)) ||
                                           !sItem.IsJewelry)
                                    select sItem;
                if (distinctItems.Any())
                {
                    SelectItems selectItems = new SelectItems(searchItems, ItemSearchResultsMode.CHARGEOFF);
                    selectItems.ErrorMessage = "The Short code entered is a duplicate. Please make your selection from the list";
                    if (selectItems.ShowDialog() == DialogResult.OK)
                    {
                        item = selectItems.SelectedItem;
                        if (Item.ItemLocked(item))
                        {
                            this.customLabelError.Text    = Item.ItemLockedMessage;
                            this.customLabelError.Visible = true;
                            return(retval);
                        }
                        if (item.mDocType == "9")
                        {
                            this.customLabelError.Text    = "Item is not eligible for Charge off.";
                            this.customLabelError.Visible = true;
                            return(retval);
                        }
                        else if (item.Icn.Substring(Icn.ICN_LENGTH - 1) != "0")
                        {
                            this.customLabelError.Text    = "Item is not eligible for Charge off.";
                            this.customLabelError.Visible = true;
                            return(retval);
                        }

                        if (item.HoldType == HoldTypes.POLICEHOLD.ToString())
                        {
                            this.customLabelError.Visible = true;
                            this.customLabelError.Text    = "This merchandise is on Police Hold. The Police Hold must be released before the item can be charged off.";
                            return(retval);
                        }
                    }
                    else
                    {
                        return(retval);
                    }
                }
                else
                {
                    item = searchItems[0];
                    if (Item.ItemLocked(item))
                    {
                        MessageBox.Show(Item.ItemLockedMessage);
                        return(retval);
                    }
                }
            }

            if (item != null)
            {
                if (item.HoldType == HoldTypes.POLICEHOLD.ToString())
                {
                    this.customLabelError.Text    = "This merchandise is on Police Hold. The Police Hold must be released before the item can be charged off.";
                    this.customLabelError.Visible = true;
                    return(retval);
                }
                else if (item.mDocType == "9")
                {
                    this.customLabelError.Text    = "Cannot charge off NXT items.";
                    this.customLabelError.Visible = true;
                    return(retval);
                }
                else if (item.Icn.Substring(Icn.ICN_LENGTH - 1) != "0")
                {
                    this.customLabelError.Text    = "Cannot charge off sub items.";
                    this.customLabelError.Visible = true;
                    return(retval);
                }
                else if (int.Parse(this.txtQty.Text) > item.Quantity)
                {
                    this.customLabelError.Text    = item.Quantity + " items were found for this CACC category.  Please revise the charge off quantity.";
                    this.customLabelError.Visible = true;

                    this.continueButton.Enabled = false;

                    return(retval);
                }
                else
                {
                    //if (txtQty.Visible)
                    if (isCACC(this.txtICN.Text))
                    {
                        decimal qtyText = 0;

                        if (decimal.TryParse(txtQty.Text, out qtyText) && (item.Quantity > 0))
                        {
                            //do we need to check to make sure DB didn't give us 0 or null
                            decimal qtyRatio = (qtyText / Convert.ToDecimal(item.Quantity));
                            item.ItemAmount = item.PfiAmount * qtyRatio;
                        }
                        item.Quantity = int.Parse(this.txtQty.Text);
                    }

                    ChargeOffDetails detailsForm = new ChargeOffDetails
                    {
                        ChargeOffItem = item
                    };
                    detailsForm.ShowDialog();

                    retval      = (detailsForm.DialogResult == DialogResult.OK);
                    txtICN.Text = string.Empty;
                }
            }

            return(retval);
        }