Exemplo n.º 1
0
        public bool Match(bool sold, bool bought, bool inventoried, Dictionary <string, string> keywords)
        {
            if (sold && ItemIsSold == "N")
            {
                return(false);
            }
            if (bought && ItemIsBought == "N")
            {
                return(false);
            }
            if (inventoried && ItemIsInventoried == "N")
            {
                return(false);
            }

            foreach (string fieldname in keywords.Keys)
            {
                if (fieldname == "ItemName")
                {
                    if (!ItemName.Contains(keywords[fieldname]))
                    {
                        return(false);
                    }
                }
                else if (fieldname == "ItemNumber")
                {
                    if (!ItemNumber.Contains(keywords[fieldname]))
                    {
                        return(false);
                    }
                }
                else if (fieldname == "ItemDescription")
                {
                    if (!ItemDescription.Contains(keywords[fieldname]))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }